• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Updating a spell

soul4soul

Intermediate OT User
Joined
Aug 13, 2007
Messages
1,875
Solutions
3
Reaction score
128
Location
USA
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.
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
errors:
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)
also the only shape it shoots is the 3 and its off set way to the left of my screen
 
Try that , Adjust the formulas
Lua:
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)



a = {
	{0, 0, 0, 0, 3, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 1, 0, 0, 0, 0},
	{0, 0, 0, 1, 1, 1, 0, 0, 0},
	{0, 0, 0, 1, 1, 1, 0, 0, 0},
	{0, 0, 1, 1, 1, 1, 1, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0}



}
function onGetFormulaValues(cid, level, maglevel)
	local min = -((level/5)+(maglevel*15))
	local max = -((level/5)+(maglevel*18))
	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local area = createCombatArea(a)
setCombatArea(combat, area)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 
works with me :p, -- havnt seen it didnt work i thought you wrote nothng --

You ned to make this (like this --direction part)
Code:
<instant name="xxxx" words="xxx" lvl="xxx" mana="xxx" direction="1" exhaustion="2000" needlearn="0" event="script" value="attack/fire wave.lua">
 
Back
Top