• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Question about 'var' on Spells

Scarlet Ayleid

Advanced OT User
Senator
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)
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?
 
Back
Top