soul4soul
Intermediate OT User
i really suck at making spells so id like if someone could help me update this spell from 7.5 i know its old. the waves r shot opposite of the direction the player was standing.
this was my attempt at getting it to work now but i failed terrible so im sure this is useless code.
errors:
also the only shape it shoots is the 3 and its off set way to the left of my screen
Code:
area = {
{0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0},
{0, 0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0},
{2, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 4},
{2, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 4, 4},
{2, 2, 2, 2, 0, 0, 3, 0, 0, 4, 4, 4, 4},
{2, 2, 2, 2, 2, 2, 0, 4, 4, 4, 4, 4, 4},
{2, 2, 2, 2, 0, 0, 1, 0, 0, 4, 4, 4, 4},
{2, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 4},
{2, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 4},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}
}
attackType = ATTACK_BURST
needDirection = false
areaEffect = NM_ME_SOUND
animationEffect = NM_ME_SOUND
hitEffect = NM_ME_YELLOW_RINGS
damageEffect = NM_ME_SOUND
animationColor = GREEN
offensive = true
drawblood = true
EnergyWaveObject = MagicDamageObject(attackType, animationEffect, hitEffect, damageEffect, animationColor, offensive, drawblood, 0, 0)
function onCast(cid, creaturePos, level, maglv, var)
centerpos = {x=creaturePos.x, y=creaturePos.y, z=creaturePos.z}
EnergyWaveObject.minDmg = (level * 2 + maglv * 3) * 1.7
EnergyWaveObject.maxDmg = (level * 2 + maglv * 3) * 2.1
return doAreaMagic(cid, centerpos, needDirection, areaEffect, area, EnergyWaveObject:ordered())
end
this was my attempt at getting it to work now but i failed terrible so im sure this is useless code.
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, CONST_ME_SOUND_GREEN)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_YELLOW_RINGS)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_BURSTARROW)
local area = createCombatArea({
{0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0},
{0, 0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0},
{2, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 4},
{2, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 4, 4},
{2, 2, 2, 2, 0, 0, 3, 0, 0, 4, 4, 4, 4},
{2, 2, 2, 2, 2, 2, 0, 4, 4, 4, 4, 4, 4},
{2, 2, 2, 2, 0, 0, 1, 0, 0, 4, 4, 4, 4},
{2, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 4},
{2, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 4},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}
})
setCombatArea(combat, area)
function onGetFormulaValues(cid, level, skill, attack, factor, maglevel)
return -(level * 2 + maglevel * 3) * 1.7, -(level * 2 + maglevel * 3) * 2.1
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Code:
[16/10/2010 10:54:22] [Error - Spell Interface]
[16/10/2010 10:54:22] In a callback: mods/scripts/customspells/custom/sonar.lua:onGetFormulaValues
[16/10/2010 10:54:22] (Unknown script file)
[16/10/2010 10:54:22] Description:
[16/10/2010 10:54:22] mods/scripts/customspells/custom/sonar.lua:29: attempt to perform arithmetic on local 'maglevel' (a nil value)