Randomly select units each time you play? [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
666rulerofclones
Command Sergeant Major
Command Sergeant Major
Posts: 281
Joined: Fri Aug 08, 2008 1:30 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: The Badger State!

Randomly select units each time you play? [Solved]

Post by 666rulerofclones »

i was wondering how mav in his recent Aquaralis (hope i spelled it right :D) Deep Sea map, the function of how it would randomly select one of the Convopack units each time you played Clone Wars Conquest. If he spills the beans, it should be placed in the FAQ thread! (im sure that its some sorta .lua function or something).

Topic renamed to help the search -Staff
Aman/Pinguin
Jedi
Jedi
Posts: 1104
Joined: Tue Jan 30, 2007 6:04 am
Projects :: Inactive
Location: Germany

Re: how does mav do it?

Post by Aman/Pinguin »

He uses the "math.random()" function.

math.random(SmallestPossibleNumber,BiggestPossibleNumber)

I think you can figure out the rest yourself...

Hidden/Spoiler:
An example:

I use this for random loadscreens in my map Tuskencamp (Not the released version).
I have 7 files in my load folder: PTC1.lvl, PTC2.lvl, PTC3.lvl,...you got it.


[code] loadscreenrandom = math.random(1,7)
ReadDataFile("dc:Load\\PTC" .. loadscreenrandom .. ".lvl")[/code][/size]
Master_Ben
Lieutenant General
Lieutenant General
Posts: 675
Joined: Wed Nov 12, 2008 9:50 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Watching your PC over your shoulder. No, the other sholder....

Re: how does mav do it?

Post by Master_Ben »

Ooh very clever Aman/Pinguin.
User avatar
666rulerofclones
Command Sergeant Major
Command Sergeant Major
Posts: 281
Joined: Fri Aug 08, 2008 1:30 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: The Badger State!

Re: Randomly select units each time you play?

Post by 666rulerofclones »

thanks guys, ill try it out.

STAFF: thanks for renaming it although i couldnt find the topic and had to look for my name under the "author" section lol :lol:
Post Reply