• 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 [Tutorial] [LUA] Multi-colored spells

Xanix

GHIII
Joined
Oct 24, 2007
Messages
176
Reaction score
2
Location
Sweden, GBG
This tutorial will teach you how do make a spell with 3 different colors. Lets say you want an exori spell to have Energy area, explosion area and posion area. This is how you do it:

Make a file called boom.lua in data\spells\scripts

Open it up and insert:


local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -2.0, -10, -2.1, -150)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -2.0, -150, -2.1, -150)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -2.0, -150, -2.1, -150)

arr1 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

arr2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{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, 0, 0, 2, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

arr3 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)

local function onCastSpell1(parameters)
doCombat(parameters.cid, parameters.combat1, parameters.var)
end

local function onCastSpell2(parameters)
doCombat(parameters.cid, parameters.combat2, parameters.var)
end

local function onCastSpell3(parameters)
doCombat(parameters.cid, parameters.combat3, parameters.var)
end

function onCastSpell(cid, var)
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3 }
addEvent(onCastSpell1, 0, parameters)
addEvent(onCastSpell2, 1, parameters)
addEvent(onCastSpell3, 2, parameters)
--change the delay time. ^
end
The text marked in bold is the color area effect. You can change this to another area effect if you want, to get a different color.
Save it.

The numbers in bold is how fast the spell will work. If you change the "1" to "200" it will take that long before you see the energyarea. Its great to make a delay.

Paste this in spells.xml:
<instant name="Boom" words="boom" blockwalls="1" lvl="50" maglv="5" manapercent="50" soul="0" exhaustion="1" prem="1" enabled="1" script="boom.lua"><vocation id="4"/><vocation id="8"/></instant>
And save it.

Now you should have a fully working spell called boom, with 3 different colors!

ps: this is actually 3 different spells in one .lua file.

Example of a multi-colored spell:

multicoloredspellhy9.jpg
 
My script is the exevo gran mas vis with many colors.. and you posted this 1 day after I posted that.
 
Hey why you're so fucked up man..wheres the problem? THATS THE LIFE! xD:thumbup:

Wow dude that was one hell of a useless HUGE bump lol.

Look at the date on the post you quoted:

Code:
16th January 2008, 21:39

It was over 1 year ago, not that he really needed that response now lol :rolleyes:
 
this isnt really a tutorial its just giving you a spell. you should explain to people how to edit it all so they can have their custom spell. Anyone can copy and paste, noob scripters should learn to make unique spells.
 
Back
Top