globalevents.xml
XML:
<globalevent name="talkingSigns" interval="2000" event="script" value="talking.lua"/>
globalevents/scripts/talking.lua
Lua:
local config = {
positions = {
{pos = {x = 851, y = 972, z = 7}, text = "Hello Sir! How are you?", effects = {CONST_ME_MAGIC_BLUE}},
{pos = {x = 855, y = 972, z = 7}, text = "How are you?"}
},
effects = {CONST_ME_POFF, CONST_ME_TELEPORT, CONST_ME_MAGIC_RED}
}
function onThink(interval)
local people = getPlayersOnline()
if #people == 0 then
return true
end
for _, info in pairs(config.positions) do
doPlayerSay(people[1], info.text, TALKTYPE_MONSTER_SAY, false, 0, info.pos)
if info.effects and #info.effects > 0 then
doSendMagicEffect(info.pos, info.effects[math.random(#info.effects)])
elseif config.effects and #config.effects > 0 then
doSendMagicEffect(info.pos, config.effects[math.random(#config.effects)])
end
end
return true
end
Config Explanation
Lua:
local config = {
positions = {
{pos = {x = 851, y = 972, z = 7}, text = "Hello Sir! How are you?", effects = {CONST_ME_MAGIC_BLUE}},
{pos = {x = 855, y = 972, z = 7}, text = "How are you?"}
},
effects = {CONST_ME_POFF, CONST_ME_TELEPORT, CONST_ME_MAGIC_RED}
}
Add new signs just like:
>> {pos = {x = 851, y = 972, z = 7}, text = "Hello Sir! How are you?", effects = {CONST_ME_MAGIC_BLUE}},
If you leave those effects away it will choose a random effect from this table:
>> {CONST_ME_POFF, CONST_ME_TELEPORT, CONST_ME_MAGIC_RED}
Thx.