Solarus-Games English Forum

Solarus => Development => Topic started by: Minefran12 on February 03, 2018, 08:52:24 PM

Title: Conecting teleporters with scripts.
Post by: Minefran12 on February 03, 2018, 08:52:24 PM
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.
Title: Re: Conecting teleporters with scripts.
Post by: Diarandor on February 03, 2018, 10:21:21 PM
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.
Title: Re: Conecting teleporters with scripts.
Post by: Minefran12 on February 03, 2018, 10:31:58 PM
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.
Title: Re: Conecting teleporters with scripts.
Post by: Diarandor on February 04, 2018, 12:44:48 AM
If all is in 1 map, you should probably use separators instead.
Title: Re: Conecting teleporters with scripts.
Post by: Christopho on February 04, 2018, 09:02:20 AM
Teletransporters have a scripting API that allows to configure them from a Lua script.
Title: Re: Conecting teleporters with scripts.
Post by: 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.
Title: Re: Conecting teleporters with scripts.
Post by: Diarandor on February 04, 2018, 11:37:35 AM
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