Karain
Jack of all trades
Hello Otlanders, i'd like to make a request if possible, or ask for help if that's easier.
I'd like to have a script that would add a bonus percentage of damage to all of my attacks (by spells or by weapons/melee) if i have a value in my storage.
i tried to use that with creaturescript and onstatschange, but i ran into a ton of problems because it needed to be registered on the creature and not on the player and somewhat caused the script to loop since it attempts to add more damage on itself and trigger the script again which led to overflow of executeCombat.
i'd like to stay as far away from C++ as possible, but i wont mind if that's my last choice.
here is my old attempts, if you can figure out what to do, then please do! it would be very much appreciated
Thank you alot.
I'd like to have a script that would add a bonus percentage of damage to all of my attacks (by spells or by weapons/melee) if i have a value in my storage.
i tried to use that with creaturescript and onstatschange, but i ran into a ton of problems because it needed to be registered on the creature and not on the player and somewhat caused the script to loop since it attempts to add more damage on itself and trigger the script again which led to overflow of executeCombat.
i'd like to stay as far away from C++ as possible, but i wont mind if that's my last choice.
here is my old attempts, if you can figure out what to do, then please do! it would be very much appreciated
Code:
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) then
if type == STATSCHANGE_HEALTHLOSS then
if getPlayerStorageValue(attacker,16000) then
local perc = (((getPlayerStorageValue(attacker,16000) + 1 )/ 100) ) * 5 + 1
local newdamage = value * perc
doTargetCombatHealth(attacker, cid, combat, -newdamage, -newdamage, CONST_ME_DRAWBLOOD) -- this line will trigger onStatsChange which will trigger itself over and over, even with return false but does not do any damage to target at all!
-- another note is if i replaced "attacker" with cid, the script works fine except the new damage value will never be used
-- last note is if i replaced "attacker" with 0, the script works just great as intended, but that will remove all link between the player and the monster (you won't get exp on kills, or skulls on PVP since you are not the actual "attacker")
return false --if this line is removed, the damage will be enabled and will most likely kill everything in 1 hit because it attacks about 30 or more times in an instant till the server stops it and shows a stack overflow error.
end
end
end
return true
end
Thank you alot.