Guiaki
Member
- Joined
- Jan 3, 2011
- Messages
- 137
- Reaction score
- 8
Hey, is there anyway to make a higher hitting damage with lua?
i have a reset system in my otserv, i wanted that when you reset you attack like +200 hit each attack or something with percent of your health/mana or even percent extra of your actual hitting?
as you can see in vocations.xml there is formula meleeDamage="1.0", is there anyway that i could change this to formula meleeDamage="1.0+reset/100" or something like that? or put in the reset script a code that will set your attack to be higher?
Icy told me i needed to use onStatsChange, but i don't know how to use it, i tought it woud be like this
I wanted that, when a player attack, the damage he will deal will be 20% extra * reset, the formula for this is (reset/5+1), but the thing is, if there is a way to change that to a meeledamage like in the vocation xml would be better, instead of changing every spell.
If someone just could tell me what i needed to do or how to use the onStatsChange, i would be glad
-----------EDIT--------------
For those who want the code its here:
The script was made by DarkHaos, thanks to him
add in creaturescripts.xml
add in login.lua
i have a reset system in my otserv, i wanted that when you reset you attack like +200 hit each attack or something with percent of your health/mana or even percent extra of your actual hitting?
as you can see in vocations.xml there is formula meleeDamage="1.0", is there anyway that i could change this to formula meleeDamage="1.0+reset/100" or something like that? or put in the reset script a code that will set your attack to be higher?
Icy told me i needed to use onStatsChange, but i don't know how to use it, i tought it woud be like this
Code:
onStatsChange(cid, attacker, type, combat, value)
local reset = getReset(cid)
if type == STATSCHANGE_HEALTHLOSS and attacker == cid then
COMBAT_PHYSICALDAMAGE = COMBAT_PHYSICALDAMAGE + COMBAT_PHYSICALDAMAGE*(reset/5+1)
end
end
I wanted that, when a player attack, the damage he will deal will be 20% extra * reset, the formula for this is (reset/5+1), but the thing is, if there is a way to change that to a meeledamage like in the vocation xml would be better, instead of changing every spell.
If someone just could tell me what i needed to do or how to use the onStatsChange, i would be glad
-----------EDIT--------------
For those who want the code its here:
Code:
function onStatsChange(cid, attacker, type, combat, value)
local reset = getReset(cid)
if type == STATSCHANGE_HEALTHLOSS then
if combat == COMBAT_PHYSICALDAMAGE then
if reset > 0 then
local value = (value + value*((reset/5) + 1))
doTargetCombatHealth(attacker, cid, combat, -value, -value, CONST_ME_DRAWBLOOD)
return false
end
end
end
return true
end
The script was made by DarkHaos, thanks to him
add in creaturescripts.xml
Code:
<event type="statschange" name="damageBaseIncrease" event="script" value="YOURSCRIPTNAME.lua"
add in login.lua
Code:
registerCreatureEvent(cid, "damageBaseIncrease")
Last edited: