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

Solved I can heal when i got 0 hp, how to fix?

penna123

New Member
Joined
Sep 27, 2008
Messages
33
Reaction score
0
When ppl die they should die immediately but on my ot they can heal them self on 0 hp if they time it correct..

please help, how do i fix it?
 
its like 0.5 sec delay or something its rly easy

- - - Updated - - -

just spam ur heal key.. and if u get like one hitted you will be able to heal yourself cuz of this bug..
 
Check creaturescripts probbly some bad script there

yeah its true, check in creaturescripts onPrepareDeath scripts probably there is something wrong or there is many checks before the death.

try to test it without any onDeath or onPrepareDeath scripts and tell us the result.
 
The only script i got onPrepareDeath is this one:

function onPrepareDeath(cid, corpse)
if isPlayer(cid) then
if (getPlayerLevel(cid) < 40 and getPlayerSkullType(cid) ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)
else
doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 100)
doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 100)
end
end
return true
end

i will try without it and see if it works

- - - Updated - - -

yeap i took the script away and it was fixed is there something i can do to fix that script to make it work like it should?
 
Yes, instead of return true, return false. Then default actions will occur after the script has done triggering.

LUA scripts are running before default tibia actions.
The return statement pretty much sends a signal to the server engine (is this process of events done?), when you return true, you say yes and thus stops default tibia action.
(which is the part where the player is actually dying).

Return false, and your saying "keep processing default actions", and player will die (because thats the default action).

For instance with talkactions, if you have created a talkaction !test, and you return true, it will only run the script when you say !test.

However, if you return false, then the character will run the script + default tibia action (which is to say !test in chat channels etc).
 
Last edited:
If i put "return false" then the char will die BUT he will not disappear, he will stand there with 0 hp, no hp bar just chilling.. and you can take pots on ur char but u wont get any hp so ur dead but u will not get disconnected and u will not disappear
 
Weird. :&

Do you even need a return statement here?

Try this:
Lua:
function onPrepareDeath(cid, corpse)
	if isPlayer(cid) then
		if getPlayerLevel(cid) < 40 and getPlayerSkullType(cid) ~= nil then
			doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
			doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)
		else
			doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 100)
			doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 100)
		end
	end
end

Also, do you have any other console errors related to creaturescripts?
 
i dont get any errors on my console.. but i will try to take it away and see what happens.. as soon as it will be break on champion league! :p

- - - Updated - - -

it did not work.. same thing happend.. you die but you wont get dc, so your still online but with 0 hp and you cant heal up
 
Last edited:
check this
Lua:
function onPrepareDeath(cid, corpse)
		if(not isPlayer(cid)) then return true end
		if getPlayerLevel(cid) < 40 and getPlayerSkullType(cid) ~= nil then
			doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
			doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)
		else
			doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 100)
			doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 100)
	end
return true
end

- - - Updated - - -

Updated...
 
Last edited:
i died like i should but i did lose my items.. with other words it did not work either :(

- - - Updated - - -

i used ur script before u updated it.. i tried the one after ur update, it workt perfectly!! thank you and everyone who tried to help!!!!!!

- - - Updated - - -

oh.. sorry.. it did not work if you are over lvl 40...

- - - Updated - - -

ok i found one way to make it work thanks to everyone who helped!!

Lua:
function onPrepareDeath(cid, corpse)
        if(not isPlayer(cid)) then return true end
        if getPlayerLevel(cid) < 40 and getPlayerSkullType(cid) ~= nil then
            doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
            doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)
        else
            doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 100)
            doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 100)
    end
return true
end
 
Last edited:
Back
Top