Random Space

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
Sky_216
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2086
Joined: Mon Feb 13, 2006 3:28 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Random Space

Post by Sky_216 »

This is for a space map i'm making.....
Now, space maps are fun, but its seems a little pointless filling up the IA box with a whole list of maps with different layouts and skys (what I'm doing). So I'd like to have the sky's used random (I've got 7 atm, making more) but also have random ship layout/space objects(asteroids, junk).


1) Loading random sky files:
I know how its possible to load different skys, I just need to know the code you use to make them random.


2) Loading random layouts.
Well here's the harder one.....is it possible (while keeping online compatible) to have the lua or addme.lua load a random layout (eg a random layer)? Or to have one mode/era load a random map (ie one out of four maps, all with a different layout)?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Random Space

Post by Maveritchell »

In no particular order:

You can generate random numbers with math.random(integervalue). Moving on from there is easy. Sky .lvl files are loaded in the mission .lua, not the addme, so you can load random skies by-the-mission if you want. Random skies do not break online compatibility (they are just a visual change).

If you load random maps in the addme or random map layers in the mission .lua, you will break online compatibility.
Grev
Hoth Battle Chief
Hoth Battle Chief
Posts: 3132
Joined: Sun Dec 09, 2007 11:45 pm
Projects :: No Mod project currently.
Games I'm Playing :: Minecraft
Location: A Certain Box Canyon

Re: Random Space

Post by Grev »

For the first question, I think you'd have to use the math( function (not sure how to script it or how it works), since this function works for choosing random loadscreens.
As for the random layouts, changing the layout for mode would be easy per mode. Just change what lvl it calls for. As for random layouts for the same mode, it'd be harder.

Looks like Mavs got it. ^
Post Reply