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

If player dead teleport him to temple

pele112

Member
Joined
Aug 9, 2007
Messages
571
Reaction score
8
Location
Wodzisław Śląski
Hello!
I have problem with this script. Player death but don't teleport to temple.

Code:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if type == 1 and getCreatureHealth(cid) <= value
        and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
        return false
    end
	return true
end


Someone can help me ? ;pp
 
Code:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
[COLOR="#FF0000"]	if type == 1 and getCreatureHealth(cid) <= value
        and isPlayer(cid) then[/COLOR]
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
[COLOR="#FF0000"]        return false
    end
	return true
end[/COLOR]

Someone can help me ? ;pp


I've highlighted in red the problems with your script
 
MMM, try this

Lua:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if type == 1 and getCreatureHealth(cid) <= value and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
        return false
    end
	return true
end
Or

Lua:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if type == 1 and getCreatureHealth(cid) <= value and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
    end
	return true
end
 
MMM, try this

Lua:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if type == 1 and getCreatureHealth(cid) <= value and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
        return false
    end
	return true
end
Or

Lua:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if type == 1 and getCreatureHealth(cid) <= value and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
    end
	return true
end

doesn't work :/
 
MMM, try this

Lua:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if type == 1 and getCreatureHealth(cid) <= value and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
        return false
    end
	return true
end
Or

Lua:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if type == 1 and getCreatureHealth(cid) <= value and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
    end
	return true
end

what is 'type' referring to, also where is 'value' defined?
 
type & value are params of onStatsChange not onPrepareDeath :eek:

no frag is normal when death is prevented, for health fix try:
Code:
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
 
Last edited:
MMMM, thanxz @Cykotitan

check it

Lua:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if getCreatureHealth(cid) <= 0 and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
        return false
    end
	return true
end
 
MMMM, thanxz @Cykotitan

check it

Lua:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if getCreatureHealth(cid) <= 0 and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
        return false
    end
	return true
end

Still teleport to temple at 0hp

#edit:

Cykotitan it's WORK ;P
But how to make that player get frag ? ;p
 
Last edited:
Because onPrepareDeath is bugged and you can't heal the player because it's preventing death, which leads to an infinite loop. You need to use onStatsChange
 
MMM, according @Cykotitan try.

Lua:
local temple_pos ={x = 2828, y = 2663, z = 7}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if getCreatureHealth(cid) <= 0 and isPlayer(cid) then
        doTeleportThing(cid, temple_pos, true)
              doRemoveCondition(cid, CONDITION_INFIGHT)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
        return false
    end
	return true
end
 
since you're preventing the death, the only way would be to manually execute all the frag related code (basically translate c++ to lua)?:p
 
What are these params anyways?
Code:
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)

doCreatureAddHealth(uid, health[, hitEffect[, hitColor[, force]]])
According to the sources, force is used to add HP even if the creature has 0HP (or less)
 
What are these params anyways?
Code:
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
they're dummy params, 65535 (0xFFFF) for MAGIC_EFFECT_UNKNOWN and 256 (0x100) for TEXTCOLOR_UNKNOWN
Ohh :/ I need it for war serwer :D
Maybe better will if player dead teleport him to temple add in sources?
maybe, but if it's a war server (if you know what i mean) do you really need unjustified frags and such?

back in the days, people used to do it via soul points (limited to 255) or storage
 
they're dummy params, 65535 (0xFFFF) for MAGIC_EFFECT_UNKNOWN and 256 (0x100) for TEXTCOLOR_UNKNOWN

maybe, but if it's a war server (if you know what i mean) do you really need unjustified frags and such?

back in the days, people used to do it via soul points (limited to 255) or storage

Maybe no but i must have corpus in ground :D
Hmm maybe you can help me "if I have in database character save=0 and player dead lost only 1 level?" ;p
 
Back
Top