IttaBaby wrote: ↑Sun May 29, 2022 7:32 am
So is there a simpler way to make it only happen during an enemy kill and not every time anything despawns for any reason including every coin collected and every time a projectile goes of screen?
Yes! You can call the freeze.set() function whenever you need to. You don't have to use the condition-less onPostNPCHarm-example from the file. For enemy kills, make sure to use the parameters for onPostNPCKill and filter out harmType 9 (despawn) with an if statement. You can also filter for IDs with the killedNPC paramter:
https://docs.codehaus.moe/#/reference/lunalua-events
example: this one only freezes when an npc was killed with a JUMP
function onPostNPCKill(killedNPC, killReason)
if killReason == HARM_TYPE_JUMP then
freeze.set(10)
end
end