Unit Randomization
Moderator: Moderators
- wishihadaname
- Captain

- Posts: 493
- Joined: Fri Dec 28, 2007 2:10 pm
- Projects :: The Corellian Resistance
- Location: Look to your left.... no, your other left....
Unit Randomization
I came up with this concept though i'm not sure how exactly I could get it to work. I am currently making a map set during the early years of the empire, before the rebel alliance had formed. My rebel faction is a mix of Koda's militia, corellian villagers, and clone wars era deserters. None of them have standard uniform. I was wondering if it was possible to create 5 or 6 different skins for each class (there will only be 3) and then have the game randomly assign those skins to the player upon spawning? The hypothetical approach would be to have the game do a random number roll between 1 and 6 and then have it assign a skin based on the number it rolled. So the code would have to work like
on unit spawn-> random number roll between 1 and 6-> if this number then this skin-> end.
The class selection pannel would be kinda funky since the skins would change every time a unit spawned but I could deal with that.
So does anyone know how exactly to script this? is it even possible?
on unit spawn-> random number roll between 1 and 6-> if this number then this skin-> end.
The class selection pannel would be kinda funky since the skins would change every time a unit spawned but I could deal with that.
So does anyone know how exactly to script this? is it even possible?
- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: Unit Randomization
yes, it reuires some "heavy" scripting though. it would require to get the players matrix, kill him, get a random number, force him to spawn as the unit with the random number and spawn/teleport him on the old matrix.
-
kinetosimpetus
- Imperial Systems Expert

- Posts: 2381
- Joined: Wed Mar 25, 2009 4:15 pm
- Projects :: A secret project
Re: Unit Randomization
Try this: http://www.gametoast.com/forums/viewtop ... 89#p390689
EDIT: In action: http://www.xfire.com/video/270137/
EDIT: In action: http://www.xfire.com/video/270137/
- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: Unit Randomization
so it randomiues the models independendly from spawning? thats a cool way to do it!
- wishihadaname
- Captain

- Posts: 493
- Joined: Fri Dec 28, 2007 2:10 pm
- Projects :: The Corellian Resistance
- Location: Look to your left.... no, your other left....
Re: Unit Randomization
So by just adding that script and then defining the models I could get this to work? Interesting. The default is set to 2 skins, will it handle 6? Also is this a change in skins or can I change the geometry too?
- DarthD.U.C.K.
- Master of the Force

- Posts: 6027
- Joined: Wed Sep 27, 2006 11:05 am
- Location: Duckburg, Germany
Re: Unit Randomization
it is a geometrychange hence the " SetClassProperty("zahn_inf_rifleman", "GeometryName"").
you can have as many variations as you want, but remember that you need a new model for every skin (if they dont support overridetexture).
you can have as many variations as you want, but remember that you need a new model for every skin (if they dont support overridetexture).
-
kinetosimpetus
- Imperial Systems Expert

- Posts: 2381
- Joined: Wed Mar 25, 2009 4:15 pm
- Projects :: A secret project
Re: Unit Randomization
See this post (lower down in the same topic) for a couple limitations: http://www.gametoast.com/forums/viewtop ... 75#p391475
Looks like override texture wont work properly.
Looks like override texture wont work properly.
- wishihadaname
- Captain

- Posts: 493
- Joined: Fri Dec 28, 2007 2:10 pm
- Projects :: The Corellian Resistance
- Location: Look to your left.... no, your other left....
Re: Unit Randomization
ok thanks. I don't plan on variating the clone deserters models, i'll just give them paint jobs from different legions and hex edit a fresh msh for each of them. However, I was planning on using different models for kota's men and the civilians anyways so this should work perfectly. Just one more question though, it looks like the code segment only applies to one unit class. How do I change it to make it work for three separate classes?
-
kinetosimpetus
- Imperial Systems Expert

- Posts: 2381
- Joined: Wed Mar 25, 2009 4:15 pm
- Projects :: A secret project
Re: Unit Randomization
Hidden/Spoiler:
-
THEWULFMAN
- Space Ranger
- Posts: 5557
- Joined: Tue Aug 17, 2010 3:30 pm
- Projects :: Evolved 2
- Location: Columbus, Ohio
- Contact:
Re: Unit Randomization
This is so awesome, i have to try this out
great job kineto
great job kineto
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: Unit Randomization
The problem with this is - besides lack of uniformity, which is really almost desirable - the fact that doing something like this on a large scale eats up a lot of space for a trivial change. It's nonessential, and, in a sides mod, it can easily triple or quadruple the size of a side. It's a fun thought experiment - I know I've considered using something like this before - but it's easy to toss aside since it runs pretty well into a practicality barrier.
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: Unit Randomization
I've used this experimentally with Rebels and it was useful, but like Mav said you can get file-heavy with little return. All I did was have several models which mapped to the same body texture, but different face textures. That let me have different looking riflemeans, rocketeers, etc for little file space (since models are small as are face textures). If you're wanting to do something like this I highly recommend that you don't go nuts. A few textures is fine, but if it adds 20mb to the download a lot of folks will definitely say "not interested".
- wishihadaname
- Captain

- Posts: 493
- Joined: Fri Dec 28, 2007 2:10 pm
- Projects :: The Corellian Resistance
- Location: Look to your left.... no, your other left....
Re: Unit Randomization
would three completely different models for kota's militia, three phase 1 clone troopers with different legion paintjobs, and i'm still hoping for 6ish civilian models be ok? The civilians will be based off of two models (the three skin variations of the cultist model from this website and three han solo's with his face and cloths re-painted). I don't really want to cut back on the civilians because they are supposed to be an angry mob of correllian hill folk, not any sort of organised military group. What do you guys think would be the best approach? I can live with just standard white clone deserters, maybe have them blot out legion symbols with the correlian resistance symbol i've come up with, and kota's melitia could just have one uniform but i'm kinda perplexed on how to make a civilian mob.
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: Unit Randomization
You won't really know the "cost" of in megabytes until you munge it.
- wishihadaname
- Captain

- Posts: 493
- Joined: Fri Dec 28, 2007 2:10 pm
- Projects :: The Corellian Resistance
- Location: Look to your left.... no, your other left....
Re: Unit Randomization
Alright, i'll give this code a try and if it comes out with more then 5mb of extra total then i'll probably just make the mob as a local team and have six units from kota's men and the deserters as the player team.
