Page 1 of 2

Randomizing soldier uniforms

Posted: Tue May 11, 2010 1:29 pm
by Senshi
Well, this is just an idea that occurred to me, but I've never seen it in any mod.

In BF42 soldiers are uniquely defined for a team. Meaning, all soldiers in a team are "clones". However, there are existing variations (e.g. in Vanilla three different faces). The very same should be applicable to the soldiers' body, that is defining the body uniform. This would mean you could make a team use different uniforms for its soldiers, independent from the kits chosen. I think it would be nice to have some variation there, perfomance drawback is minimal and it would be a fancy visual plus.

How to? This would be the way to do it (not tested):
HungarianSoldier\geometries.con
GeometryTemplate.create AnimatedMesh Soldier/3PHunBody1
GeometryTemplate.setSkin animations/GerBody.skn
GeometryTemplate.file Ger1Body
GeometryTemplate.setLodRange 0 0 1 30 2 80
GeometryTemplate.setLodRange 3 150 4 210 5 230
GeometryTemplate.setLodPercent 0 1.0
GeometryTemplate.setLodPercent 1 0.7
GeometryTemplate.setLodPercent 2 0.3
GeometryTemplate.setLodPercent 3 0.2
GeometryTemplate.setLodPercent 4 0.1
GeometryTemplate.setLodPercent 5 0.05

GeometryTemplate.create AnimatedMesh Soldier/3PHunBody2
GeometryTemplate.setSkin animations/GerBody.skn
GeometryTemplate.file Ger2Body
GeometryTemplate.setLodRange 0 0 1 30 2 80
GeometryTemplate.setLodRange 3 150 4 210 5 230
GeometryTemplate.setLodPercent 0 1.0
GeometryTemplate.setLodPercent 1 0.7
GeometryTemplate.setLodPercent 2 0.3
GeometryTemplate.setLodPercent 3 0.2
GeometryTemplate.setLodPercent 4 0.1
GeometryTemplate.setLodPercent 5 0.05

GeometryTemplate.create AnimatedMesh Soldier/3PHunBody3
GeometryTemplate.setSkin animations/GerBody.skn
GeometryTemplate.file Ger3Body
GeometryTemplate.setLodRange 0 0 1 30 2 80
GeometryTemplate.setLodRange 3 150 4 210 5 230
GeometryTemplate.setLodPercent 0 1.0
GeometryTemplate.setLodPercent 1 0.7
GeometryTemplate.setLodPercent 2 0.3
GeometryTemplate.setLodPercent 3 0.2
GeometryTemplate.setLodPercent 4 0.1
GeometryTemplate.setLodPercent 5 0.05
Now you only need to copy the GerBody.sm two times and rename all of them to "Ger1Body, Ger2Body and Ger3Body", then either use 3dsmax to assign a new uniform texture, or just open the corresponding ".rs" file and change the texture path there:

Code: Select all

subshader "GerBody_Material14" "StandardMesh/Default"
{
	lighting true;
	lightingSpecular false;
	materialDiffuse 0.4 0.4 0.4;
	texture "texture/Germun_r";
}

subshader "GerBody_Material15" "StandardMesh/Default"
{
	lighting true;
	lightingSpecular false;
	materialDiffuse 0.4 0.4 0.4;
	texture "texture/Germov_r";
}
Et voìla, you got randomized uniforms!

As stated before, these uniforms will be distributed completely randomly and are NOT kit-associated (only "extras" like backpacks, hippacks, helmet etc. are kit-related!)

Though that would be another interesting project: would it be possible to make animatedmeshes part of kits? I fear not, as throughout the game only "KitParts" are used, and AFAIK they are all simpleobjects attached to a specific bone...

Also, does anyone know what this code used in kitparts does?

Code: Select all

ObjectTemplate.setCopyLinksCount 0

Re: Randomizing soldier uniforms

Posted: Tue May 11, 2010 1:38 pm
by HJGF
i think i found what u mean http://img.villagephotos.com/p/2005-2/956333/AIS03.jpg ill ask how he did it

