Jump to content
Sign in to follow this  
RozekPoland

Set specific faces/identities for soldiers

Recommended Posts

Hello everyone

I am working on a config for some Eastern-European infantry units. The units are assigned to WEST side (in config). Identities for WEST units feature faces of people of different races and ethnicity. I would like to keep it realistic and set these Eastern-European soldiers faces/identities like EAST side has.

Share this post


Link to post
Share on other sites

Well, two ways :

(1) use a setface script within an eventhandler init to chose only the faces you want.

(2) Modify the config.bin to get rid of the faces you don't want (either in the cfgfaces section or the cfgworlds one).

Share this post


Link to post
Share on other sites
ProfTournesol said:
Well, two ways :

(1) use a setface script within an eventhandler init to chose only the faces you want.

Where should I put this eventhandler? Should it be in unit's config? If so how does it look like?

ProfTournesol said:
(2) Modify the config.bin to get rid of the faces you don't want (either in the cfgfaces section or the cfgworlds one).

I would like to avoid changing main game's config only for a bunch of units.

Share this post


Link to post
Share on other sites

Something like :

class MyPolishSoldier:SoldierWB
{

blablabla

class EventHandlers
{
init = "[_this Select 0] exec {\MyPboName\Scripts\SetFaces.sqs};";
};
};

And a script such as :

_soldier = _this select 0

_i = random 12

?(_i <= 1) : _soldier setface "Face1"
?(_i > 1) AND (_i <= 2) : _soldier setface "Face2"
?(_i > 2) AND (_i <= 3) : _soldier setface "Face3"
?(_i > 3) AND (_i <= 4) : _soldier setface "Face4"
?(_i > 4) AND (_i <= 5) : _soldier setface "Face5"
?(_i > 5) AND (_i <= 6) : _soldier setface "Face6"
?(_i > 6) AND (_i <= 7) : _soldier setface "Face7"
?(_i > 7) AND (_i <= 8) : _soldier setface "Face8"
?(_i > 8) AND (_i <= 9) : _soldier setface "Face9"
?(_i > 9) AND (_i <= 10) : _soldier setface "Face10"
?(_i > 10) AND (_i <= 11) : _soldier setface "Face11"
?(_i > 11) AND (_i <= 12) : _soldier setface "Face12"


exit

BIS list of faces can be found in the CfgFaces section in the config.bin.

You can reduce the script size by using the "call" command i think, not tested though :

_soldier = _this select 0

_i = random 12
_num = (_rand - (_rand mod 1)) + 1

call format [{_soldier setface "Face%1"]}, _num]
exit

Share this post


Link to post
Share on other sites

The first example works perfectly.

The second example also works but there appears error info in top-left, something about Facescalar bool array string xxx, there is a lack of "(" sign. The effect is that every soldier has the same face.

Nevertheless, thank you very much for help! I really appreciate it!

Share this post


Link to post
Share on other sites

How Can I control the second script? Shall I do something like below?:

_soldier = _this select 0

_i = random 12
_num = (_rand - (_rand mod 1)) + 1

call format [{_soldier setface "Face1"}, _num]
call format [{_soldier setface "Face2"}, _num]
call format [{_soldier setface "Face3"}, _num]
call format [{_soldier setface "Face4"}, _num]
call format [{_soldier setface "Face5"}, _num]
call format [{_soldier setface "Face6"}, _num]
call format [{_soldier setface "Face7"}, _num]
call format [{_soldier setface "Face8"}, _num]
call format [{_soldier setface "Face9"}, _num]
call format [{_soldier setface "Face10"}, _num]
call format [{_soldier setface "Face11"}, _num]
call format [{_soldier setface "Face12"}, _num]
exit

The effect is that the script only uses the last face and gives it to all units which are configured by the eventhandler. The effect is the same with "Face%1" etc. and just "Face%". Am I doing something wrong?

Share this post


Link to post
Share on other sites

Ok, i tested it and i made a little mistake, so the following is working :

_soldier = _this select 0

_rand = random 12
_num = (_rand - (_rand mod 1)) + 1

call format [{_soldier setface "Face%1"}, _num]
exit

But, there are 50 faces in BIS config. You must spot the coloured ones and avoid them in the script (i guess there are 3 of them, you have to found out which ones). So, if the black faces are for example face2, face3 and face4, then you'll have to modify the script like this :

_soldier = _this select 0

#init

_rand = random [b]50[/b]
_num = (_rand - (_rand mod 1)) + 1

[b]? _num in [3,4,5]:goto "init"[/b]

call format [{_soldier setface "Face%1"}, _num]
exit

Some more explanations :

the line

_rand = random [b]50[/b]

returns a random number between 0 and 50 not included (but not a rounded number)

the line

_num = (_rand - (_rand mod 1))

returns a rounded number between 0 and 50 not included. As there is no "face0" in the BIS config, i added "1" at the end of the line

_num = (_rand - (_rand mod 1)) + [b]1[/b]

so that it returns a rounded number between 1 and 51 not included.

the line

call format [{_soldier setface "Face%1"}, _num]

launch the setface command, replacing "%1" by the "_num" value. Fo example, if _num = 10, "Face%1" will be "Face10".

Share this post


Link to post
Share on other sites

OK, it is working great now! Thank you very much for explaing me all these commands. Now it is easier for me to understand :)

Is there any way to skip the script for player/players (multiplayer) because the script also changes my custom face? :)

Share this post


Link to post
Share on other sites

Well i'm not good at MP scripting, but adding :

?_soldier == player : exit

before the "#init" part should do the trick for the player.

Share this post


Link to post
Share on other sites

Much better way is to check if soldier is a black dude and then change his face.

Face49 = ["Harry Sissman", "Jack Harding", "Frank Kasbekar", "Patrick Denison", "Bobby Huffman", "Rick Fawcett", "Dan Hood", "Ruben Lanier", "Rick Murphey", "Aaron Scheer", "Fred Kunitz", "Barry Gayman", "Jeremy Ludtke", "Jeff Whitaker", "Jeremy Holloman", "Sam Platzek", "Harry Brown", "Alejandro Stratmann", "Tom Thurman", "Dan Henson", "Bill Caffey"]

? name _unit in Face49 : _unit setFace "face39"

Face23 appears in RES and CIV. Face33 only in CIV. Face49 only in WEST.

White men can't jump!

Share this post


Link to post
Share on other sites
Much better way is to check if soldier is a black dude and then change his face.

Face49 = ["Harry Sissman", "Jack Harding", "Frank Kasbekar", "Patrick Denison", "Bobby Huffman", "Rick Fawcett", "Dan Hood", "Ruben Lanier", "Rick Murphey", "Aaron Scheer", "Fred Kunitz", "Barry Gayman", "Jeremy Ludtke", "Jeff Whitaker", "Jeremy Holloman", "Sam Platzek", "Harry Brown", "Alejandro Stratmann", "Tom Thurman", "Dan Henson", "Bill Caffey"]

? name _unit in Face49 : _unit setFace "face39"

Face23 appears in RES and CIV. Face33 only in CIV. Face49 only in WEST.

White men can't jump!

Hey, nice one Faguss !

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  

×