Page 1 of 1
How to teleport?
Posted: Tue May 24, 2016 7:40 am
by Rongor
Hey guys,
what would be the most convenient to relocate a unit in a running scenario by a script? What LUA functions would be used for that?
Only idea I came up with so far is to kill the present unit and than spawn (addunit) it anew at the desired location. Is that the (only) way to go here?
In particular, I want to teleport docked units out of their pier facility to a location anywhere at sea around the globe.
RE: How to teleport?
Posted: Tue May 24, 2016 8:06 am
by Gunner98
An event with 3 actions and triggered with either a 'unit enters area' or 'unit remains in area' trigger.
Before you set up the actions create another 'side' which is blind and not aligned to anyone. Go to that side with 'Gods Eye' on.
Set up an area across the globe in that blind side.
Actions:
Teleport: The unit in question to the area on the blind side
Lua: Change the unit to that blind side
ScenEdit_SetUnitSide({side='original side', name='of unit', newside='blind side'})
Message: to tell the player that it happened
B
RE: How to teleport?
Posted: Tue May 24, 2016 8:25 am
by Rudd
Curious why you change the unit to the 'blind side'?
RE: How to teleport?
Posted: Tue May 24, 2016 8:30 am
by USSInchon
ORIGINAL: Rudd
Curious why you change the unit to the 'blind side'?
so that it is hidden on the map and not distracting to the player wondering why there is this object on the far side of the globe.
RE: How to teleport?
Posted: Tue May 24, 2016 8:38 am
by Gunner98
Exactly. And in your message you can tell whatever story you like and it's more believable. Also this is better (in my mind) than Lua Delete unit, because it makes it easier to return the unit into play if you like at a later point (i.e. a minor stay in dry dock for several days etc).
Thinking about the original post. Lua Delete would be quickest: ScenEdit_DeleteUnit({side='original side', name='of unit'})
B
Edit: I am not a Lua Guru, if you need help I would check with CK, Kushan or Baloogan and probably a few others.
B
RE: How to teleport?
Posted: Tue May 24, 2016 8:49 am
by Rudd
Got it, I see what you guys are saying and agree. I just didn't see that intent in the OP, just sounded like a simple teleport to me when I read it[:)]