• 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 AddEvent Spell

Joined
May 23, 2010
Messages
185
Reaction score
23
Hi guys, i'm here again to ask for some help.

Question: How can i add an event that send a magic effect every 1 second for 15 seconds? An effect like Rage of Pokémon Online that "follow" the target.


This is the script of Barbarian:


Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)
setConditionParam(condition, CONDITION_PARAM_SKILL_FISTPERCENT, 200)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)


function onCastSpell(cid, var)
	doCreatureSay(cid, "RAGE!", TALKTYPE_ORANGE_1, cid)
	return doCombat(cid, combat, var)
end
 
replace your onCastSpell function with this:

Code:
local function sendEffect(cid, effect)
    doSendMagicEffect(getCreaturePosition(cid), effect)
end

function onCastSpell(cid, var)
    doCreatureSay(cid, "RAGE!", TALKTYPE_ORANGE_1, cid)
    for i=1, 15, 1 do
        addEvent(sendEffect, 1000 * i, cid, XXXXXX) --Replace XXXXXX with the effect you want to use
    end
    return doCombat(cid, combat, var)
end

Rep+ is a very nice way of thanking me :)
 
Code:
local function rageSpell(target,count)
    doSendMagicEffect(getCreaturePosition(target), 10)
    if count+1 <= 15 then
        addEvent(rageSpell, 1000, target, count+1)
    end
end

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15000)
setConditionParam(condition, CONDITION_PARAM_SKILL_FISTPERCENT, 200)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)


function onCastSpell(cid, var, target)
	doCreatureSay(cid, "RAGE!", TALKTYPE_ORANGE_1, cid)
  	rageSpell(target,1)
	return doCombat(cid, combat, var)
end

Should work if u have suport for target in spells (TFS 0.4)
 
replace your onCastSpell function with this:

Code:
local function sendEffect(cid, effect)
    doSendMagicEffect(getCreaturePosition(cid), effect)
end

function onCastSpell(cid, var)
    doCreatureSay(cid, "RAGE!", TALKTYPE_ORANGE_1, cid)
    for i=1, 15, 1 do
        addEvent(sendEffect, 1000 * i, cid, XXXXXX) --Replace XXXXXX with the effect you want to use
    end
    return doCombat(cid, combat, var)
end

Rep+ is a very nice way of thanking me :)

This don't follow the target, and don't follow the cid, just send 15 magic effects in a position (cid position at the begining of the script).

An effect like Rage of Pokémon Online that "follow" the >>target<<.
 
excuse me?

I'm sending the cid to the function and everytime it sends the effect, its getting the player's new position, so it always shows the effect where the player is
 
if you take a closer look, the spell increases the fist percent, why would he want to use it on a target? lol

use my code, it'll work just fine :)
 
Back
Top