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

Solved Script cut time animated text

warriorfrog

Active Member
Joined
Jul 29, 2015
Messages
334
Reaction score
35
I have a script to count MW time, but if a player use machete to remove MWILD, the time dont stop, any here know how to fix it?

wild growth rune.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1499)
function countPos(cid, pos, tempo)
  if tempo > 0 then
  doSendAnimatedText(pos, tempo, TEXTCOLOR_YELLOW)
  addEvent(countPos, 1000, cid, pos, tempo-1)
  else
  doSendMagicEffect(pos, 2)
  end
end
function onCastSpell(cid, var)
  countPos(cid, var.pos, 45)
  doCreatureSay(cid, 'WALL', TALKTYPE_ORANGE_1)
  doCombat(cid, combat, var)
   doPlayerRemoveItem(cid, 2269, 1)
end
 
Make it check if the MWILD is still there, before continuing the count. If MWILD is not there, cancel.
 
You want to check for the item 1499 within the if statement this way the animated text & addEvent are never called if the object no longer exists.
 
Try this
Code:
    local MWILD = 1499
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)
    setCombatParam(combat, COMBAT_PARAM_CREATEITEM, MWILD)

    function countPos(cid, pos, tempo)
        if tempo > 0 and getTileItemById(pos, MWILD) then
            doSendAnimatedText(pos, tempo, TEXTCOLOR_YELLOW)
            addEvent(countPos, 1000, cid, pos, tempo-1)
        else
            return doSendMagicEffect(pos, 2)
        end
    end

    function onCastSpell(cid, var)
        countPos(cid, var.pos, 45)
        doCreatureSay(cid, 'WALL', TALKTYPE_ORANGE_1)
        doCombat(cid, combat, var)
        doPlayerRemoveItem(cid, 2269, 1)
    end
 
Last edited:
Try this
Code:
    local MWILD = 1499
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)
    setCombatParam(combat, COMBAT_PARAM_CREATEITEM, MWILD)

    function countPos(cid, pos, tempo)
        if tempo > 0 and getTileItemById(pos, MWILD) then
            doSendAnimatedText(pos, tempo, TEXTCOLOR_YELLOW)
            addEvent(countPos, 1000, cid, pos, tempo-1)
        else
            return doSendMagicEffect(pos, 2)
        end
    end

    function onCastSpell(cid, var)
        countPos(cid, var.pos, 45)
        doCreatureSay(cid, 'WALL', TALKTYPE_ORANGE_1)
        doCombat(cid, combat, var)
        doPlayerRemoveItem(cid, 2269, 1)
    end


Its dont work bro
 
Code:
if tempo > 0 and getTileItemById(pos, MWILD).uid > 0 then

Code:
  local MWILD = 1499
  local combat = createCombatObject()
  setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)
  setCombatParam(combat, COMBAT_PARAM_CREATEITEM, MWILD)

  function countPos(cid, pos, tempo)
  if tempo > 0 and getTileItemById(pos, MWILD).uid > 0 then
  doSendAnimatedText(pos, tempo, TEXTCOLOR_YELLOW)
  addEvent(countPos, 1000, cid, pos, tempo-1)
  else
  return doSendMagicEffect(pos, 2)
  end
  end

  function onCastSpell(cid, var)
  countPos(cid, var.pos, 45)
  doCreatureSay(cid, 'WALL', TALKTYPE_ORANGE_1)
  doCombat(cid, combat, var)
  doPlayerRemoveItem(cid, 2269, 1)
  end

I try to do it, when i use mwild or mw dont count time
Dont show animated chat

When i use the wall dont count
Code:
  doSendAnimatedText(pos, tempo, TEXTCOLOR_YELLOW)
  addEvent(countPos, 1000, cid, pos, tempo-1)

Code:
if tempo > 0 and getTileItemById(pos, MWILD).uid > 0 then

You know?
 
Last edited by a moderator:
Add doCombat(cid, combat, var) above countPos(cid, var.pos, 45), because else it checks if it's there before it's created.

Lol you'r good, ty

Now normal MW is bugged

Why if i change color of mwild, change normal mw color too?
magic wall rune.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)
function countPos(cid, pos, tempo)
  if tempo > 0 then
  doSendAnimatedText(pos, tempo, TEXTCOLOR_YELLOW)
  addEvent(countPos, 1000, cid, pos, tempo-1)
  else
  doSendMagicEffect(pos, 2)
  end
end
function onCastSpell(cid, var)
  countPos(cid, var.pos, 20)
  doCreatureSay(cid, 'WALL', TALKTYPE_ORANGE_1)
  doCombat(cid, combat, var)
   doPlayerRemoveItem(cid, 2293, 1)
end
 
Back
Top