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

Can I perform arithmetic in doTargetCombatHealth?

Michael Orsino

Premium User
Staff member
Premium User
Support Team
Joined
Nov 15, 2007
Messages
864
Solutions
10
Reaction score
452
Location
Western Australia
Can I perform arithmetic in doTargetCombatHealth?
E.G.

local damage = (getCreatureMaxHealth(cid) * 0.1)
doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -" .. damage .. ", -" .. damage .. ", CONST_ME_NONE)

The above does not work, is there anything that will?
 
wow, how stupid of me. Hah.
On a related note, my script seems to execute the damage multiple times causing higher than desired damage, any idea why?

Code:
function onCombat(cid, target)
local damage = ((getCreatureMaxHealth(target)) / 100) + 100
local damagehigh = damage + 50
if getCreatureSkullType(target) == SKULL_NONE or isPlayerPzLocked(target) == false then
if isPlayer(target) and getPlayerLevel(target) / getPlayerLevel(cid) < 0.5 then
doTargetCombatHealth(cid, COMBAT_PHYSICALDAMAGE, -damage, -damagehigh, CONST_ME_NONE)
end
end
return true
end
 
Hmm, im not sure that I entirely understand why that means that my script would deal the damage out multiple times when ran.
E.G.
02:57 You deal 33 damage to Noobone.
02:57 You lose 36 hitpoints.
02:57 You lose 36 hitpoints. <-- the script hits me 3 times for every attack I make
02:57 You lose 36 hitpoints.
02:57 You deal 19 damage to Noobone.
02:57 You lose 36 hitpoints.
02:57 You lose 36 hitpoints.
02:57 You lose 36 hitpoints.
02:57 You deal 34 damage to Noobone.
 
Back
Top