Hey... I create little GATE and i want to Teleport player to different surface When he enter this gate
I have 10 x 6 Zone and if Player enter this Zone i want to teleport him to position on other Surface lol
Teleport Player?
Re: Teleport Player?
Yeee... but how to detect when Player enter this Zone and how i actualy use it ?
Re: Teleport Player?
https://lua-api.factorio.com/latest/eve ... d_position
https://lua-api.factorio.com/latest/Lua ... l.position
https://lua-api.factorio.com/latest/Lua ... ol.surface
Start getting accustomed to searching the API doc. The sooner you get used to how it is structured and get an idea what is in it, the more freedom you have while modding.
https://lua-api.factorio.com/latest/Lua ... l.position
https://lua-api.factorio.com/latest/Lua ... ol.surface
Start getting accustomed to searching the API doc. The sooner you get used to how it is structured and get an idea what is in it, the more freedom you have while modding.
Re: Teleport Player?
Take the item from the ground, you get the event.
Or press key to get event, on that you can check the position of the player.
Or press key to get event, on that you can check the position of the player.
Re: Teleport Player?
You can add keys in data.lua: (code from https://mods.factorio.com/mod/OmniCar)
Code: Select all
data:extend ({
{
type = "custom-input",
name = "go-north",
key_sequence = "UP",
action = "lua"
},
{
type = "custom-input",
name = "go-east",
key_sequence = "RIGHT",
action = "lua"
},
{
type = "custom-input",
name = "go-south",
key_sequence = "DOWN",
action = "lua"
},
{
type = "custom-input",
name = "go-west",
key_sequence = "LEFT",
action = "lua"
}
})
Code: Select all
for i, go_direction in pairs ({'go-north', 'go-east', 'go-south', 'go-west'}) do
script.on_event(go_direction, function(event)
local player = game.players[event.player_index]
local orientation = (i-1)/4 -- 0 to 1
move_to (player, orientation, go_direction) -- your function
end)
end
Re: Teleport Player?
thx bro