• Sign up for September Mapping Competition! The prize includes Otland Premium time.
  • 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 auto respawn boss every 12 hours needed

equero

New Member
Joined
Feb 22, 2013
Messages
40
Best answers
0
Reaction score
1
Hello. I need a script that will automatically spawn the boss every 720 minutes. From on x, y,z coordinates
or something like that.
From 12.00 to 24.00

TFS 0.3.6 8.6
 

M0ustafa

1337
Premium User
Support Team
Joined
Mar 4, 2017
Messages
2,066
Best answers
262
Reaction score
802
Location
Egypt
So you want it to spawn on exact position or on a random area between 2 positions? and is it every 720 mint or from 12:00 to 24:00?
 
OP
equero

equero

New Member
Joined
Feb 22, 2013
Messages
40
Best answers
0
Reaction score
1
@M0ustafa beetween 12:00 and 24:00 for example in position 1000,1000,7. no random area.
 

M0ustafa

1337
Premium User
Support Team
Joined
Mar 4, 2017
Messages
2,066
Best answers
262
Reaction score
802
Location
Egypt
Try this in your globalevents not sure if time can work like this on 0.3.6 or you'll have to create 2 scripts or a raid to spawn it twice.
XML:
<globalevent name="Bosses" time="24:00:00-12:00:00" script="bosses.lua" />
Lua:
local pos = {x = 1000, y = 1000, z = 7}

function onTimer(interval)
     local boss = bossnamehere
     doCreateMonster(boss, pos)
     doBroadcastMessage(boss.." has spawned.", MESSAGE_STATUS_WARNING)
     return true
end
If it didn't work try changing
XML:
time="24:00:00-12:00:00"
to
XML:
time="24:00:00"
 
OP
equero

equero

New Member
Joined
Feb 22, 2013
Messages
40
Best answers
0
Reaction score
1
ohmyyy.. Thank you. I'll try
 

M0ustafa

1337
Premium User
Support Team
Joined
Mar 4, 2017
Messages
2,066
Best answers
262
Reaction score
802
Location
Egypt
XML:
<globalevent name="Bosses" time="12:00:00" script="bosses.lua" />
Just change the time to 5 mints from now and wait 5 mints to see.
 
OP
equero

equero

New Member
Joined
Feb 22, 2013
Messages
40
Best answers
0
Reaction score
1
XML:
<globalevent name="Bosses" time="00:05:00" script="bosses.lua" />
Lua:
local pos = {x = 1183, y = 880, z = 7}

function onTimer(interval)
     local boss = Elamazon
     doCreateMonster(boss, pos)
     doBroadcastMessage(boss.." has spawned.", MESSAGE_STATUS_WARNING)
     return true
end
nothing happens still. idk maybe should i add monster in ME first? but I do not see any sense
Post automatically merged:

@M0ustafa
data/globalevents/scripts/bosses.lua:onTimer
Description:
(luaDoCreateMonster) Monster with name '' not found

[Error - GlobalEvent Interface]
data/globalevents/scripts/bosses.lua:onTimer
Description:
data/globalevents/scripts/bosses.lua:6: attempt to concatenate local 'boss' (a nil value)
stack traceback:
data/globalevents/scripts/bosses.lua:6: in function <data/globalevents/scripts/bosses.lua:3>
[Error - GlobalEvents::timer] Couldn't execute event: Bosses

But monster exist.. i have tried to spawn by command /m and he appears
 
Last edited:

M0ustafa

1337
Premium User
Support Team
Joined
Mar 4, 2017
Messages
2,066
Best answers
262
Reaction score
802
Location
Egypt
Try this
Lua:
local pos = {x = 1183, y = 880, z = 7}

function onTimer(interval)
     local boss = Elamazon
     doCreateMonster("Elamazon", pos, false, true)
     doBroadcastMessage(boss.." has spawned.", MESSAGE_STATUS_WARNING)
     return true
end
 
OP
equero

equero

