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

[Lua] when monster with name xxx "kills" player then player tp to pos and not get killed

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Solutions
6
Reaction score
29
Hi there
i tried to write some simple script for test and it's not working XD
Lua:
local pos = {x=192,y=541,z=7}

function onPrepareDeath(cid, deathList)


        if (getCreatureName(deathList[1]) == "xxx") then
      
        doTeleportThing(cid, pos)      
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have been absorbed by "..getCreatureName(deathList[1])..". Now you must escape from him!")
       doCreatureAddHealth(cid,5000)
        return false
        end
end
someone could help me with that?
tfs 0.4
 
Last edited:
cid is who dying ;p deathlist is who killed that dying creature i have edited this script so many times to make it work and it was "working" only teleporting to certain pos but it haven't gave any hp so i can't move or say any word/spell... idk maybe this function is bugged or smth
 
Have you registered that script in some creaturescript.xml (or smth like this, Im not sure if its not event feature or even smth else)

You can set simple print at the start of the func to check if it even execute after player death.
 
@pasiak12 i said that it was working but it wont give hp and my char was teleported to pos and he was staying right there without healthbar and not dying :p
 
Cast creature name to lower and also use lower case in “xxx”.
getCreatureName(deathList[1]):lower()

Try this function:
doTargetCombatHealth(cid, target, type, min, max, effect)
 
ok i have changed approach to this problem script now is looking like this and it's working thanks guys :D
Lua:
local pos = {x=192,y=541,z=7}

function onStatsChange(cid, attacker, type, combat, value)


        if (getCreatureName(attacker) == "xxx" and value >= getCreatureHealth(cid)) then
                doTeleportThing(cid, pos)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You have been absorbed by "..getCreatureName(attacker)..". Now you must escape from him!")
                doCreatureAddHealth(cid,5000)
        return false
        end
   
        return true
end
 
Back
Top