Jump to content

Interaction Conditions?


Recommended Posts

Does anyone have a link to where interaction conditions are published/described on the Creation Kit? I am struggling to understand Interaction Conditions placed on a Trigger. What I desire if for the Trigger to fire only if an enemy enters or is within the Trigger. I have tried Subject isAttacking and Subject GetInFaction PlayerEnemyFaction but not getting the desired results. Conditions are being used with a modified version of the Trigger.psc script. Thoughts/suggestions welcomed and appreciated.

Scriptname FBR:FBR_PlinthTrigger extends ObjectReference
{Trigger that watches for a target(s) to enter and exit.  fireTriggerEvent function is called whenever 
the targets enters or leaves the trigger.   fireTriggerEvent function for whatever you need -- you can use IsTargetInTrigger to check if the target has 
just entered or left.}

Group Required_Properties
	ObjectReference property FBR_EaglesLandingPlinth01 auto const mandatory
	Faction Property pPlayerEnemyFaction Auto Const mandatory
EndGroup

bool bTargetInTrigger = false conditional

Actor property targetRef auto
{ if None (default), watching for player
  otherwise, watching for this reference
}

Event onLoad()
	if targetRef == None
		targetRef = game.getPlayer()
	endif
endEvent

Event onTriggerEnter(objectReference triggerRef)
	if(triggerRef == targetRef)
		;target has entered the trigger
		SetTargetInTrigger(true)
; 		debug.trace(self + " target has entered the trigger")
	endif
endEvent

Event onTriggerLeave(objectReference triggerRef)
	if (triggerRef == targetRef)
		;target has left the trigger
		SetTargetInTrigger(false)
; 		debug.trace(self + " target has left the trigger")
	endif
endEvent

bool function IsTargetInTrigger()
	return bTargetInTrigger
endFunction

; PRIVATE function - do not call from outside this script
function SetTargetInTrigger(bool isInTrigger)
	bTargetInTrigger = isInTrigger
	fireTriggerEvent()
endFunction

function fireTriggerEvent()
	; perform as set of actions when an enemy target enters/leaves trigger
	if (bTargetInTrigger == true)
		; open the secret doors on the plinth when the enemies enter
		FBR_EaglesLandingPlinth01.SetOpen(True)
	else
		; close the secret doors on the plinth when the enemies leave or die
		; Utility.Wait(1.5)
		FBR_EaglesLandingPlinth01.SetOpen(False)
	endif
endFunction
Edited by pepperman35
Link to comment
Share on other sites

The only condition list I know is this. It's for Skyrim but hopefully it helps.

 

 

What I desire if for the Trigger to fire only if an enemy enters or is within the Trigger. I have tried Subject isAttacking and Subject GetInFaction PlayerEnemyFaction but not getting the desired results. Conditions are being used with a modified version of the Trigger.psc script. Thoughts/suggestions welcomed and appreciated.

 

To detect an enemy (NPC with red name and health bar), try IsHostileToActor "PlayerRef", Run on: Subject. It's worth mentioning that some NPCs have aggro behavior and turn hostile only after you get too close to them.

Link to comment
Share on other sites

  • 5 months later...

So, i'm just interested, if Interaction Conditions on Activator even work, or maybe pool of suitable condtion functions is limited? For example, what i need for now - Subject.GetEquipped() - doesn't work here.

Edited by hereami
Link to comment
Share on other sites

So, i'm just interested, if Interaction Conditions on Activator even work, or maybe pool of suitable condtion functions is limited? For example, what i need for now - Subject.GetEquipped() - doesn't work here.

Nailed it! Fortunately, Conditions work for trigger boxes, silly me. I've never touched those Activators in CreationKit, and it appears that XEdit doesn't update Conditons Count there, so they are ignored by game or just vanish, if the file is saved in CK. Same thing happened to keywords in aliases, as i remember, but was fixed already.

Edited by hereami
Link to comment
Share on other sites

  • Recently Browsing   0 members

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