I want to teleport my platform that reached Shattered Planet back home rather than waiting for it to fly back. Rsedding mentioned teleporting platforms in a post awhile back, so I believe it is possible, but I couldn't find an example of how to do it. I assume it's something like game.platform("platformname or id").teleport(<some way to identify Nauvis orbig>)?
I would really rather not run for 10+ more hours at 20 UPS which is the best this system can do while it manages a bajillion asteroid chunks around the returning ship.
How do I teleport a platform?
Re: How do I teleport a platform?
Code: Select all
game.surfaces[pid].platform.space_location=game.planets.nauvis.prototype
Re: How do I teleport a platform?
Thanks for the reply.
What is the platform pid?
I tried a variety of things including the "platform-8" displayed in the editor surfaces tab and got a variety of errors, including some stuff about something being read only...
What is the platform pid?
I tried a variety of things including the "platform-8" displayed in the editor surfaces tab and got a variety of errors, including some stuff about something being read only...
Re: How do I teleport a platform?
Not sure whether there is a simpler way, but this works:
where foobar is the platform's name.
But as this returns platform-N, I would have expected the platform-8 you tried to work (that is, pid="platform-8").
Code: Select all
pid = (function(platformname) for surface_name, surface in pairs(game.surfaces) do if surface.platform and surface.platform.name == platformname then return surface_name end end end)("foobar")
But as this returns platform-N, I would have expected the platform-8 you tried to work (that is, pid="platform-8").
Re: How do I teleport a platform?
When I used "platform-8" it gave this error:
Lua_SpacePlatform::space_location is read only.
I thought it might be because I was hosting in multiplayer but I got the same error when I loaded it up single player. Is there some extended cheating mode I need to enable?
Lua_SpacePlatform::space_location is read only.
I thought it might be because I was hosting in multiplayer but I got the same error when I loaded it up single player. Is there some extended cheating mode I need to enable?
Re: How do I teleport a platform?
You need to be on the experimental branch to set the location as writing was only added in 2.0.34. Stable is still only using 2.0.32 which won't let you write it.Phleem wrote: Tue Feb 25, 2025 9:37 pm When I used "platform-8" it gave this error:
Lua_SpacePlatform::space_location is read only.
I thought it might be because I was hosting in multiplayer but I got the same error when I loaded it up single player. Is there some extended cheating mode I need to enable?