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

CreatureEvent Prevention death

Status
Not open for further replies.

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
This is not the first script type but is even more useful. This script checks a storage if it is greater than one when a player dies the storage goes to oo -1 total amount (if 5 goes to 4 ...) and the player does not lose anything when you die (exessão of red skull).:thumbup:


Well go and creaturescripts.xml adcione this tag:
Code:
<event type="death" name="nodyed" script="nodyed.lua"/>

Now go to the scripts folder and create a script called nodyed.lua and in the same place so:
Code:
local storageid = 4550
----
function onDeath(cid, corpse, lastHitKiller)
         local pos = getCreaturePosition(cid)
         if getPlayerStorageValue(cid, storageid) == -1 then
           setPlayerStorageValue(cid, storageid, 0)
         end
         if getPlayerStorageValue(cid, storageid) > 0 then
            setPlayerStorageValue(cid, storageid, getPlayerStorageValue(cid, storageid)-1)
            pos.stackpos = 255
            local corpos = {3065,3058}
            doPlayerPopupFYI(cid,"You died and was a protected!")
            doCreateItem(2016,2,pos)
            local ae = doCreateItem(corpos[getPlayerSex(cid)+1], 1,pos)
            doSetItemSpecialDescription(ae,"You recognize ".. getCreatureName(cid)..". He was killed by something!")
            doTeleportThing(cid,getTownTemplePosition(getPlaye  rTown(cid)))
            doCreatureAddHealth(cid,9000000)
            doSendMagicEffect(getCreaturePosition(cid),65)
            doSendMagicEffect(pos,65)
            doRemoveCreature(cid)
            doRemoveItem(corpse.uid,1)
            return FALSE
         end
         return TRUE
end



After this go to login.lua utimo and before the end and before the return TRUE adcione this:

Code:
registerCreatureEvent(cid, "nodyed")

ready, now you can make any script that adcione storage values, you can take advantage of your system's quest server, change the StorageID to 6500, and create a quest that gives a demoniac escesse (id 6500) when the player will automatically open that he bau will be protecting them from death not lost loot or exp or skills.

Repp ++
 
Your better off using your original language, because honestly no one can understand you.
 
Use onPrepareDeath insteand of onDeath.
Also header:
Code:
(cid, corpse, lastHitKiller)
is outdated.

Use
Code:
(cid, deathList)
 
This script was ripped from otnet
i am the real author and this copy ots not authorized!
 
Status
Not open for further replies.
Back
Top