Community Forum

FS13: Removing triggers

Forum Overview >> Farming Simulator 2013

CategoryFarming Simulator 2013
Created29.03.2015 15:17


Bilbo Beutlin (BBeutlin) 29.03.2015 15:17
How can I safely delete a trigger which was created by i3d user attribute "onCreate"?

After all what I've read this method worked fine until a certain patch (1.4 or 2.x).
Though all works in game, now it generates log warnings/errors of sort
- Warning: Deleting object 'xyz' before all triggers are removed
- a bunch of lua call stack errors
if the object/vehicle is deleted on reset or finish.

There should be at least a counterpart to "onCreate", eg. "onDelete" ?
Or _some_ additional lua code kind of "removeTrigger(i3dIndex.triggerId)" ?

Ok, there are examples around how to add/remove triggers, however with hundreds of lines code for each trigger.
Honestly, I don't see the reason adding such overhang of code for triggers when a simple create method exists already and this works also satisfying in game. And if this isn't multiplay friendly, the object is declared as <multiplayer supported="false" />


Emil Drefers (Unknown) 30.03.2015 08:50
Hi,

the fucntion "removeTrigger(objectId)" does exist.

Cheers,
Emil

Bilbo Beutlin (BBeutlin) 30.03.2015 14:35
Yes, I know.
But how do I get the trigger Id of the trigger's i3d index?
I tried already:
trg = Utils.indexToObject(self.rootNode, i3d_Index);
and then in function delete():
removeTrigger(..); where I tried: trg, trg.triggerId
but didn't work, got the log errors mentioned above.

How do I get the triggerId to the corresponding i3d index?

Emil Drefers (Unknown) 31.03.2015 08:29
Hi,

basically your idea seems to be correct.
But maybe you're just using the wrong object as a trigger.

Please check the following script from the official documentation:
http://ls-mods.de/scriptDocumentation.php?lua_file=triggers/TipTrigger

and compare the loaded values/Ids with an actual tipTrigger object in a map.

Cheers,
Emil


Note: Log in to post. Create a new account here.