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

[globalevent] gate

Scooty

Enemia.EU
Joined
Jul 24, 2010
Messages
564
Reaction score
14
Location
Kraków
Hi! Can someone write this globalevent?

1.When globalevent start item with unique ID or action ID will remove(this item will be gate)
2.Gate came back(re-spawn) in 2 minutes.
3.After 10 minutes(from first point(remove gate) players who are in pos:

from:100,100,7
to:200,200,7

Will be teleported to temple.


@sorry for my english ;(
 
make the verible getThingFromPos after the function. ( that incase if there server crash on loading script)
Then "local getGate " must be after the onThink function.

Try this :
LUA:
local gatePos = {x=1029,y=1009,z=7,stackpos=253} -- gatepos

local fromPos,toPos = {x=1026,y=1010,z=7},{x=1031,y=1011,z=7} -- Area

local gateID = 1547 --- change itemid.

function onThink(pos,interval)
local getGate = getThingFromPos(gatePos)
 local function spawnGate(pos)
    setGlobalStorageValue(1650,0)
    doCreateItem(gateID,1,gatePos)
	doBroadcastMessage('The gate has been respawned')
  
end

local function teleportPlayers(pos)
 players = getPlayersOnline()
    for _,pid in ipairs(players) do
        if isInRange(getThingPos(pid),fromPos,toPos) then
            doTeleportThing(pid,getPlayerMasterPos(pid))
        end
    end
    
end 

local function doRemoveGate(pos)
    doBroadcastMessage('The gate has been removed for 2 minutes.')
    setGlobalStorageValue(1650,1)
    addEvent(spawnGate,2*60*1000)
     doRemoveItem(getGate.uid)
end

    addEvent(doRemoveGate,1*1000)
    addEvent(teleportPlayers,10*60*1000)
	return true
end
 
Last edited:
Back
Top