The event responsible for such mechanics is the:
data/creaturescripts/creaturescripts.xml
XML:
<event type="death" name="DropLoot" script="droploot.lua" />
Inside the
droploot.lua
file you can add some storage verification to cancel this behavior
per example:
Lua:
if player:getStorageValue(10000) ~= -1 then
return true
end
data/creaturescripts/scripts/droploot.lua
View attachment 63556
Now we can give the player the storage and he will already be protected from falling objects
Lua:
player:setStorageValue(10000, 1)
If we want the storage to be restored, we just add that to the code
Lua:
player:setStorageValue(10000, -1)
View attachment 63557
There are other ways to do it, but here I showed you this