• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Canary Creature Event onDeath, how does it work?

Carrot

New Member
Joined
May 9, 2009
Messages
2
Reaction score
0
Hi, I'm working on a small quest script that resets variables when everyone in the quest room has died.

I'm storing the players in a table, so I wanted a way to check if the players are still alive by calling a function when a player dies

I've tried registering a new OnDeath event in the script


LUA:
local creatureEvent = CreatureEvent("DungeonPlayerDeath")

function creatureEvent.onDeath(creature)
  print("player died")
end

creatureEvent:register()

But it doesnt seem to be called when a player dies? Is there a tried and true method to do this? I've been looking for documentation but its not very clear
 
Hi.
You need to get all the players in the quest and register this event on them.
They auto de-register on death so only need to do player:registerEvent("DungeonPlayerDeath") and it should be ok (? i think)
 
Got it! Thats what I was missing! Thank you so much! I'll post the full script once its done

Edit: I was used to the method of registering events in xml so i was confused
 
Back
Top