• 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] How to make a simple spell script.

Well i saw this script before but there are few points i dont really understand the function of it,i hope u can explain this :

for k, area in ipairs(deathFlamesArea) dodeathFlames[k] = createCombatObject()setCombatParam(deathFlames[k], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)setCombatParam(deathFlames[k], COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKE)setCombatFormula(deathFlames[k], COMBAT_FORMULA_LEVELMAGIC, -12.593, -50, -13.929, -100)
setCombatArea(deathFlames[k], area)end

function onCastSpell(cid, var)
for i = 0, repeatAmount - 1 do
for k, combat in ipairs(deathFlames) doaddEvent(castSpellDelay, (150 * k) + #deathFlames * 150 * i + 700 * i, {cid, combat, var})end
addEvent(castSpellDelay, (150 * #deathFlames) + #deathFlames * 150 * i + 700 * i, {cid, bigFlames, var})end
return LUA_NO_ERROR
 
Well i saw this script before but there are few points i dont really understand the function of it,i hope u can explain this :

for k, area in ipairs(deathFlamesArea) dodeathFlames[k] = createCombatObject()setCombatParam(deathFlames[k], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)setCombatParam(deathFlames[k], COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKE)setCombatFormula(deathFlames[k], COMBAT_FORMULA_LEVELMAGIC, -12.593, -50, -13.929, -100)
setCombatArea(deathFlames[k], area)end

It is a shortcut to explain all these combats you know.. IF you look at the areas you see the names like deathflamesarea is linked with it and you also see the combat, areaeffect, damage formula etc.\
I recommend it to use if you know a bit of lua or else just keep it on the default way..

function onCastSpell(cid, var)
for i = 0, repeatAmount - 1 do
for k, combat in ipairs(deathFlames) doaddEvent(castSpellDelay, (150 * k) + #deathFlames * 150 * i + 700 * i, {cid, combat, var})end
addEvent(castSpellDelay, (150 * #deathFlames) + #deathFlames * 150 * i + 700 * i, {cid, bigFlames, var})end
return LUA_NO_ERROR

Here it is explaining that when the spell gets casted what will happen and when..
 
Because i still get questions and sometimes support requests due to this thread, i will update it whenever i have time available again.
I could barely script anything back then XD aside the TFS changes.
 
hi, you know if it's possible make a spell with more than 1 effect? for example, in the player's sqm it is an effect and in the other sqm another effect. Or this example of create spell only works with 1 effect?

edit: looking in the others script of spell i found one way
function onCastSpell(creature, var)
creature:getPosition():sendMagicEffect(226) <- with this you will have an effect on the player
return combat1:execute(creature, var)
end
 
Last edited:
-- misread srry
 
Last edited:
Back
Top