Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

so theoretically he could have the level he just beat change a variable, and if a = 1 then player teleport whatev, if a = 2 then player teleport whatever els

Hm, worth to try! 

I will try this next time i can work on the game. Thanks man.

(4 edits)

So, i tried to use variables in the map scripts.

The game just crashes on loading the second map.

Script in first map:

global.value=1


second map:

if $global.value == 1 {

player teleport 5 24}

map return



EDIT:

Forget it. i had a wrong formating.

But even with the right formating, it does not teleport the player to the coordiantes.


second map:

if $global.value == 1 {

player teleport 5 24

}

map return


Last EDIT:

So, i figured it out. but its kind of janky.

Hub map has NOTHING in the map script an NO player start!

load the map, without start object and figure out the rough location (sadly its not x0 y0 more between x3 y3 and x4 y4).

Put some triggers at that coordiantes with a script like this:

player teleport 5 24 //initial starting position

if $global.value == 1 { //global variable is set in the second map

player teleport 19 4 //position of the player after exiting second map

}

map return

In my case the Map i want to go to and back to the hub is a bar.

In the map script of the bar set  the global variable to 1

global.value=1


Put a trigger at the exit of the bar to load the Hub map.

I haven't touched scripts in a while. I think there was a problem with coordinates which should be fixed in the newest unreleased version.

Will be updated.

Someday.