Hello,
This script is configured that, if player has this special storage which he can get from a npc or a item, then when he dies then he get revived, but depends which time you configured it. Pretty simple and neat script.
Also i would love tips about what i can add and need help with change outfit to dead corpse and maybe add countdown. Idk but still version 1 xD
Tested on 0.3.6
First go to creaturescripts/creaturescripts.xml and add this line below:
Now go to creaturescripts/scripts/login.lua and paste this line below:
Now goto creaturescripts/scripts and create new lua and name it "revive" and paste the code below:
Enjoy! Im open for suggestions and help me bit, so ill learn !
Thanks!
The scripts works dont worry!
This script is configured that, if player has this special storage which he can get from a npc or a item, then when he dies then he get revived, but depends which time you configured it. Pretty simple and neat script.
Also i would love tips about what i can add and need help with change outfit to dead corpse and maybe add countdown. Idk but still version 1 xD
Tested on 0.3.6
First go to creaturescripts/creaturescripts.xml and add this line below:
Code:
<event type="PrepareDeath" name="Revive" event="script" value="revive.lua"/>
Now go to creaturescripts/scripts/login.lua and paste this line below:
Code:
registerCreatureEvent(cid, "Revive")
Now goto creaturescripts/scripts and create new lua and name it "revive" and paste the code below:
Lua:
local Cyko = {
storage = 9999, --Use empty storage
outfit = {lookType = 0}, --still working on the to turn into dead body
time = 5, --How long will it take until he revives from the death
text = "You will be revived in 5 seconds" --The text which appear when his dead
}
function onPrepareDeath(cid, deathList)
function revive(cid)
if isPlayer(cid) then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, Cyko.storage, 1)
return true
end
end
function revivetext(cid)
if isPlayer(cid) then
doPlayerSendTextMessage(cid,21, Cyko.text)
addEvent(revive, cyko.time*1000, cid)
return true
end
end
if isPlayer(cid) and getPlayerStorageValue(cid, Cyko.storage) == 1 then
if getCreatureHealth(cid) <= 0 then
addEvent(revivetext, 1*1, cid)
doCreatureSetNoMove(cid, true)
doCreatureChangeOutfit(cid, Cyko.outfit)
doAddCondition(cid, CONDITION_INFIGHT)
return false
end
return true
end
end
Enjoy! Im open for suggestions and help me bit, so ill learn !
Thanks!
The scripts works dont worry!