MarkSmartRemark
Lua-Noob in Training :D
- Joined
- Jan 27, 2010
- Messages
- 139
- Reaction score
- 3
Hi, Im using 8.6 (tfs 0.3.6)
I need help understanding the formula for knight spells. I understand how they work now but i want to know if theres a way to change it.
heres an example of what im trying to do..
I want the damage be ONLY based on the players weapon attack, and the rest of the formula i put there.. Or at least very close in between the min and max..
I dont want the players skill or level affecting the formula unless theres source editing needed.. which in that case dont worry about it.. But i need to know how the weapon gets put in onGetFormulaValue please!
Heres another version i tried to make but neither worked..
I Get this error when trying it out.
EDIT: If it cant be done this way, is there another way to get similar results? Thanks to whoever can help!!
I need help understanding the formula for knight spells. I understand how they work now but i want to know if theres a way to change it.
heres an example of what im trying to do..
I want the damage be ONLY based on the players weapon attack, and the rest of the formula i put there.. Or at least very close in between the min and max..
I dont want the players skill or level affecting the formula unless theres source editing needed.. which in that case dont worry about it.. But i need to know how the weapon gets put in onGetFormulaValue please!
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
function onGetFormulaValues(cid, weaponAttack, uid)
local playerWeapon = getPlayerWeapon(cid)
min = 10 + (getItemAttack(playerWeapon.uid)*1.1)
max = 20 + (getItemAttack(playerWeapon.uid)*1.1)
return -min, -max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Heres another version i tried to make but neither worked..
Code:
local function damageFormula(cid)
local playerWeapon = getPlayerWeapon(cid)
min = 10 + (getItemAttack(playerWeapon.uid)*1.1)
max = 20 + (getItemAttack(playerWeapon.uid)*1.1)
return -math.random(min, max)
end
function onCastSpell(cid, var)
doTargetCombatHealth(cid, getCreatureTarget(cid), COMBAT_PHYSICALDAMAGE, damageFormula(cid), damageFormula(cid), CONST_ME_HITAREA)
return doCombat(cid, combat, var)
end
I Get this error when trying it out.
Code:
[25/02/2014 23:28:59] [Error - Spell Interface]
[25/02/2014 23:28:59] data/spells/scripts/Warrior/New/Heroic Strike.lua:onCastSpell
[25/02/2014 23:28:59] Description:
[25/02/2014 23:28:59] data/spells/scripts/Warrior/New/Heroic Strike.lua:18: attempt to call global 'getItemAttack' (a nil value)
[25/02/2014 23:28:59] stack traceback:
[25/02/2014 23:28:59] data/spells/scripts/Warrior/New/Heroic Strike.lua:18: in function 'damageFormula'
[25/02/2014 23:28:59] data/spells/scripts/Warrior/New/Heroic Strike.lua:25: in function <data/spells/scripts/Warrior/New/Heroic Strike.lua:24>
EDIT: If it cant be done this way, is there another way to get similar results? Thanks to whoever can help!!