How to check if within a triggebox?

Post » Fri Oct 10, 2014 8:18 am

I want a spell to work only within a small area just small enough for a single character. I thought of putting a trigger box over the area and having a condition on the spell to check if the player was within it before it takes effect. What is the best way to check if the needed condition is met?

User avatar
Bee Baby
 
Posts: 3450
Joined: Sun Jun 18, 2006 4:47 am

Post » Thu Oct 09, 2014 10:08 pm

In a script on the triggerbox add 1 to an integer property OnTriggerEnter and subtract 1 from the integer OnTriggerLeave. Then use a condition on your spell to check whether that property is 0 or 1 with GetVMScriptVariable.

So something like this:

Scriptname myTriggerScript extends ObjectReferenceint MyMagicInteger = 0 auto conditionalEvent OnTriggerEnter(ObjectReference akActionRef)MyMagicInteger += 1EndEventEvent OnTriggerLeave(ObjectReference akActionRef)MyMagicInteger -= 1EndEvent
User avatar
Michelle Chau
 
Posts: 3308
Joined: Sat Aug 26, 2006 4:24 am

Post » Fri Oct 10, 2014 7:43 am

Conditional has to follow ObjectReference too.

User avatar
Breanna Van Dijk
 
Posts: 3384
Joined: Mon Mar 12, 2007 2:18 pm


Return to V - Skyrim