PDA

View Full Version : Enter/leave scripting zone events break when stated object changes inside the zone



chizdippler
05-29-2017, 07:21 PM
The onObjectEnterScriptingZone and onObjectLeaveScriptingZone events break (don't fire at all) if the object inside the scripting zone is a stated object and the state is changed while inside the zone.

The current chain of events is this:

Stated object is outside scripting zone
Object enters scripting zone -> "enter" event fires
Object's state is changed inside scripting zone -> "enter" event fires (because object was technically respawned)
Object exits scripting zone -> no "exit" event fires
Object enters scripting zone again -> no "enter" event fires


Some extra info:

Returning the object to the state it was in when it first entered the scripting zone does not fix this
Changing the object's state inside the scripting zone always causes the "enter" event to fire
Changing the object's state outside the scripting zone seems to reset the problem


This needs a fix immediately.

MrStump
05-29-2017, 07:50 PM
Worth a mention that they also break when you load a table fresh and an object is already inside the zone.

It does NOT occur if you load the table, put an object into a zone, save it and load. You have to come in from the main menu then load for the bug to present, then the api triggers will ignore whatever object/s were in a zone at the start.

Lucky seven
05-29-2017, 09:15 PM
Thread moved to Scripting Bug Reports

chizdippler
05-30-2017, 07:41 AM
I have now realized that this is the same problem as in this thread (http://www.berserk-games.com/forums/showthread.php?3547-onObjectEnterScriptingZone-never-gets-called), though it's still worth mentioning the problem affects stated objects in particular.

The ultimate problem seems to be that anything originating inside a scripting zone will not trigger the enter and exit events. This is why, after the object's state is changed inside the zone, the events don't fire.

Mark
05-30-2017, 03:40 PM
Ideally it should fire after the onLoad() function fires, then the object is guaranteed to have loaded.

Huffel
05-31-2017, 12:46 PM
I posted an example for it in this thread:
http://www.berserk-games.com/forums/showthread.php?2503-Spawning-a-custom-object-inside-scripting-zone-breaks-onObjectEnter-Leave-events

It would be nice if this could finally get fixed. You can work around this bug when you spawn objects from script but it also occurs when objects are dropped / taken from a bag in a scripting zone or when the rewind button is pressed.