Quirky Trigger-zone behaviour

Post » Tue Nov 20, 2012 6:57 pm

New thread for better focus. http://www.gamesas.com/topic/1419309-triggerzone-for-player-and-npcs-dwerepository01-impbutton01/page__p__21701203#entry21701203 - sort of.

A 'plane' may not be wide enough to trigger when the player enters it. Use a trigger box instead and make it at least two bodies wide.
With the reset of the door, you might try a 'disable' command first, wait a 10th of a second, then reset it, wait a 10th of a second, then enable it. That might reset it.
I took your advice on board WillieSea and made my trigger take up more volume. It now at least recognises stuff passing through it. I'm still getting some really weird behaviour though.
Here is my script.

Spoiler

Scriptname MDHVaultKeepOutScript01 extends ObjectReference{Trigger plane in doorway. Pushes actors away. Resets vault}ObjectReference Property Vault AutoObjectReference Property MDHPushMarker AutoActor Property PlayerRef AutoActor Property Intruder AutoEvent OnTriggerEnter(ObjectReference akActionRef)If akActionRef == PlayerRef  Vault.Disable()   Utility.Wait(0.1)  Vault.Reset()  ;alternatively I could delete current vault? (Property problems) Then placeatme a new vault   Utility.Wait(0.1)  Vault.Enable()   Debug.Notification("Player in trigger zone")endifIf akActionRef != PlayerRef   ; akActionRef = Intruder  ;MDHPushMarker.PushActorAway(Intruder, 10.0)   ;Intruder.MoveTo(MDHPushMarker)  Debug.Notification(akActionRef + " in trigger zone")endifEndEvent

Resetting the Vault (DweRepository01) doesn't close it, when it gets re-enabled it simply plays the opening animation again.

The disturbing behaviour I mentioned above can be seen in http://i101.photobucket.com/albums/m57/will_cuthill/ScreenShot840.png. It's printing akActionRef as [WIDeadBodyCleanupScript ??? WTF. From this line of code:
Debug.Notification(akActionRef + " in trigger zone")

The script used to read like this:
Spoiler

Scriptname MDHVaultKeepOutScript01 extends ObjectReference{Trigger plane in doorway. Pushes actors away. Resets vault}ObjectReference Property Vault AutoObjectReference Property MDHPushMarker AutoActor Property PlayerRef AutoActor Property Intruder AutoEvent OnTriggerEnter(ObjectReference akActionRef)If akActionRef == PlayerRef  Vault.Disable()   Utility.Wait(0.1)  Vault.Reset()  ;alternatively I could delete current vault? (Property problems) Then placeatme a new vault   Utility.Wait(0.1)  Vault.Enable()   Debug.Notification("Player in trigger zone")else   ; akActionRef = Intruder  ;MDHPushMarker.PushActorAway(Intruder, 10.0)   ;Intruder.MoveTo(MDHPushMarker)  Debug.Notification(akActionRef + " in trigger zone")endifEndEvent

And at least in that situation it printed this: "None in trigger zone"

Just what on earth is going on here?
User avatar
Robert DeLarosa
 
Posts: 3415
Joined: Tue Sep 04, 2007 3:43 pm

Post » Tue Nov 20, 2012 11:28 am

It does not look like the notification came from your script, as you only have two notifications, and neither of those printed on the screen.
Are you sure your using a clean save game? Anytime there is weird behavior, I suspect this is the culprit.
User avatar
phillip crookes
 
Posts: 3420
Joined: Wed Jun 27, 2007 1:39 pm

Post » Tue Nov 20, 2012 6:40 pm

That was my first thought but it gets printed reliably whenever Lydia (she's the only NPC I've tested with) enters the trigger zone. When I enter the zone "Player in trigger zone" gets printed as expected.

I'm using a save that's 100% clean from my mod but I'll try coc from Main Menu and see if it yields different results.
User avatar
le GraiN
 
Posts: 3436
Joined: Thu Mar 22, 2007 6:48 pm

Post » Tue Nov 20, 2012 2:37 pm

Test:
Main Menu
"coc whiterundragonsreach"
Find nearest guard, open console and click on him
"coc mdhmzandahrkmasterchamber"
I walk to just outside the trigger zone
"moveto player"
I get the guard to walk into the trigger zone
/Test

This now prints "[Actor" as a message. So I'd say there hasn't really been any change.

*EDIT: I altered the script so that the code for the player matched the code for NPC's
Spoiler

If triggerRef == PlayerRef  Vault.Disable()   Utility.Wait(0.1)  Vault.Reset()  ;alternatively I could delete current vault? (Property problems) Then placeatme a new vault   Utility.Wait(0.1)  Vault.Enable()   Debug.Notification(triggerRef + " in trigger zone")

