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

RevScripts Game.createItem

peteralto

Member
Joined
Nov 1, 2020
Messages
93
Solutions
1
Reaction score
17
I have an event, and when starting it creates an access portal.

It has a determined coordinate. I wish I could create more than one teleport at the same time. Below is an excerpt of the code:

Lua:
EventX = {  
    teleportPosition = Position(32364, 32232, 7),
    teleportActionId = 41391
}

local ITEM_TELEPORT = 1387

function EventX:open()
                                      local item = Game.createItem(ITEM_TELEPORT, 1, self.teleportPosition)
                                      item:setAttribute('aid', self.teleportActionId)
    return true
end
 
Solution
Lua:
EventX = {
    teleports = {
        Position(32364, 32232, 7),
        Position(32364, 32232, 7),
        Position(32364, 32232, 7),
        
    },
    teleportActionId = 41391
}

local ITEM_TELEPORT = 1387

function EventX:open()
    for i = 1, #self.teleports do
        ITEM = Game.createItem(ITEM_TELEPORT, 1, self.teleports[i])
        ITEM:setAttribute('aid', self.teleportActionId)
    end
    return true
end

i'm a bit drunk sotest it out
Lua:
EventX = {
    teleports = {
        Position(32364, 32232, 7),
        Position(32364, 32232, 7),
        Position(32364, 32232, 7),
        
    },
    teleportActionId = 41391
}

local ITEM_TELEPORT = 1387

function EventX:open()
    for i = 1, #self.teleports do
        ITEM = Game.createItem(ITEM_TELEPORT, 1, self.teleports[i])
        ITEM:setAttribute('aid', self.teleportActionId)
    end
    return true
end

i'm a bit drunk sotest it out
 
Solution
Lua:
EventX = {
    teleports = {
        Position(32364, 32232, 7),
        Position(32364, 32232, 7),
        Position(32364, 32232, 7),
       
    },
    teleportActionId = 41391
}

local ITEM_TELEPORT = 1387

function EventX:open()
    for i = 1, #self.teleports do
        ITEM = Game.createItem(ITEM_TELEPORT, 1, self.teleports[i])
        ITEM:setAttribute('aid', self.teleportActionId)
    end
    return true
end

i'm a bit drunk sotest it out
Thank you for your skills while being drunk. It worked!
 
Back
Top