New Member
Joined
Feb 22, 2013
Messages
40
Best answers
0
Reaction score
1
@M0ustafa nothing happens. no idea
Post automatically merged:

@M0ustafa After idk about 10 mins (in console) i have found same error.

[Error - GlobalEvent Interface]
data/globalevents/scripts/bosses.lua:eek:nTimer
Description:
(luaDoCreateMonster) Monster with name '' not found

[Error - GlobalEvent Interface]
data/globalevents/scripts/bosses.lua:onTimer
Description:
data/globalevents/scripts/bosses.lua:6: attempt to concatenate local 'boss' (a nil value)
stack traceback:
data/globalevents/scripts/bosses.lua:6: in function <data/globalevents/scripts/bosses.lua:3>
 
Last edited:

Rombadr

Premium User
Premium User
Joined
Jan 19, 2020
Messages
194
Best answers
22
Reaction score
124
Wrap the boss name around quotes ("), "Elamazon" instead of just Elamazon
 

M0ustafa

1337
Premium User
Support Team
Joined
Mar 4, 2017
Messages
2,066
Best answers
262
Reaction score
802
Location
Egypt
If it still doesn't work then maybe try a raid, data\raids and create a script with this
XML:
<?xml version="1.0" encoding="utf-8"?>
<raid>
    <singlespawn delay="1000" name="Elamazon" x="1183" y="880" z="7" />
    <announce delay="1000" type="event" message="Elamazon has spawned!" />
</raid>
then add this to data\raids\raids.xml
XML:
<raid name="Elamazon" file="Elamazon.xml" interval2="30" margin="1000" enabled="yes"/>
then in data\globalevents\scripts add this
Lua:
function onTime()
    doExecuteRaid(Elamazon)
    return true
end
and in data\globalevents\globalevents.xml add this and change the time to test it.
XML:
<globalevent name="Raid" time="23:59:59" event="script" value="Raidexecute.lua"/>
Or I think you can only add this line without the raid execute Lua script like this.
XML:
<globalevent name="Elamazon" time="20:00:00" event="buffer" value="doExecuteRaid('Elamazon')"/>
 

Sir Sezago

Scripter/Developer
Joined
Aug 28, 2017
Messages
325
Best answers
1
Reaction score
35
What about rme ..
Just set respawn time to
720*60
 
OP
equero

equero

New Member
Joined
Feb 22, 2013
Messages
40
Best answers
0
Reaction score
1
If it still doesn't work then maybe try a raid, data\raids and create a script with this
XML:
<?xml version="1.0" encoding="utf-8"?>
<raid>
    <singlespawn delay="1000" name="Elamazon" x="1183" y="880" z="7" />
    <announce delay="1000" type="event" message="Elamazon has spawned!" />
</raid>
then add this to data\raids\raids.xml
XML:
<raid name="Elamazon" file="Elamazon.xml" interval2="30" margin="1000" enabled="yes"/>
then in data\globalevents\scripts add this
Lua:
function onTime()
    doExecuteRaid(Elamazon)
    return true
end
and in data\globalevents\globalevents.xml add this and change the time to test it.
XML:
<globalevent name="Raid" time="23:59:59" event="script" value="Raidexecute.lua"/>
Or I think you can only add this line without the raid execute Lua script like this.
XML:
<globalevent name="Elamazon" time="20:00:00" event="buffer" value="doExecuteRaid('Elamazon')"/>
It works o_O
But do i need allways type /raid or only once?
Anyway thank you! @M0ustafa
 

M0ustafa

1337
Premium User
Support Team
Joined
Mar 4, 2017
Messages
2,066
Best answers
262
Reaction score
802
Location
Egypt
If you added the globalevents line with a specified time then it will do it auto at same time daily.
 

Sir Sezago

Scripter/Developer
Joined
Aug 28, 2017
Messages
325
Best answers
1
Reaction score
35
If you added the globalevents line with a specified time then it will do it auto at same time daily.
But if none kill it i think it will respawn or u have to check if there are monsters in the room or no because if 5 days of respawns means 5 bosses
 
Top