Thanks so much for this. It is definitely a start, however I tried both versions with no success. Putting print statements in before each return shows that the script is firing, but nothing is being blocked. Would it be simpler if i used an action id on all bps or something?
PS: What does -11 mean at the end?
If the script is executed until these two
return false
the object should not move.
I tried it on my test server and it works perfectly.
In case neither return works, make sure you have the onMoveItem event enabled in the
events.xml
file.
If it still doesn't work... then I'd be hard pressed to think that you're actually using official TFS 1.4.2, I don't recall this event not working on that release version.
the number that is sent as an argument in the registry, is the order of execution of the script, the default script is executed at index 0, so -11 being less than 0, this script will be executed first before the script
EC
=
data/scripts/eventcallbacks/player/default_onMoveItem.lua
It doesn't matter much in this specific case, but it's good that you ask, because this is how I explain it to you right now.
If this script were executed at an index greater than
0
, then
EC
would be executed first, before the script I posted.
The small advantage of running first is that we avoid all the unnecessary checking of the default script.
If you wonder in which case the order of execution is more relevant, the answer is:
in experience/skill gain or experience/skill loss events and possibly in an onDamage event if you're in OTBR