It now prints "[Actor" as a message when I walk through it too. Maybe this isn't where it's going wrong. I still can't get my trigger zone to boot any NPC's when I uncomment that code though.
User avatar
Javaun Thompson
 
Posts: 3397
Joined: Fri Sep 21, 2007 10:28 am

Post » Tue Nov 20, 2012 9:58 am

Try this. Parts of It are taken from the script I pointed you to in your first post for my force field in the Levelers Tower mod.
It should work for pushing intruders away.

Scriptname MDHVaultKeepOutScript01 extends ObjectReference{Trigger plane in doorway. Pushes actors away. Resets vault}ObjectReference Property Vault AutoObjectReference Property MDHPushMarker AutoEvent OnTriggerEnter(ObjectReference akActionRef)If akActionRef == Game.GetPlayer()  Vault.Disable()   Utility.Wait(0.1)  Vault.Reset()  ;alternatively I could delete current vault? (Property problems) Then placeatme a new vault   Utility.Wait(0.1)  Vault.Enable()   Debug.Notification("Player in trigger zone")else  Actor ActorObject = akActionRef as Actor  MDHPushMarker.PushActorAway(ActorObject, 10.0)   ;Intruder.MoveTo(MDHPushMarker)  Debug.Notification(akActionRef + " in trigger zone")endifEndEvent
User avatar
Mario Alcantar
 
Posts: 3416
Joined: Sat Aug 18, 2007 8:26 am

Post » Tue Nov 20, 2012 11:09 am

I'll give that a go. Thanks WillieSea. I wasn't ignoring your advice to go have a look at leveller's tower I just can't download from the nexus at the moment pending my ban appeal (I've been a bad boy).

*EDIT:Everything seems to work perfectly now. I'll post the final script when it's finalised. It will do some cool things.
User avatar
Lauren Denman
 
Posts: 3382
Joined: Fri Jun 16, 2006 10:29 am

Post » Tue Nov 20, 2012 6:36 am

Is there any way to get ActorObject outside of the Event block its defined in? Example:
Spoiler

Event OnActivate(ObjectReference akActionRef)  Actor ActorObject = akActionRef as Actor  ActorObject.SetRestrained()  ;do other stuffEnd EventEvent OnTranslationComplete()	;do other stuff	ActorObject.SetRestrained(false)EndEvent
User avatar
steve brewin
 
Posts: 3411
Joined: Thu Jun 21, 2007 7:17 am

Post » Tue Nov 20, 2012 10:59 am

Don't define the Actor variable in the Event block, that most likely makes it a local variable to that block. Define the Actorvariable outside any Event or Function and then fill it in the Event block.
User avatar
jenny goodwin
 
Posts: 3461
Joined: Wed Sep 13, 2006 4:57 am

Post » Tue Nov 20, 2012 10:34 am

Because your in an ObjectReference script, I needed to convert the ObjectReference akActionRef from being defined as an object reference into an actor reference, so the PushActorAway would work correctly. I simply defined it in that section of code.

Just define the actor variable at the top of your script outside the Event block of code. It can then be used in all events in the script.
User avatar
Jordan Moreno
 
Posts: 3462
Joined: Thu May 10, 2007 4:47 pm

Post » Tue Nov 20, 2012 12:50 pm

Because your in an ObjectReference script, I needed to convert the ObjectReference akActionRef from being defined as an object reference into an actor reference, so the PushActorAway would work correctly. I simply defined it in that section of code.

Just define the actor variable at the top of your script outside the Event block of code. It can then be used in all events in the script.

I feel silly, but to be honest I'm not sure how to do this? I must be missing something obvious.........
User avatar
Timara White
 
Posts: 3464
Joined: Mon Aug 27, 2007 7:39 am

Post » Tue Nov 20, 2012 3:45 pm

Its not too hard.
You create your Actor vairable with all your other variables at the top of the script.
Then you remove the definition to the variable in the code below where you define the variable used by push actor away.

Scriptname MDHVaultKeepOutScript01 extends ObjectReference{Trigger plane in doorway. Pushes actors away. Resets vault}ObjectReference Property Vault AutoObjectReference Property MDHPushMarker AutoActor Property ActorObject  HiddenEvent OnTriggerEnter(ObjectReference akActionRef)If akActionRef == Game.GetPlayer()  Vault.Disable()   Utility.Wait(0.1)  Vault.Reset()  ;alternatively I could delete current vault? (Property problems) Then placeatme a new vault   Utility.Wait(0.1)  Vault.Enable()   Debug.Notification("Player in trigger zone")else  ActorObject = akActionRef as Actor  MDHPushMarker.PushActorAway(ActorObject, 10.0)   ;Intruder.MoveTo(MDHPushMarker)  Debug.Notification(akActionRef + " in trigger zone")endifEndEvent
User avatar
x_JeNnY_x
 
Posts: 3493
Joined: Wed Jul 05, 2006 3:52 pm


Return to V - Skyrim