Jump to content

Scripting Help - Reference to a group of Objects


Recommended Posts

Hi, I'm brand new to scripting in papyrus. I have a series of head pieces that I am labeling under the keyword GasMask.

 

In an OnEquipped event, I want to check that the player is both wearing a Gas Mask headpiece and is the player character without calling out a specific Gas mask; rather referring to whether the head piece has the keyword GasMask to verify it is an eligible headpiece for the conditional operator.

Scriptname GasMask extends ObjectReference

ObjectReference AmmoGasMaskFilter 
;ObjectReference "head" 

Function RestartTimer()                
  StartTimer(60, TimerID0) ; 
EndFunction

Event OnEquipped(Actor akActor)
        ;Here I want to check against the generic "helm" body slot and find out if it is a GasMask
	If ("head".HasKeyword(Keyword GasMask) == true) && (akActor == Game.GetPlayer())
		RestartTimer() ;Start the timer to consume filters
	endIf
EndEvent
	
...

Is there an easy way I can make the reference to the head body slot and check that it is a gas mask?

Link to comment
Share on other sites

Short answer: No, you can't reference the head body slot like that.

 

Longer answer: Actor.WornHasKeyword(Keyword akKeyword) is the best you're likely going to find in terms of determining whether the player is wearing a gas mask. Or you could create a large formlist with all the gas masks in it and check to see if the player has one of those equipped.

Edited by Reneer
Link to comment
Share on other sites

Ah okay, thanks, I will likely have gas masks for other slots too like neck, mouth only so people don't feel too limited about their choices, but for now I'm just doing the vanilla gas masks. I would like to be able to check for non-GasMask helms as well (because while in interior cells gas masks wont be required). Hopefully that won't be too cumbersome like adding a keyword to every helm in game.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...