ranita
New Member
- Joined
- Jun 10, 2022
- Messages
- 18
- Solutions
- 1
- Reaction score
- 2
Hi all, I've already referred to Error spell console and attempted to fix but no luck.
I've been trying to create a custom spell but I keep on getting errors
I'm on TFS 1.2
My problem is:
"Lua Script Error: [Spell Interface]
data/spells/scripts/attack/holy_light.luanCastSpell
LuaScriptInterface::luaAddEvent(). Argument #4 is unsafe
stack traceback:
[C]: in function 'addEvent'
data/spells/scripts/attack/holy_light.lua:58: in function <data/spells/scripts/attack/holy_light.lua:55>"
I've made a new Lua file in /spells/scripts/attack named "holy_light.lua"
the code:
Not sure if this contributes to it, but in spells.xml I added in:
Thank you!
I've been trying to create a custom spell but I keep on getting errors
I'm on TFS 1.2
My problem is:
"Lua Script Error: [Spell Interface]
data/spells/scripts/attack/holy_light.luanCastSpell
LuaScriptInterface::luaAddEvent(). Argument #4 is unsafe
stack traceback:
[C]: in function 'addEvent'
data/spells/scripts/attack/holy_light.lua:58: in function <data/spells/scripts/attack/holy_light.lua:55>"
I've made a new Lua file in /spells/scripts/attack named "holy_light.lua"
the code:
Lua:
-- SpellCreator generated.
-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Paladin = createCombatObject()
setCombatParam(combat0_Paladin, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(combat0_Paladin, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
setCombatParam(combat0_Paladin, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatArea(combat0_Paladin,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
function getDmg_Paladin(cid, level, maglevel)
return (5)*-1,(15)*-1
end
setCombatCallback(combat0_Paladin, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Paladin")
local con_Light__combat0_Paladin = createConditionObject(0+CONDITION_LIGHT)
setCombatCondition(combat0_Paladin, con_Light__combat0_Paladin)
local dfcombat0_Paladin = {CONST_ANI_SMALLHOLY,0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1}
-- Areas/Combat for 500ms
local combat5_Paladin = createCombatObject()
setCombatParam(combat5_Paladin, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(combat5_Paladin, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
setCombatParam(combat5_Paladin, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatArea(combat5_Paladin,createCombatArea({{1, 1, 1, 1, 1},
{1, 0, 0, 0, 1},
{1, 0, 2, 0, 1},
{1, 0, 0, 0, 1},
{1, 1, 1, 1, 1}}))
function getDmg_Paladin(cid, level, maglevel)
return (5)*-1,(15)*-1
end
setCombatCallback(combat5_Paladin, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Paladin")
local con_Light__combat5_Paladin = createConditionObject(0+CONDITION_LIGHT)
setCombatCondition(combat5_Paladin, con_Light__combat5_Paladin)
local dfcombat5_Paladin = {CONST_ANI_SMALLHOLY,-2,2,-1,2,0,2,1,2,2,2,2,1,2,0,2,-1,2,-2,1,-2,0,-2,-1,-2,-2,-2,-2,-1,-2,0,-2,1}
-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
if (isCreature(cid)) then
doCombat(cid, c, var)
if (dirList ~= nil) then -- Emit distance effects
local i = 2;
while (i < #dirList) do
doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
i = i + 2
end
end
end
end
cid = type(cid) == "userdata" and cid:getId() or cid
function onCastSpell(cid, var)
local startPos = getCreaturePosition(cid)
RunPart(combat0_Paladin,cid,var,dfcombat0_Paladin,startPos)
addEvent(RunPart,500,combat5_Paladin,cid,var,dfcombat5_Paladin,startPos)
return true
end
Not sure if this contributes to it, but in spells.xml I added in:
XML:
<instant name="Holy Light" words="Sanctus Lux" lvl="10" maglv="1" mana="5" exhaustion="1000" prem="0" needlearn="0" blockwalls="0" aggressive="1" event="script" script="attack/holy_light.lua">
<vocation id="1"/>
<vocation id="2"/>
<vocation id="3"/>
<vocation id="4"/>
<vocation id="5"/>
<vocation id="6"/>
<vocation id="7"/>
<vocation id="8"/>
</instant>
Thank you!