• 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, BOSS Respaw every 2 Hours.

willks123

New Member
Joined
Dec 31, 2012
Messages
65
Reaction score
2
I need a script that does the following:

The Boss appears in a certain coordinate (X Y Z) every 2 hours.
But if no one kills him before 2 o'clock ... he be removed.
So that when it gives the 2 hours another one appears.

I do not want more than 1 boss in the room.

Thank you for helping me.
 
This is not tested nor will work. Its just an idea. With not much more effort should work.
Create a globalevent with this code set time 2 hours and you are done.

Code:
function killmonster(creature)
     creature:remove
end

funcontion onThink(interval)
     local creature = Creature(cid)
     Game.createMonster(monsterName, position)
     addEvent(killmonster, 2 * 60 * 1000, creature.uid)
     return true
end
 
using addEvent without check if the parameter exist some times cause crash in the .exe
also, why create variable creature without relation with the monster?
Code:
function killmonster(creature)
     if creature ~= nil then
        creature:remove()
    end
    o-- or you can try use it
    if creature then
        creature:remove()
    end
end

funcontion onThink(interval)
     local creature = Game.createMonster('demon', Position(x, y, z))
     addEvent(killmonster, 2 * 60 * 1000, creature)
     return true
end
here my idea, test it pls
 
using addEvent without check if the parameter exist some times cause crash in the .exe
also, why create variable creature without relation with the monster?
Code:
function killmonster(creature)
     if creature ~= nil then
        creature:remove()
    end
    o-- or you can try use it
    if creature then
        creature:remove()
    end
end

funcontion onThink(interval)
     local creature = Game.createMonster('demon', Position(x, y, z))
     addEvent(killmonster, 2 * 60 * 1000, creature)
     return true
end
here my idea, test it pls
Don't work... My Server is OTXserv 11.49

1zn97qo.jpg
 
The things that @silveralol is trying to say its that you use:
Lua:
function killmonster(creature)
     if creature ~= nil then
        creature:remove()
    end
end

Or this:

Lua:
function killmonster(creature)
    if creature then
        creature:remove()
    end
end

Not both in the same script...
 
and why the 'o' at líne 6?
For that reason, the problem on his server, he just copied the code and pasted and not remove the 'o' on líne 6, thats the reason I divided on 2 if statements
 
and why the 'o' at líne 6?
For that reason, the problem on his server, he just copied the code and pasted and not remove the 'o' on líne 6, thats the reason I divided on 2 if statements
my bad, the "o" was an intruder, but any noob can see that and remove it D:
 
I know, but the new ppl on scripting, will not see it, maybe they can think: 'the script is working', and they just copy and paste it, like @willks123 (just as new on scripting), and I just try to help, regards
 
Back
Top