Re: Randomizing soldier uniforms

Posted: Tue May 11, 2010 1:51 pm
by Senshi
Uhm, I just described how to do that :?

Re: Randomizing soldier uniforms

Posted: Tue May 11, 2010 1:53 pm
by HJGF
lol ik i was just showing a pic

Re: Randomizing soldier uniforms

Posted: Tue May 11, 2010 5:15 pm
by Apache Thunder
Ahh yes the random geometries code is perfect for this. The 3p/1p body mesh are addTemplated to the soldier and are not directly part of the soldier.

So to have the geometries get used in the manner described above, you would do the following: (ussoldier used as an example)

Code: Select all

ObjectTemplate.create BFSoldier USSoldier



ObjectTemplate.addTemplate USSoldier1PBody
ObjectTemplate.setIsFirstPersonPart 1
objectTemplate.setRandomGeometries 3


ObjectTemplate.addTemplate USSoldier3pBody
ObjectTemplate.setIsFirstPersonPart 0
objectTemplate.setRandomGeometries 3

ObjectTemplate.create SimpleObject USSoldier1PBody1
ObjectTemplate.geometry Soldier/1PUsBody1

ObjectTemplate.create SimpleObject USSoldier1PBody2
ObjectTemplate.geometry Soldier/1PUsBody2

ObjectTemplate.create SimpleObject USSoldier1PBody3
ObjectTemplate.geometry Soldier/1PUsBody3

ObjectTemplate.create SimpleObject USSoldier3PBody1
ObjectTemplate.geometry Soldier/3PUsBody1
ObjectTemplate.hasDynamicShadow 1

ObjectTemplate.create SimpleObject USSoldier3PBody2
ObjectTemplate.geometry Soldier/3PUsBody2
ObjectTemplate.hasDynamicShadow 1

ObjectTemplate.create SimpleObject USSoldier3PBody3
ObjectTemplate.geometry Soldier/3PUsBody3
ObjectTemplate.hasDynamicShadow 1
There's the 1p body mesh. If you have some extra textures for that you can do random versions of that too. In BFV your limited to 3 or 4 geometries. But BF42 has no limit that I know of. :D

Re: Randomizing soldier uniforms

Posted: Tue May 11, 2010 5:59 pm
by Senshi
Oh yeah, obviously I forgot about the objects.con and the randomgeometries there...d'uh...

But, considering that the body meshes are just addtemplated, what would happen if you'd remove them from the soldier and move them to the kits? Make them a kit part, attach them to the soldier and good to go? Or are there problems I don't see?

Because that would be really really awesome. Just imagine having unique tank commander uniforms, pilot uniforms, paratrooper uniforms etc., all in one map!

Re: Randomizing soldier uniforms

Posted: Tue May 11, 2010 7:56 pm
by POTAmatt
Well, this is just an idea that occurred to me, but I've never seen it in any mod.
Sure you have. In my Planet of the Apes mod. Way back when, on SSM.com, you helped me fix the LOD values on their faces so the correct skins would display with the proper uniforms at any visible distance. That's all one team in the pic: 3 different designations - Chimp (Green), Orangutan (Yellow) , Gorilla (Red) - each with 3 different faces totaling 9 random geometries.

http://battlefieldmodding.com/ssm/phpBB ... 5be#p40830

Re: Randomizing soldier uniforms

Posted: Wed May 12, 2010 1:21 am
by Apache Thunder
AnimatedMeshes via kitparts won't animate. I tried that once with some boots I ported from BFheroes. I made it a animatedMesh and added that to a kitpart. It did not animate with the soldier. So unfortunately I don't think this will work. :(

Re: Randomizing soldier uniforms

Posted: Wed May 12, 2010 11:21 am
by Senshi
Darn...another dream crushed :( .

Re: Randomizing soldier uniforms

Posted: Wed May 19, 2010 1:41 am
by Sniperjack
So you can have different randomized player models, not just different skins for the same one, right? Just this would require three times as much rigging?