elnelson
Lunaria World Dev
Hello, otlanders. im facing a problem trying a revive system with storages.
The script is suposse to work like this (green txt is achieved one, red is not):
-if "dies"(prepare death) and player have storage 9999 > 1 then
player teleport to a sanctuary.
after teleport, get heal
and after 5 seconds; player teleport back to death pos (i need help getting back)
player set storage 0
end
if player dies with storage 9999 < 1 then
player have 5 seconds to receive help (with special item that adds heal) <-- im working on it
if player wont get help then
player dies (here is the problem. the player wont die, just stay with 0 hp) <-- im getting crazy
end
And this is the script for tfs 0.4
The script is suposse to work like this (green txt is achieved one, red is not):
-if "dies"(prepare death) and player have storage 9999 > 1 then
player teleport to a sanctuary.
after teleport, get heal
and after 5 seconds; player teleport back to death pos (i need help getting back)
player set storage 0
end
if player dies with storage 9999 < 1 then
player have 5 seconds to receive help (with special item that adds heal) <-- im working on it
if player wont get help then
player dies (here is the problem. the player wont die, just stay with 0 hp) <-- im getting crazy
end
And this is the script for tfs 0.4
Lua:
local config = {
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)
if isPlayer(cid) and getPlayerStorageValue(cid, 9999) < 1 then
-- "Create dead body, that can be healed with doCreatureAddHealth(cid, getCreatureMaxHealth(cid))"
addEvent(function()
--doRemoveCreature(cid) <-- this must be replaced for something that make the player dies...
end, 5*1000)
print(0)
end
function revive(cid)
if isPlayer(cid) and getPlayerStorageValue(cid, config.storage) == 1 then
print(1)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, config.storage, 1)
--doTeleportThing(cid, {x = 1073, y = 135, z = 10})
return true
end
end
function revivetext(cid)
print(2)
if isPlayer(cid) and getPlayerStorageValue(cid, config.storage) == 1 then
doPlayerSendTextMessage(cid,21, config.text)
addEvent(revive, config.time*1000, cid)
return true
end
end
if isPlayer(cid) and getPlayerStorageValue(cid, config.storage) == 1 then
print(3)
if getCreatureHealth(cid) <= 0 then
addEvent(revivetext, 1*1000, cid)
doCreatureSetNoMove(cid, true)
setPlayerStorageValue(cid, config.storage, -1)
doCreatureChangeOutfit(cid, config.outfit)
doAddCondition(cid, CONDITION_INFIGHT)
return false
end
return true
end
end