Ok so heres what I've got so far
In my init.lua
Code: Select all
cloneObject {
name == "party",
baseObject = "party",
onDrawGui = function(ctx)
mdConversationList.onDraw(ctx)
end,
onAttack = function(champion, weapon)
return attackingWeaponScripts.specialWeaponAttacks(champion, weapon, skill)
end,
}
(the onDraw for Msyblades journal)
in a SE called attackingWeaponScripts
Code: Select all
function specialWeaponAttacks(champion, weapon, skill)
if (weapon ~= nil) and (weapon.name == "dm_wind_sword") then
return attackingWeaponScripts.burstSpellAttacks(champion,weapon,skill)
end
return true end
function burstSpellAttacks(champion, weapon, skill)
if (weapon ~= nil) and (weapon.name == "dm_wind_sword") then
if party.facing == 0 then
local skill = champion:getSkillLevel("swords")
caster = champion
pushback_spell_script.pushbackSpell(caster,x,y,direction,skill)
end
if party.facing == 1 then
local skill = champion:getSkillLevel("swords")
caster = champion
pushback_spell_script.pushbackSpell(caster,x,y,direction,skill)
end
if party.facing == 2 then
local skill = champion:getSkillLevel("swords")
caster = champion
pushback_spell_script.pushbackSpell(caster,x,y,direction,skill)
end
if party.facing == 3 then
local skill = champion:getSkillLevel("swords")
caster = champion
pushback_spell_script.pushbackSpell(caster,x,y,direction,skill)
end
end
end
The spell works if cast by a mage or from an item, and it seem to be calling on the correct script when I use the Wind cutter sword I made but in this section of the spells script
Code: Select all
function pushbackSpell(caster,x,y,direction,skill)
local dx,dy = getForward(direction)
if monsterThere(party.level,x+dx,y+dy)
then
-- hudPrint("Monster!")
if isValidTarget(party.level,x+2*dx,y+2*dy)
then
hudPrint("PUSH!!!!")
spawn("fx", party.level, x+dx, y+dy, direction, "push_smoke")
:setParticleSystem("push_spell")
:translate(0, 0.5, 0)
playSoundAt("fireball_launch",party.level,x+dx,y+dy)
spawn("teleporter", party.level, x+dx,y+dy,direction, "push_teleport")
:setTeleportTarget(x+2*dx,y+2*dy, direction)
:setTriggeredByParty(false)
:setTriggeredByMonster(true)
:setTriggeredByItem(false)
:setChangeFacing(true)
:setInvisible(true)
:setSilent(true)
:setHideLight(true)
:setScreenFlash(false)
spawn("timer",party.level,x,y,direction,"push_timer")
:setTimerInterval(0.1)
:addConnector("activate", "pushback_spell_script", "pushDestroy")
:activate()
else
hudPrint("The spell fails because there is something in the way.")
end
else
hudPrint("The spell fails because there is no monster to push")
end
end
Specifically local dx,dy = getForward(direction) I get the error "bad argument #1 to "getForward" number expected got nil
Any ideas on what to do here?