Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SCRIPT]Change to specific random map
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#4
RE: [SCRIPT]Change to specific random map

You'll want to use the RandInt(int, int) function, there you can set the range to pick from (say, RandInt(1, 3), then you can append that to the name of the map you want to change to.

For example (this will need to be inside a function)

int MapNum = RandInt(1, 3);
ChangeMap("Path_" + MapNum, .... etc);


That is, very basically, a way to get a random map to jump to - you'll need to be careful with the names of maps (so that they are all Path_1, Path_2 etc) and also the names of the start positions will have to be the same since you need to provide the ChangeMap function with the name of the start pos.

You'll probably run into problems in keeping a record of which maps you have already been to, you should be able to do this with global variables but it would be best to use an array, but I'm not sure how arrays behave in the global script yet so I won't give you advice on that Smile

EDIT: Ninja'd, but the problem with only using a variable for which map you've been to is as you say, if 2 gets picked then you are buggered. Also, global variables as far as I understand get wiped if the player saves/exits/restarts, so its kinda dangerous
(This post was last modified: 11-19-2012, 05:55 PM by Adrianis.)
11-19-2012, 05:53 PM
Find


Messages In This Thread
RE: [SCRIPT]Change to specific random map - by Adrianis - 11-19-2012, 05:53 PM



Users browsing this thread: 1 Guest(s)