• 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!

onDeath event

Exemple rat.xml
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Rat" nameDescription="a rat" race="blood" experience="5" speed="134" manacost="200" script="rat.lua">
<health now="20" max="20"/>
<look type="21" head="0" body="0" legs="0" feet="0" corpse="2813"/>
<targetchange interval="2000" chance="0"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="1"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag runonhealth="5"/>
</flags>
<attacks>
<attack name="melee" interval="2000" skill="15" attack="7"/>
</attacks>
<defenses armor="1" defense="3"/>
<immunities>
<immunity physical="0"/>
<immunity energy="0"/>
<immunity fire="0"/>
<immunity poison="0"/>
<immunity lifedrain="0"/>
<immunity paralyze="0"/>
<immunity outfit="0"/>
<immunity drunk="0"/>
<immunity invisible="0"/>
</immunities>
<loot capacity="100">
<item id="2696" countmax="1" chance="40000"/>
<item id="2148" countmax="4" chance="70000"/>
<item id="3976" countmax="3" chance="50000"/>
</loot>
</monster>





and rat.lua:

function onLogin(cid)
registerCreatureEvent(cid, "onDie")
return TRUE
end
 
Huge thanks! Didn't test, but i trust you.
Well...
I got another question: Is there easier way to make a global function which would every monster use?
 
i dont beleive that onlogin for monsters is supported.. it may be.. maybe im stupid
 
Fix on code:
registerCreatureEvent(cid, "onDie")
function onLogin(cid)
registerCreatureEvent(cid, "onDie")
return TRUE
end
 
Theoretically, all the monsters you can add:
PHP:
<script> 
	<event name="DeathTrainer"/> 
</script>
A script may be what you want...
 
Back
Top