Chorajk and Mazen Help me Thanks guys.
When using the item (bird cage) sends different effects
Tested in tfs v.2
And for v.3 in global events
each 30 seg sends the different types from effects
When using the item (bird cage) sends different effects
Tested in tfs v.2
Lua:
<action itemid="2095" script="BirdCage.lua"/>
Lua:
effects = {
CONST_ME_SOUND_BLUE,
CONST_ME_SOUND_RED,
CONST_ME_SOUND_YELLOW,
CONST_ME_SOUND_PURPLE,
CONST_ME_SOUND_BLUE,
CONST_ME_SOUND_WHITE
}
function onUse(cid, item, frompos, item2, topos )
doSendMagicEffect(frompos, effects[math.random(1, #effects)])
return true
end
And for v.3 in global events
each 30 seg sends the different types from effects
Lua:
<globalevent name=" Bird Cage " interval="30" event="script" value="Bird Cage.lua"/>
Lua:
function onThink(cid, interval, lastExecution)
local config = {
cage_id = 2095,
effects = {CONST_ME_SOUND_BLUE, CONST_ME_SOUND_YELLOW,
CONST_ME_SOUND_GREEN,
CONST_ME_SOUND_WHITE}
}
for i, tid in ipairs(getPlayersOnline()) do
if (getPlayerItemCount(tid, config.cage_id) >= 1) then
doSendMagicEffect(getCreaturePosition(tid), config.effects[math.random(1, #config.effects)])
end
end
return TRUE
end