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

TP player before dead and give him full health?

Spoking

Oldschool Developer
Joined
Sep 4, 2007
Messages
434
Reaction score
34
Hello OTLand community,

I would like to know how to make this possible. I have made an event where you should survive as long as you can. The monsters 1 hit you. Now they actually kill you if you die, but I want that the players just return to temple without dying when they get killed in this area.

Is this possible?
And how?

Kind regards,
Spoking
 
try that ?
Lua:
local corpse_ids = {
        [0] = 3065, -- female
        [1] = 3058  -- male
}
local teleport = {x=,y=,z=}   --place they will be tped when they die
local arena = {{frompos = {x=968, y=1010, z=7}, topos = {x=983, y=1013, z=7}}}    ---pos of event
function onStatsChange(cid, attacker, type, combat, value)
        if combat == COMBAT_HEALING then
                return true
        end

        if getCreatureHealth(cid) > value then
                return true
        end

        local arenaID = 0
        for i = 1, #arena do
                if isInRange(getCreaturePosition(cid), arena[i].frompos, arena[i].topos) then
                        arenaID = i
                        break
                end
                if i == #arena then
                        return true
                end 
        end
         doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".\n[War-Event kill]") 
        doTeleportThing(cid, teleport, FALSE)
        doSendMagicEffect(getCreaturePosition(cid), 10)
        doRemoveConditions(cid)
        doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
        doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
 return false
end
 
Last edited:
I will test it right now.
Didn't even know such a function did exist.

It is a creature script, right?
If it is, it doesn't work. The player actually died.
 
Last edited:
Code:
  local corpse_ids = {
        [0] = 3065, -- female
        [1] = 3058  -- male
}
local teleport = {x=529,y=534,z=7}   --place they will be tped when they die
local arena = {{frompos = {x=546, y=484, z=7}, topos = {x=563, y=497, z=7}}}    ---pos of event
function onStatsChange(cid, attacker, type, combat, value)
        if combat == COMBAT_HEALING then
                return true
        end

        if getCreatureHealth(cid) > value then
                return true
        end

        local arenaID = 0
        for i = 1, #arena do
                if isInRange(getCreaturePosition(cid), arena[i].frompos, arena[i].topos) then
                        arenaID = i
                        break
                end
                if i == #arena then
                        return true
                end
        end
         doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".\n[War-Event kill]")
        doTeleportThing(cid, teleport, FALSE)
        doSendMagicEffect(getCreaturePosition(cid), 10)
        doRemoveConditions(cid)
        doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
        doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
 return false
end

Code:
	<event type="statschange" name="frogevent" event="script" value="frogevent.lua"/>

Just added to login.lua. Will test it now.

WORKS! Thank you so much.
Rep++!
 
Back
Top