• 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!

TFS 1.3 - How to ADD Timer to Magic Wall and Wild Growth [ Like Magebot ] ?

muchppl1x

New Member
Joined
Apr 4, 2020
Messages
22
Reaction score
1
Hello,

I use OTSERVER-BR Global 12.61

TFS 1.3

I need to add visual timer effect to magic wall and wild growth for i know when disappear is possible?

My scripts:

magic wall.lua
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onCreateMagicWall(creature, tile)
local item = Game.createItem(Game.getWorldType() == WORLD_TYPE_NO_PVP and ITEM_MAGICWALL_SAFE or ITEM_MAGICWALL, 1, tile)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, math.random(14000, 20000))
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")

local spell = Spell("rune")
function spell.onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end


spell:name("Magic Wall Rune")
spell:group("attack")
spell:id(86)
spell:cooldown(1 * 1500)
spell:groupCooldown(1 * 1500)
spell:level(32)
spell:magicLevel(9)
spell:runeId(2293)
spell:charges(3)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:register()

=========================================

Wild Growth.lua
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

function onCreateMagicWall(creature, tile)
local item = Game.createItem(Game.getWorldType() == WORLD_TYPE_NO_PVP and ITEM_WILDGROWTH_SAFE or ITEM_WILDGROWTH, 1, tile)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, math.random(38000, 45000))
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")

local spell = Spell("rune")
function spell.onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end

spell:name("Wild Growth Rune")
spell:group("attack")
spell:id(94)
spell:cooldown(1 * 1000)
spell:groupCooldown(1 * 1000)
spell:level(27)
spell:magicLevel(8)
spell:runeId(2269)
spell:charges(2)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:vocation("druid;true", "elder druid")
spell:register()[/b]


If need to change something in the source .. where?

Thank !!
 
In TFS 1.3 i never saw.

Have 999999 scripts in web for others TFS versions.

That works on OTSERVER-BR version 12 I don't see 1 script
 
wrote this one for 1.1, but I don't see any outdated code so it might be still working

edit: nvm, it's outdated
 
Last edited:
wrote this one for 1.1, but I don't see any outdated code so it might be still working

Doesnt work
no errors
 
@muchppl1x You can try this, post #15, I guess OTBR has backward compatibility

Hope it helps, regards!
 
@muchppl1x You can try this, post #15, I guess OTBR has backward compatibility

Hope it helps, regards!
Nope. no work for my version bro
 
Test it

Lua:
function doShowTimeByPos(uid, pos, duration, type)
type = type or 20
for i = 0, (duration - 1) do
addEvent(function()
if isCreature(uid) then
doCreatureSay(uid, tostring(duration - i), type, false, 0, pos)
end
end, i * 1000)
end
return true
end

function onCastSpell(cid, var)
doShowTimeByPos(cid, variantToPosition(var), 20, 20)
return doCombat(cid, combat, var)
end
 
Test it

Lua:
function doShowTimeByPos(uid, pos, duration, type)
type = type or 20
for i = 0, (duration - 1) do
addEvent(function()
if isCreature(uid) then
doCreatureSay(uid, tostring(duration - i), type, false, 0, pos)
end
end, i * 1000)
end
return true
end

function onCastSpell(cid, var)
doShowTimeByPos(cid, variantToPosition(var), 20, 20)
return doCombat(cid, combat, var)
end

No work bro.

Please compare with this script:

magic_wall.lua

local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onCreateMagicWall(creature, tile)
local item = Game.createItem(Game.getWorldType() == WORLD_TYPE_NO_PVP and ITEM_MAGICWALL_SAFE or ITEM_MAGICWALL, 1, tile)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, math.random(20000))
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")

local spell = Spell("rune")
function spell.onCastSpell(creature, variant, isHotkey)
local mwItem = Game.createItem(1497, 1, variant:getPosition())
if mwItem then
mwItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Casted by " ..creature:getName())
mwItem:decay()
end
return combat:execute(creature, variant)
end


spell:name("Magic Wall Rune")
spell:group("attack")
spell:id(86)
spell:cooldown(1 * 1500)
spell:groupCooldown(1 * 1500)
spell:level(32)
spell:magicLevel(9)
spell:runeId(2293)
spell:charges(3)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:register()
 
I know this post is "old".
I did a code about this a year ago and have no idea if still work or if still is needed, but:
First, you have to install this:

After that, just change the file:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onCreateMagicWall(creature, tile)
local item = Game.createItem(ITEM_MAGICWALL, 1, tile)
local duration = math.random(14000, 20000)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, duration)
local duration2 = math.floor(duration/1000)
local timea = duration2

enableSleep(function()
for i = 1, duration2 do
local spectators = Game.getSpectators(tile, false, true, 7, 7, 5, 5)
if #spectators > 0 then
for i = 1, #spectators do
spectators:say(timea, TALKTYPE_MONSTER_SAY, false, spectators, tile)
end
end
timea = timea - 1
sleep(1000)
end
end)

end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")

local spell = Spell("rune")
function spell.onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end


spell:name("Magic Wall Rune")
spell:group("attack")
spell:id(86)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:level(32)
spell:magicLevel(9)
spell:runeId(2293)
spell:charges(3)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:register()


local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

function onCreateMagicWall(creature, tile)
local item = Game.createItem(ITEM_WILDGROWTH, 1, tile)
local duration = math.random(38000, 45000)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, duration)
local duration2 = math.floor(duration/1000)
local timea = duration2

enableSleep(function()
for i = 1, duration2 do
local spectators = Game.getSpectators(tile, false, true, 7, 7, 5, 5)
if #spectators > 0 then
for i = 1, #spectators do
spectators:say(timea, TALKTYPE_MONSTER_SAY, false, spectators, tile)
end
end
timea = timea - 1
sleep(1000)
end
end)
end



combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")

local spell = Spell("rune")
function spell.onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end



spell:name("Wild Growth Rune")
spell:group("attack")
spell:id(94)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:level(27)
spell:magicLevel(8)
spell:runeId(2269)
spell:charges(2)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:vocation("druid", "elder druid")
spell:register()
 
Back
Top