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

Soul system

Syryniss

Member
Joined
Feb 13, 2014
Messages
206
Reaction score
20
Hi. I'm looking for script that will cause player to lose 1 soul point every interval. And interval is based on how much soul he has. For example, when player has 0-20 soul he loses 1 every 5 seconds and when he have 80-100 soul, he loses 1 every second.
 
Could you give me a link? I found this, but it's for TFS 1.0 and it's spell. I'm looking for creaturescript, to take soul from players without any spell.
 
Ok, If i got you right. You want a soul script that removes 1 soul each 1 second? Youll need a globalevent for that. Here, ill write out one fast for you.
Code:
function onThink(cid, interval)
if getPlayerVocation(cid) == Vocation_ID
doPlayerAddSoul(cid, -1)
end
return true
end
If you want it to be for everyone just remove the
Code:
getPlayerVocation(cid) == Vocation_ID
and replace it with
Code:
isPlayer(cid)

@EDIT
@Syryniss

This one bases on your request
Code:
function onThink(cid, interval)
if getPlayerSoul(cid) >= 21 then
doPlayerAddSoul(cid, -1) 
elseif getPlayerSoul(cid) <= 20 then
doPlayerAddSoul(cid, -5)
end
return true
end
@Syryniss
 
Thanks for your time. I changed it a bit, becasue it wasn't working at all.
Code:
function onThink(interval, lastExecution, thinkInterval)
local players = {}
for _, i in pairs(getPlayersOnline()) do
    table.insert(players, i)
end
---------------------------

for k, v in pairs(players) do
    if getPlayerSoul(v) >= 0 and getPlayerSoul(v) <= 20 then
        doPlayerAddSoul(v, -1) 
    elseif getPlayerSoul(v) > 20 and getPlayerSoul(v) <= 40 then
        doPlayerAddSoul(v, -2)
    elseif getPlayerSoul(v) > 40 and getPlayerSoul(v) <= 60 then
        doPlayerAddSoul(v, -3)
    elseif getPlayerSoul(v) > 60 and getPlayerSoul(v) <= 80 then
        doPlayerAddSoul(v, -4)
    elseif getPlayerSoul(v) > 80 then
        doPlayerAddSoul(v, -5)
    end
end
return true
end

It's ok, probably enough for me, but I wonder if instead of increasing soul that is removed, we could decrease the interval. For example when player has 1 or more soul points, he loses 1 every 2 seconds and when he has 50 or more he loses 1 every 1 second, so 2 times faster.
 
You could make the script end at a certain number and add another globalevent for it and lower the exhaust

Btw, i tested mine on 0.3.7 and it worked fine for me
 
Okey, thanks for all. Could you tell me one more thing, is it worth to do this 4 more globalevents for that change? I mean, is 5 globalevents gonna stress the server far more that only 1, or it would be nearly impossible to notice?
 
It wont stress the server at all if you got a good hosting comp. When it comes down to it all its your CPU that matters, good cpu = doesnt matter how many globalevents you use.
 
Back
Top