on_damage only triggering once
complete
WolfGang Senizen
On damage event is only triggering once for a script and needs the script to be reset to work again
This happens in both
SLua
and LSL: Luau
This does not happen in
LSL
If you setup a
once
registered event handler on each click, those will report correctly but only if you dont have an existing on
registered handlerReproduction
- Be in a sim with allow damage adjustmentset to true - and in a parcel with damage enabled
- Create a prim
- Take a copy
- Add the copy to the prim's inventory (leave it's name as Object)
- add this script to the prim
LLEvents:on("touch_start", function(detected)
ll.OwnerSay(`{#LLEvents:listeners("on_damage")}`)
ll.RezObjectWithParams(
"Object",
{
REZ_FLAGS, bit32.bor(REZ_FLAG_TEMP,REZ_FLAG_PHYSICAL,REZ_FLAG_DIE_ON_COLLIDE,REZ_FLAG_DIE_ON_NOENTRY),
REZ_POS, vector(0,0,2), true, true,
REZ_DAMAGE, 10,
REZ_DAMAGE_TYPE, DAMAGE_TYPE_BLUDGEONING,
}
)
end)
LLEvents:on("on_damage",function()
ll.OwnerSay(`on damage`)
end)
- Click the prim, outputs
1
on damage
- Click the prim, outputs
1
Note that every hit after the first prints no
on damage
textThis also happens in
LSL: Luau
LSL Script
default {
touch_start(integer count) {
llRezObjectWithParams(
"Object",
[
REZ_FLAGS, REZ_FLAG_TEMP|REZ_FLAG_PHYSICAL|REZ_FLAG_DIE_ON_COLLIDE|REZ_FLAG_DIE_ON_NOENTRY,
REZ_POS, <0,0,2>, TRUE, TRUE,
REZ_DAMAGE, 10,
REZ_DAMAGE_TYPE, DAMAGE_TYPE_BLUDGEONING
]
);
}
on_damage(integer count) {
llOwnerSay("on damage");
}
}
Saving that back and forth between lsl luau and lsl mono will show the difference
Log In
H
Harold Linden
marked this post as
complete
Should be fixed in the new release... once the region with damage enabled is back!
H
Harold Linden
marked this post as
inĀ progress
H
Harold Linden
Was just a weird issue with the existing event handling code, will be fixed when we roll the latest release. Thanks again!
H
Harold Linden
marked this post as
planned
Thanks for sending this in! The detail that it's the case in LSL-Luau is helpful as well.