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

Lua Help in summon system [globalevent]

Shalk

Royal Angels ATS
Joined
Sep 19, 2007
Messages
214
Reaction score
4
Location
Brazil
hello friends help me solve a problem ..


Code:
[0:33:02.791] [Error - GlobalEvents::think] Couldn't execute event: monstersummo
nraid
[0:33:07.800] [Error - GlobalEvents::think] Couldn't execute event: monstersummo
nraid
[0:33:12.807] [Error - GlobalEvents::think] Couldn't execute event: monstersummo
nraid
[0:33:17.808] [Error - GlobalEvents::think] Couldn't execute event: monstersummo
nraid
[0:33:22.809] [Error - GlobalEvents::think] Couldn't execute event: monstersummo
nraid

globalevents.xml
Code:
<globalevent name="monstersummonraid" interval="5000" event="script" value="invasao.lua"/>

invasao.lua
Code:
function onThink(interval)

monsters = {"Demon", "Dragon" }
map_2 = {
{x=205, y=220, z=7}, 
{x=216, y=220, z=7}
}



if getWorldCreatures(0) == 0 then
print ("[MAP] No players online, aborting summon!")

else



	RDM = math.random(#monsters)
	RDP2 = math.random(#map_2)


end
for _, tid in ipairs(getPlayersOnline()) do				
doPlayerSendChannelMessage(tid, "", "Summoning the " ..monsters[RDM].. " in the map.", TALKTYPE_CHANNEL_Y, 99)

if getGlobalStorageValue(3454) == 2 then
doCreateMonster(monsters[RDM], map_2[RDP2])
return false
end


return true
end
end

But the monster is summoned, only this error appears on the console .. any idea how to solve this problem?
 
Try this
Lua:
function onThink(interval)
monsters = {"Demon", "Dragon" }
map_2 = {
{x=205, y=220, z=7}, 
{x=216, y=220, z=7}
}

if getWorldCreatures(0) == 0 then
print ("[MAP] No players online, aborting summon!")
return true
else
	RDM = math.random(#monsters)
	RDP2 = math.random(#map_2)

	for _, tid in ipairs(getPlayersOnline()) do				
	doPlayerSendChannelMessage(tid, "", "Summoning the " ..monsters[RDM].. " in the map.", TALKTYPE_CHANNEL_Y, 99)
	end
	
	if getGlobalStorageValue(3454) == 2 then
	doCreateMonster(monsters[RDM], map_2[RDP2])
	end
end
return true
end
 
Try this
Lua:
function onThink(interval)
monsters = {"Demon", "Dragon" }
map_2 = {
{x=205, y=220, z=7}, 
{x=216, y=220, z=7}
}

if getWorldCreatures(0) == 0 then
print ("[MAP] No players online, aborting summon!")
return true
else
	RDM = math.random(#monsters)
	RDP2 = math.random(#map_2)

	for _, tid in ipairs(getPlayersOnline()) do				
	doPlayerSendChannelMessage(tid, "", "Summoning the " ..monsters[RDM].. " in the map.", TALKTYPE_CHANNEL_Y, 99)
	end
	
	if getGlobalStorageValue(3454) == 2 then
	doCreateMonster(monsters[RDM], map_2[RDP2])
	end
end
return true
end

Friend worked, thanks! rep + for you :)
 
Back
Top