- Joined
- Jul 7, 2007
- Messages
- 4,049
- Reaction score
- 240
Hey all
I know this is usually for non-working scripts and such, but this is LUA Help, so I think this will fit here, move if you feel its in the wrong place
What is in the var when you do a spell(function onCastSpell(cid, var))
I assume its the things related to the spell like if its selftarget or maybe its where the target is if the spell has needtarget, ...
My question is, lets say I have a spell that has direction(Great Energy Beam), and that I want to change the casting direction inside the script, for a better example:
(I'm facing North when I cast the spell)
what would I need to add on the ... to change the values in the var to attack south
I'm assuming that the direction is stored somehow on the var, if it isnt, could someone explain to me how does the spell knows where to cast?
I know this is usually for non-working scripts and such, but this is LUA Help, so I think this will fit here, move if you feel its in the wrong place
What is in the var when you do a spell(function onCastSpell(cid, var))
I assume its the things related to the spell like if its selftarget or maybe its where the target is if the spell has needtarget, ...
My question is, lets say I have a spell that has direction(Great Energy Beam), and that I want to change the casting direction inside the script, for a better example:
(I'm facing North when I cast the spell)
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1.3, 0, -1.7, 0)
local area = createCombatArea(AREA_BEAM7, AREADIAGONAL_BEAM7)
setCombatArea(combat, area)
function onCastSpell(cid, var)
if X == TRUE then
return doCombat(cid, combat, var) --ATTACK NORTH AS IT SHOULD
elseif X == FALSE then
...
return doCombat(cid, combat, var) --ATTACK SOUTH
end
end
what would I need to add on the ... to change the values in the var to attack south
I'm assuming that the direction is stored somehow on the var, if it isnt, could someone explain to me how does the spell knows where to cast?