Conecting teleporters with scripts.

Started by Minefran12, February 03, 2018, 08:52:24 PM

Previous topic - Next topic
I have to conect more than 100 teleporters with their destination and i was wondering if i can do it with the scripts of the map insted of manualy in each teleporter.

The usual way to do this is to choose the destination directly from the Map Editor. You can also do it in the map script if you prefer, but the previous option is usually much better: it is easier/faster to find that option in the properties window than to look into the code of a script. However, if you are generating maps randomly, you should probably choose these properties from your code.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

I'm not generating aleatory maps, in fact this is for a laberint puzzle with 24 rooms and exactly 90 teleporters and destinations and beaouse is all the same map i will prefer to do it by code to have it more accessible to change, but i looked in the teleporter documents and i didin't find how to do it.

If all is in 1 map, you should probably use separators instead.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Teletransporters have a scripting API that allows to configure them from a Lua script.

I'm already using separators, but i think the feeling of being lost is bigger and easier to maka with the teleporters and it makes the puzle harder to solve.
Can someone say me the coding to configure them?
Thank you.

Quote from: Minefran12 on February 04, 2018, 11:15:01 AM
I'm already using separators, but i think the feeling of being lost is bigger and easier to maka with the teleporters and it makes the puzle harder to solve.
Can someone say me the coding to configure them?
Thank you.
Just read the Lua API:
http://www.solarus-games.org/doc/1.5/lua_api_teletransporter.html
http://www.solarus-games.org/doc/1.5/lua_api_separator.html
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."