• 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 Broadcasting problem

Exoltes

Novia OTserv Developer
Joined
Jul 2, 2009
Messages
563
Reaction score
47
Location
Belgium
I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).

I'm making this quest where sometimes a broadcast msg will happen when you use the chest. But i ran into the following error after using my chest.

[09/08/2014 17:17:28] Lua Script Error: [Action Interface]
[09/08/2014 17:17:28] data/actions/scripts/quests/explosive treasure chest.lua:eek:nUse

[09/08/2014 17:17:28] .../actions/scripts/quests/explosive treasure chest.lua:15: attempt to call global 'doBroadcastMessage' (a nil value)
[09/08/2014 17:17:28] stack traceback:
[09/08/2014 17:17:28] .../actions/scripts/quests/explosive treasure chest.lua:15: in function <.../actions/scripts/quests/explosive treasure chest.lua:1>

Server\data\actions\scripts\quests\explosive treasure chest.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local function doTransformBack(pos, itemid, transformid)
     return doTransformItem(getTileItemById(pos, transformid).uid, itemid)
end   

        if itemEx.itemid == 5675 and item.uid == 5569 then
           local rand = math.random(1, 2)
           if rand == 1 then
            doSendMagicEffect(toPosition,CONST_ME_FIREAREA)
            doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -100, -100, CONST_ME_NONE)
              doCreatureSay(cid, "KABOOM!", TALKTYPE_ORANGE_1)
            doTransformItem(itemEx.uid, 2255)
            addEvent(doTransformBack, 42*60*1, toPosition, itemEx.itemid, 2255)
            doBroadcastMessage("Boys! To arms!!!")
          else
            doSendMagicEffect(toPosition,CONST_ME_FIREAREA)
            doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -100, -100, CONST_ME_NONE)
              doCreatureSay(cid, "KABOOM!", TALKTYPE_ORANGE_1)
            doTransformItem(itemEx.uid, 2255)
            addEvent(doTransformBack, 28*60*1, toPosition, itemEx.itemid, 2255)
end
end
end

If anyone could help me out, that would be great!

Thanks in advance.
 
Example green message:
Code:
broadcastMessage("Boys! To arms!!!", MESSAGE_INFO_DESCR)

For other types (constant names from global.lua).
Code:
MESSAGE_STATUS_CONSOLE_RED = 18
MESSAGE_EVENT_ORANGE = 19
MESSAGE_STATUS_CONSOLE_ORANGE = 20
MESSAGE_STATUS_WARNING = 21
MESSAGE_EVENT_ADVANCE = 22
MESSAGE_EVENT_DEFAULT = 23
MESSAGE_STATUS_DEFAULT = 24
MESSAGE_INFO_DESCR = 25
MESSAGE_STATUS_SMALL = 26
MESSAGE_STATUS_CONSOLE_BLUE = 27
 
changed it to:
broadcastMessage("Boys! To arms!!!", MESSAGE_STATUS_DEFAULT)

I do get the msg in my server log but not on my screen :s
 
They work the same way as with doPlayerSendTextMessage, only with broadcast everyone gets this message.
For a white message that you see on your screen use MESSAGE_EVENT_ADVANCE.
 
Back
Top