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

Add max hp and cap

kosmik1

New Member
Joined
Jun 7, 2010
Messages
29
Reaction score
2
How to make floor which add x max hp/mana for player and flow which add x max cap on step in
 
Code:
setCreatureMaxHealth(cid, health)
setCreatureMaxMana(cid, mana)
doPlayerSetMaxCapacity(cid, cap)

Just add that to a StepIn script and ofc change cap, health and mana to the values.
 
Is it possible to do it like this?
setCreatureMaxHealth(cid, +50)

or does it need to be the full health (meaning have to check the vocation and the lvl and then calculate and add the extra)?
 
Code:
getCreatureMaxHealth(cid)
Although function setCreatureMaxHealth doesn't exist in TFS 0.2.7, this function is from TFS 0.3/0.4.
 
Great this work:
setCreatureMaxHealth(cid,getCreatureMaxHealth(cid)+health)
but this nope:
doPlayerSetMaxCapacity(cid,getPlayerMaxCap(cid)+cap)
getPlayerMaxCap< i dont know how to check max capacity
getPlayerFreeCap< its work but check only free capacity
 
You can calculate it using
Code:
getVocationInfo(id).capacity
Multiple it with the players level, remove start levels and add startcap in the calculation.
 
doPlayerGetMaxCapacity < didnt work


You can calculate it using
Code:
getVocationInfo(id).capacity
Multiple it with the players level, remove start levels and add startcap in the calculation.

Ye but if he stand 2x time or more he get only for 1x time
 
Add to data/lib/050-function.lua
Code:
function getPlayerMaxCapacity(cid)
     local info = db.getResult("SELECT `cap` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
     if info:getID() ~= -1 then
         local cap = info:getDataInt("cap")
         info:free()
         return cap
     end
     return false
end
 
Add to data/lib/050-function.lua
Code:
function getPlayerMaxCapacity(cid)
     local info = db.getResult("SELECT `cap` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
     if info:getID() ~= -1 then
         local cap = info:getDataInt("cap")
         info:free()
         return cap
     end
     return false
end
problem is if the player advanced a few times while not getting saved, then it wont give the actual cap as it was not updated :p

this is by far best done in sources, you could also do it in lua and calculate it, however I recommend first.
 
Back
Top