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

Lua Healing Others

Extort

New Member
Joined
Apr 14, 2011
Messages
31
Reaction score
0
I have a simple question about doCreatureAddHealth(cid, health)
Is there a way to set it up so when i attack anything it heals the thing i attack? If so can someone give me an example or something? Any help would be great.
I am using TFS 0.3.6pl1
 
Lua:
damage = 100 -- how much damage shall target loose?
target = getCreatureTarget(cid)
if getCreatureHealth(target) >= damage then
	doCreatureAddHealth(target, -damage)
else
	doCreatureAddHealth(target, -getCreatureHealth(target))
end
 
Thank you, but if i am not mistaken wont this heal the attacker not the person being attacked? But with this, i can probably make what i need. I thank you :D
 
it was a weapon script i wanted, but i think i have it figured out. I just changed his script and made it the way i wanted it. Thank you anyways.
 
To make it heal the target its attacking just do it like this:
Lua:
heal = 100 -- how much do you want to heal?
target = getCreatureTarget(cid)
mathlol = getCreatureMaxHealth(target) - getCreatureHealth(target)
if mathlol >= heal then
	doCreatureAddHealth(target, heal)
else
	doCreatureAddHealth(target, mathlol)
end
:p

(weaponscript).
 
Last edited:
Yeah Znote that is almost the same as what i have :) i just took the first script and changed it a bit. I just didn't know how to get the target, don't know what i didn't think about it i guess.
 
Back
Top