• 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] [Spells] Make your own instant spell.

Xanix

GHIII
Joined
Oct 24, 2007
Messages
176
Reaction score
2
Location
Sweden, GBG
This tutorial will show you how to create your own spells.
Instants.

If you want to make your own instant spell:
Locate Data\Spells\Instants
Now, there is a whole lot of different spells you can make, but I will explain how to make your own, custom, easy spell.

Find the exori.lua and copy it, and paste it inside the same folder and rename it to super exori.lua and open it by double clicking it.

What you see inside:

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

attackType = ATTACK_PHYSICAL
needDirection = false
areaEffect = NM_ME_HIT_AREA
animationEffect = NM_ANI_NONE

hitEffect = NM_ME_HIT_AREA
damageEffect = NM_ME_HIT_AREA
animationColor = RED
offensive = true
drawblood = true

UltimateExplosionObject = 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}
n = tonumber(var) -- try to convert it to a number
if n ~= nil then
-- bugged
-- ultimateExplosionObject.minDmg = var+0
-- UltimateExplosionObject.maxDmg = var+0

UltimateExplosionObject.minDmg = 0
UltimateExplosionObject.maxDmg = 0
else
-- UltimateExplosionObject.minDmg = (level * 5 + maglv * 6) * 2.3 - 30
-- UltimateExplosionObject.maxDmg = (level * 5 + maglv * 6) * 3.0
UltimateExplosionObject.minDmg = (level * 3 + maglv * 3) * 1.2
UltimateExplosionObject.maxDmg = (level * 3 + maglv * 3) * 2.3
end
return doAreaMagic(cid, centerpos, needDirection, areaEffect, area, UltimateExplosionObjectrdered())
end
Now, we'll start from the top.
The large set of numbers (ones and zeros) tells you what square meter will be hit by the spell. Change this to however you like, I will give you an example of how you can change it (but there really is no limit, it's all up to you.)

area = {
{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, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 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},
}
As you see, i made the exori radius twice as big.

Now below the numbers, you see:
attackType = ATTACK_PHYSICAL
needDirection = false
areaEffect = NM_ME_HIT_AREA
animationEffect = NM_ANI_NONE

hitEffect = NM_ME_HIT_AREA
damageEffect = NM_ME_HIT_AREA
animationColor = RED
offensive = true
drawblood = true
attackType:
tells you what other monsters will be imune to the spell. Nothing is imune to physical as far as I know, expept death slicers.
This is what you can choose from:
ATTACK_NONE
ATTACK_ENERGY
ATTACK_BURST
ATTACK_FIRE
ATTACK_PHYSICAL
ATTACK_POISON
ATTACK_PARALYZE
ATTACK_DRUNKNESS
ATTACK_LIFEDRAIN
ATTACK_MANADRAIN
needDirection:
That means if you want your spell to shoot according to what direction your character is facing, this must be set true. Since exori is one sqm all around your character, it is set to false.

areaEffect:
This is how the spell will look like once it has hit something.
You can choose from:
NM_ME_DRAW_BLOOD
NM_ME_LOOSE_ENERGY
NM_ME_PUFF
NM_ME_BLOCKHIT
NM_ME_EXPLOSION_AREA
NM_ME_EXPLOSION_DAMAGE
NM_ME_FIRE_AREA
NM_ME_YELLOW_RINGS
NM_ME_POISEN_RINGS
NM_ME_HIT_AREA
NM_ME_ENERGY_AREA
NM_ME_ENERGY_DAMAGE
animationEffect:
As it says, what kind of Animation it will have.
Choose from:
NM_ANI_BOLT
NM_ANI_ARROW
NM_ANI_FIRE
NM_ANI_ENERGY
NM_ANI_POISONARROW
NM_ANI_BURSTARROW
NM_ANI_THROWINGSTAR
NM_ANI_THROWINGKNIFE
NM_ANI_SMALLSTONE
NM_ANI_SUDDENDEATH
NM_ANI_LARGEROCK
NM_ANI_SNOWBALL
NM_ANI_POWERBOLT
hitEffect:
Tells you how it will look when the spell is casted.
Choose from:
NM_ME_DRAW_BLOOD
NM_ME_LOOSE_ENERGY
NM_ME_PUFF
NM_ME_BLOCKHIT
NM_ME_EXPLOSION_AREA
NM_ME_EXPLOSION_DAMAGE
NM_ME_FIRE_AREA
NM_ME_YELLOW_RINGS
NM_ME_POISEN_RINGS
NM_ME_HIT_AREA
NM_ME_ENERGY_AREA
NM_ME_ENERGY_DAMAGE
damageEffect:
Shows how it will look when a creature has been hit by the spell.
Choose from the above, or:
NM_ME_MAGIC_ENERGIE
NM_ME_MAGIC_BLOOD
NM_ME_MAGIC_POISEN
NM_ME_HITBY_FIRE
NM_ME_POISEN
NM_ME_MORT_AREA
NM_ME_SOUND
NM_ME_SOUND_GREEN
NM_ME_SOUND_RED
NM_ME_POISONCLOUD
NM_ME_SOUND_YELLOW
NM_ME_SOUND_PURPLE
NM_ME_SOUND_BLUE
NM_ME_SOUND_WHITE
animationColor:
This is the color of the damage that will appear above the character. Most spells are set to red, posion attacks are set to green, and ofcourse, mana damage is set to blue.

Thats the basic of making the spell, then ofcourse you can alter the damage if you look below.

Now when you made yoru own spell, save it, and close it.

Go to:
Data\Spells and open spells.xml
Copy and paste this text under Instants.
<spell name="Super Exori" words="super exori" maglv="110" mana="10000" enabled="1"><vocation id="1" /></spell>
Spell name - Name of the spell.
Words - What you must say to cast the spell.
Maglv - Required magic level to use the spell.
Mana - Amount of mana the spell will use.
Vocation id:
1,2,3,4 represents the vocations.

Now your spell should work, just make sure to save it!
 
nice tutorial, i want to make a "exevo mas fire" spell as big as UE, with the animation like Fire Field, but i dont want to make fire fields...how could i do this?

ive kind of made it but it leaves fire everywhere...i just want it to look like fire fields in the circle. but it leaves fire everywhere...
 
Nice tut teaches people who dont know how to make spells how to make spells :p REP++
 
Its a nice explanation of different spells, but you could do it a little better I think, I can help detailing it a little more, if you allow me to edit your thread I will add some stuff that might come in handy?
 
Very nice :D

but cant it be set to lvl requirement instead of m lvl? ^_^
 
nice tutorial, i want to make a "exevo mas fire" spell as big as UE, with the animation like Fire Field, but i dont want to make fire fields...how could i do this?

ive kind of made it but it leaves fire everywhere...i just want it to look like fire fields in the circle. but it leaves fire everywhere...
copy ue spell change animation to the same as for example soulfire, then change the spell dmg and you should have an "ue whit firefield animation"
 
@Mummrik,
Thanks, I eventually figured it out...I'm alot better with spells now.

Kind Regards.
 
7.6 buhaha
chybazesciezfariowwali
you're going wrong way, only noooobs plays 7.6
 
Back
Top