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

TFS 0.X [Creaturescripts] Player don't actually die in the area.

juansanchez

Intermediate OT User
Joined
Apr 2, 2015
Messages
217
Reaction score
130
Hi guys, i'm having a problem with a script i'm using.
Lua:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    local from, to =  {x = 1051, y = 592, z = 7},{x = 1056, y = 596, z = 7}
    local pos = {x = 543, y = 525, z = 7}
        if isPlayer(cid) and isInRange(getCreaturePosition(cid), from, to) then
            doTeleportThing(cid, pos)
            doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
            doRemoveConditions(cid, false)
        return false
        end
    return true
end

So you guys understand:

I have an area where i usually spawn monsters for players to kill, like, a lot of monsters. And i didn't want the players to actually die when they die there.
I don't want to use the PVP tool in Rme because then players can kill each other, making it not fun for the low level players.
The script i posted up here partially works. For an unown reason, when the player die, sometimes he doens't die and is teleported to the Local Pos. And sometimes the players dies for real. No errors in console no nothing, and i can't figure out why.
I tought it was maybe because they are dying too fast or something, but it's not that.
Anyone can help me out?

I'm using TFS 0.3.7
 
my guess is isInRange isnt work as it should, try to print it to see if it returns true or false when it fails/success, probably is something about position, maybe it isnt including the borders or something like that, also i would change the order of the things to addhealth > remove debuffs > teleport.
you could try to compare positions by hand to check if something is happening, you could also add stackpos to the coordinates to see if something changes.
 
my guess is isInRange isnt work as it should, try to print it to see if it returns true or false when it fails/success, probably is something about position, maybe it isnt including the borders or something like that, also i would change the order of the things to addhealth > remove debuffs > teleport.
you could try to compare positions by hand to check if something is happening, you could also add stackpos to the coordinates to see if something changes.

So from what i tested, apparently changing the lines you said fixed it.
I killed the player multiple times and it worked ok. I'm going to test it a bit more, but maybe that was it.
Thanks
 
Back
Top