Lizard Helper
New Member
- Joined
- Apr 24, 2010
- Messages
- 10
- Reaction score
- 2
So I got this idea for a little spell that summons a creature in the midst of flames and bolts of lightning. I haven't gotten to the lightning yet, and the flames are there, but the creature won't show up.
This is what I have so far:
onCast 1 through 4 work fine. I get the firefields to appear; but once I add the actual summoning part, I get this error:
Which I'm guessing would be the "pos" part of the spell.
So I'm kind of stuck here. I've tried several things; I tried editing the Undead Legion rune, which works until I add the firefields. I tries using "summon" instead of "create", using a couple different snippets of code I've seen around the forum, but they either give me the same error, a slightly different nil value error, or just say they can't find the monster.
Any tips? =/
EDIT: Also, my idea is to summon the creature on one specific SQM:
Right there. But I can't get it to appear whether I use that area or not.
This is what I have so far:
Code:
-- Combat Objects
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat1, COMBAT_PARAM_CREATEITEM, 1492)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat2, COMBAT_PARAM_CREATEITEM, 1492)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat3, COMBAT_PARAM_CREATEITEM, 1492)
local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat4, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat4, COMBAT_PARAM_CREATEITEM, 1492)
-- Combat Areas
area1 = {
{1,0,0},
{0,0,0},
{0,0,0},
{0,2,0}
}
area2 = {
{0,0,1},
{0,0,0},
{0,0,0},
{0,2,0}
}
area3 = {
{0,0,0},
{0,0,0},
{1,0,0},
{0,2,0}
}
area4 = {
{0,0,0},
{0,0,0},
{0,0,1},
{0,2,0}
}
local area1 = createCombatArea(area1)
local area2 = createCombatArea(area2)
local area3 = createCombatArea(area3)
local area4 = createCombatArea(area4)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)
setCombatArea(combat4, area4)
-- OnCastSpell
local function onCastSpell1(parameters)
return doCombat(parameters.cid, combat1, parameters.var)
end
local function onCastSpell2(parameters)
return doCombat(parameters.cid, combat2, parameters.var)
end
local function onCastSpell3(parameters)
return doCombat(parameters.cid, combat3, parameters.var)
end
local function onCastSpell4(parameters)
return doCombat(parameters.cid, combat4, parameters.var)
end
local function onCastSpell5(parameters)
local summon = doCreateMonster("Dragon", pos)
doConvinceCreature(cid, summon)
end
-- Pull It All Together
function onCastSpell(cid, var)
local parameters = { cid = cid, var = var}
addEvent(onCastSpell1, 100, parameters)
addEvent(onCastSpell2, 200, parameters)
addEvent(onCastSpell3, 300, parameters)
addEvent(onCastSpell4, 400, parameters)
addEvent(onCastSpell5, 500, parameters)
end
Code:
[Error - Spell Interface]
In a timer event called from:
data/spells/scripts/custom/fireSummon.lua:onCastSpell
Description:
attempt to index a nil value
stack traceback:
[C]: in function 'doCreateMonster'
data/spells/scripts/custom/fireSummon.lua:76: in function <data/spells/scripts/custom/fireSummon.lua:75>
So I'm kind of stuck here. I've tried several things; I tried editing the Undead Legion rune, which works until I add the firefields. I tries using "summon" instead of "create", using a couple different snippets of code I've seen around the forum, but they either give me the same error, a slightly different nil value error, or just say they can't find the monster.
Any tips? =/
EDIT: Also, my idea is to summon the creature on one specific SQM:
Code:
area = {
{0,0,0},
{0,1,0},
{0,0,0},
{0,2,0}
}