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

muchppl1x

New Member
Joined
Apr 4, 2020
Messages
22
Reaction score
1
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
 

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
3,144
Solutions
20
Reaction score
2,290
Location
Poland
GitHub
Zbizu
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:

Levi999x

AoT
Joined
Dec 14, 2017
Messages
1,703
Solutions
33
Reaction score
938
Location
Germany
wrote this one for 1.1, but I don't see any outdated code so it might be still working

Doesnt work
no errors
 

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
872
Solutions
19
Reaction score
410
Location
Santiago - Chile
@muchppl1x You can try this, post #15, I guess OTBR has backward compatibility

Hope it helps, regards!
 
OP
M

muchppl1x

New Member
Joined
Apr 4, 2020
Messages
22
Reaction score
1
@muchppl1x You can try this, post #15, I guess OTBR has backward compatibility

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

adric21

Well-Known Member
Joined
Apr 26, 2016
Messages
249
Solutions
1
Reaction score
54
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
 
OP
M

muchppl1x

New Member
Joined
Apr 4, 2020
Messages
22
Reaction score
1
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()
 
Top