Hi,
just a quick question that I was curious about. Let's say we have a fixed value specified in our lua spells file like that:
if myVariable will be the same for all players, wouldn't it be pointless to allocate the same variable for each player? So instead I was thinking that we can just simply specify that in global.lua as
and then in spell.lua
Let me know what you think, thanks
just a quick question that I was curious about. Let's say we have a fixed value specified in our lua spells file like that:
Lua:
local myVariable = 5
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 68)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4.0, 1, -4.0, 1)
function onCastSpell(cid, var)
print(myVariable)
return doCombat(cid, combat, var)
end
if myVariable will be the same for all players, wouldn't it be pointless to allocate the same variable for each player? So instead I was thinking that we can just simply specify that in global.lua as
Lua:
MY_VARIABLE = 5
and then in spell.lua
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 68)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -4.0, 1, -4.0, 1)
function onCastSpell(cid, var)
print(MY_VARIABLE)
return doCombat(cid, combat, var)
end
Let me know what you think, thanks