Unit Randomization

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
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Unit Randomization

Post by wishihadaname »

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?
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Unit Randomization

Post by DarthD.U.C.K. »

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
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Unit Randomization

Post by kinetosimpetus »

User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Unit Randomization

Post by DarthD.U.C.K. »

so it randomiues the models independendly from spawning? thats a cool way to do it!
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: Unit Randomization

Post by wishihadaname »

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?
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Unit Randomization

Post by DarthD.U.C.K. »

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).
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Unit Randomization

Post by kinetosimpetus »

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.
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: Unit Randomization

Post by wishihadaname »

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
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Unit Randomization

Post by kinetosimpetus »

Hidden/Spoiler:
if (skin ==1) SetClassProperty("[insert class A here]", "GeometryName", "zahn_inf_tantive4trooper")
SetClassProperty("[insert class A here]", "GeometryLowRes", "zahn_inf_tantive4trooper_low1")

SetClassProperty("[insert class B here]", "GeometryName", "zahn_inf_tantive9trooper")
SetClassProperty("[insert class B here]", "GeometryLowRes", "zahn_inf_tantive9trooper_low1")

SetClassProperty("[insert class C here]", "GeometryName", "zahn_inf_tantive7trooper")
SetClassProperty("[insert class C here]", "GeometryLowRes", "zahn_inf_tantive7trooper_low1")
end
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: Unit Randomization

Post by THEWULFMAN »

This is so awesome, i have to try this out :D :thumbs:
great job kineto
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Unit Randomization

Post by Maveritchell »

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.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Unit Randomization

Post by Teancum »

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".
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: Unit Randomization

Post by wishihadaname »

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.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Unit Randomization

Post by Teancum »

You won't really know the "cost" of in megabytes until you munge it.
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: Unit Randomization

Post by wishihadaname »

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.
Post Reply