• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Actions item gives health.

Midxas

New Member
Joined
Apr 21, 2014
Messages
43
Reaction score
0
Hello Im looking for a script which gives you health every time when you click on it. It gives you hp just like uh rune but without exhausted. And it never ending. If somone have script simmilar for this please post!
 
Just fill in the variables health and text.

TFS 1.0
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local p = Player(cid)
    p:addHealth(health)
    p:say(text, TALKTYPE_MONSTER_SAY)
return true
end

0.3.6, 0.4, 0.2 etc
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    doPlayerAddHealth(cid, health)
    doPlayerSay(text, TALKTYPE_MONSTER_SAY)
return true
end
 

I add this script but i don't know how to make item useable :D When im trying to use this item it write : You cannot use this object. I tried to change type in items to runes etc but it doesn't work;/ Anyone?

@Edit: Im working on tfs 0.4

@Edit2: Now it can be useable but something is wrong in code.

bhh.png


I will explain you what im doing. So at items xml i add
Code:
<item id="2353" article="a" name="burning heart">
<attribute key="description" value="Burning heart always save your live!" />
<attribute key="weight" value="200" />

</item>

than in actions
Code:
    <action itemid="2353" event="script" value="burningheart.lua"/>

and in burningheart your code.. So the code is wrong or im doing something bad?

@Edit3: It works. I edit doaddCreature not a player :D But now anyone know how to modife it to add hp depense on lvl?

I tried this but doesnt work ;/

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not isPlayer(cid) then
return true
end

local x = config[getMaxHealth(cid)]
if isPlayer(itemEx.uid) then
doCreatureAddHealth(itemEx.uid, math.floor(math.random(x.hp[1], x.hp[2]) / (cid == itemEx.uid and 1 or 2)))
doSendMagicEffect(getThingPos(itemEx.uid), 12)
return true
end


 
Last edited:
Back
Top