Jump to content
Sign in to follow this  
Hjaldar

Semi-random custom faces

Recommended Posts

Hi there,

it's about custom faces again.

I know about the "setface"-command and about this code I found by searching

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class Faces

{

units[] = {};

weapons[] = {};

requiredVersion = 1.20;

};

};

class CfgFaces

{

class b

{

name="b";

texture="\vash\b.jpg";

east=1;

west=1;

};

class bx

{

name="bx";

texture="\vash\bx.jpg";

east=1;

west=1;

};

class b1

{

name="b1";

texture="\vash\b1.jpg";

east=1;

west=1;

};

but what I need are semi-random faces for different soldiers in one config. I made a somewhat tweaked CTI with customized soldiers for Woodland, Desert, Jungle.

For example, a regular Woodland soldier looks like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class SoldierUSRifle:HYK_USsolWL {};

class ARESCTISoldierUSRifle:SoldierUSRifle

{

displayName = "US Rifleman";

weapons[]={"C8XJAMM16","BAS_JM1911","NVGoggles","Throw","Put"};

magazines[]={"JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","J

AM_W556_30Bmag","JAM_M1911mag","JAM_M1911mag","JAM_M1911mag","JAM_M1911mag","HandGrenade","HandGrenade","HandGrenade"};

vehicleClass = $STRARESCTICLASSNAME;

};

Desert:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class SoldierUSRifleD:HYK_USsolDe {};

class ARESCTISoldierUSRifleD:SoldierUSRifleD

{

displayName = "US Rifleman";

weapons[]={"C8XJAMM16","BAS_JM1911","NVGoggles","Throw","Put"};

magazines[]={"JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","J

AM_W556_30Bmag","JAM_M1911mag","JAM_M1911mag","JAM_M1911mag","JAM_M1911mag","HandGrenade","HandGrenade","HandGrenade"};

vehicleClass = $STRARESCTICLASSNAME3;

};

and now Tropic (for Jungle missions):

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class SoldierUSRifleT:HYK_USsniper1WL {};

class ARESCTISoldierUSRifleT:SoldierUSRifleT

{

displayName = "US Rifleman";

weapons[]={"C8XJAMM16","BAS_JM1911","NVGoggles","Throw","Put"};

magazines[]={"JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","JAM_W556_30Bmag","J

AM_W556_30Bmag","JAM_M1911mag","JAM_M1911mag","JAM_M1911mag","JAM_M1911mag","HandGrenade","HandGrenade","HandGrenade"};

vehicleClass = $STRARESCTICLASSNAME2;

};

All of these guys are in one config.cpp that I use for my mission (in a file called arescti.pbo).

Now to my problem: I'd like my Tropic soldiers to have random and custom (=camoflaged) faces, but not the other guys.

Since the soldiers are created ingame, the "setface in init-line"-trick doesn't work.

Can you help me? Thanks in advance.

Share this post


Link to post
Share on other sites

Sorry, but I could not find the codelines you thought of. Could you please post them?

Share this post


Link to post
Share on other sites

Don't know anything about zombie's but all you need to do is create a global array with a list of the faces ... then setFace to a random face by generating a random number

example:

Imagine I have a list of faces defined as Face1, Face2, Face3, etc...

In init.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

FaceList = ["Face1","Face2",Face3",etc...]

If the soldiers are created in-game.. then there HAS to be a createUnit command.

In that createunit command, find out how the init line works and add

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"x = (random (count FaceList-1))+0.5; x = (x - (x mod 1)); this setFace (FaceList select x);"

The above code generates a random number for 'x' based on the number of faces you listed, rounds it  up or down to an integer to be used by select command, and then picks that face. Should be semi-random.

EDIT: edited to optimize some of the code. I added the rounding up or down since the chances of getting the last face as a choice was very remote if you round down only.

Share this post


Link to post
Share on other sites

Alternatively, you can add a random facescript in your init part of your eventhandlers in your config cpp. Since I don't have reference handy, syntax not guaranteed.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class EventHandlers

{

init = "(_this select 0) exec ""\arescti.pbo\facescript.sqs""";

};

Face script would consist of a list of faces in an array and a random no. generator plus a setface command.

Hope this helps smile_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×