Jump to content
Sign in to follow this  
Kommiekat

setFace for all units on map

Recommended Posts

Hi,

Making SP mission and need Independants (enemy) with Asian faces on a Mekong River looking map.

I've not decided on The Unsung Mod or MGB_Nam maps just yet.

If I place say, 50 or 75 or 100 enemy units, in various patrol groups (moving or standing still), in various places on the map, that means I have to put in the Units init box:

a1 setFace "Face124_PMC"

50, 75 or 100 times (a1-a100)!

There are 17 Asian faces I can use (Face108_PMC to Face124_PMC) and some will be covered with masks as comes with the Chernarus Independents (some in hats, some in hoodies).

Lastly

I will need to enableRadio false for those Independents, because they speak Russian and I don't need them shouting out or anything, but I still need the Players team to shout (VME_PLA mod).

Even The Unsung Map units speak Russian.

Share this post


Link to post
Share on other sites

I'm a poor scripter, but maybe creating groups first:

group1 = group this

In the leader's init.

Then this in your init.sqf:

nul = [group1,group2,etc] execVM "facescript.sqf"

Then this script (inspired by Ronon =ASP='s camoface script).:

if ( isServer ) then {

//Initialize functions
waitUntil{!(isNil "BIS_fnc_init")};
waitUntil{!(isNil "BIS_MPF_InitDone")};


//Set Faces
{_x setFace ["face124_PMC"]}foreach units this;
}

It's probably wrong, maybe some scripter will have a good laugh. To make it random between a set of all asian faces I wouldn't know how to do, but if this works it should be ok for testing purposes to get the feel :cool:

Share this post


Link to post
Share on other sites

Hi mate... this little loop should do the faces (not tested). It can be shorter but is probably easier to follow like this.

I guess you could also use faction instead of side.

_allunits  = allUnits;

for "_i" from 0 to (count _allunits)-1 do {
_unit = _allunits select _i;
if (side _unit == "GUER") then {
	_num = 108 + (floor (random 17));
	_face = format ["Face%1_PMC",_num];
	_unit setFace _face;
};
sleep 0.01;
};

enableRadio and enableSentences seem to work across the board so not good here.

Maybe this will work... but not sure. Just stick it into the if loop above to try it.

_unit [url="http://community.bistudio.com/wiki/disableConversation"]disableConversation[/url] true;

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

nul = [group1,group2,etc] execVM "facescript.sqf"

Then this script (inspired by Ronon =ASP='s camoface script).:

if ( isServer ) then {

//Initialize functions
waitUntil{!(isNil "BIS_fnc_init")};
waitUntil{!(isNil "BIS_MPF_InitDone")};


//Set Faces
{_x setFace ["face124_PMC"]}foreach units this;
}

Thx for your reply.

Do you think it will radomize the faces from a given set range from Face108_PMC to Face124_PMC?

I'll give it a try and see what happens.

Share this post


Link to post
Share on other sites
Thx for your reply.

Do you think it will radomize the faces from a given set range from Face108_PMC to Face124_PMC?

I'll give it a try and see what happens.

Nope. Use twirly's script instead IMO.

Share this post


Link to post
Share on other sites
Hi mate... this little loop should do the faces (not tested). It can be shorter but is probably easier to follow like this.

I guess you could also use faction instead of side.

_allunits  = allUnits;

for "_i" from 0 to (count _allunits)-1 do {
_unit = _allunits select _i;
if (side _unit == "GUER") then {
	_num = 108 + (floor (random 17));
	_face = format ["Face%1_PMC",_num];
	_unit setFace _face;
};
sleep 0.01;
};

enableRadio and enableSentences seem to work across the board so not good here.

Maybe this will work... but not sure. Just stick it into the if loop above to try it.

_unit [url="http://community.bistudio.com/wiki/disableConversation"]disableConversation[/url] true;

Hi Twirly,

Checking out the code here:

if (side _unit == "GUER") then {
	_num = 108 + (floor (random 17));
	_face = format ["Face%1_PMC",_num];
	_unit setFace _face;
};

This will randomize the faces from 108 to 124?

Lastly, the enableRadio....um.....where do I put that in your code and how?

Sorry, I'm a bit lost. May need my hand held a bit :o

Share this post


Link to post
Share on other sites

OK mate...

Create an init.sqf file in your mission folder or add this this to the existing one.

If the units are already on the map and are not being spawned it should give you the random faces and hopefully disable the speech for all RESISTANCE (Independant) units.

_allunits  = allUnits;

for "_i" from 0 to (count _allunits)-1 do {
_unit = _allunits select _i;
if (side _unit == [color="#FF0000"]RESISTANCE[/color]) then {
	_num = 108 + (floor (random 17));
	_face = format ["Face%1_PMC",_num];
	_unit setFace _face;
               _unit disableConversation true;
};
sleep 0.01;
};

EDIT: **Note** It won't work if the units are being spawned....and you need to change the "GUER" to RESISTANCE with no quotes. Silly me!

Now tested! Demo here.

Edited by twirly
Link added

Share this post


Link to post
Share on other sites

Wow, just wow, Twirly!

You need a name for this new baby.

What shall we call her?

I must give you credit for this when I upload the mission.

Could I ask for one more twist on this?

Do you think it could be done with Civilians as well?

I may need to find some Rice farmers, like the old Grandma's working in the fields and stuff like that.

Seems empty without women in the villages.

Share this post


Link to post
Share on other sites

Sure mate... just change RESISTANCE to CIVILIAN in the script.

I also noticed the _unit disableConversation true; line does not work. They still speak. So don't know the answer to that part.

EDIT: Here's the same script slightly different. This will change both RESISTANCE and CIVILIAN faces in one go.

_allunits  = allUnits;

_sides = [RESISTANCE,CIVILIAN];

for "_i" from 0 to (count _allunits)-1 do {
_unit = _allunits select _i;
if (side _unit in _sides) then {
	_num = 108 + (floor (random 17));
	_face = format ["Face%1_PMC",_num];
	_unit setFace _face;
               _unit disableConversation true;
};
sleep 0.01;
};

Edited by twirly

Share this post


Link to post
Share on other sites

Greetings

Just wanted to say that this script is working like a charm.

I have one other issue:

I need the DrugLord, who is to be captured as the last mission, with his own Asian Chinese face.

He is the leader of the Independent Guerrilla's.

Is it possible the script is over-riding the setFace/setIdentity?

I have PMC_Lite, not full version. PMC faces should show up, yes?

If I use this in the units init box, it doesn't work:

druglord setFace "Face_A2_Face118_PMC";

If I place it in the description.exe as the BIS wiki says, it doesn't work. Game crashes

Possibly I am not putting correct code in the description?

Lastly, I don't see a reason for this to work because druglord does not need voice or name or glasses.

He won't appear in Players briefing line up.

He is not part of the players team:

class CfgIdentities
{

class Naw Kham
{
name="druglord";
face="Face_A2_Face118_PMC";
glasses="cap_desert_h";
speaker="MALE02EN";
pitch=1.02;
}
};

Share this post


Link to post
Share on other sites

I cant check this right now by i think you write wrong classname for druglord and that way game crashes.

Try:

Face118_pmc not face_a2_face118_pmc.

---------- Post added at 06:48 AM ---------- Previous post was at 06:38 AM ----------

You can use setidentity in mission/description.ext (faces,glasses,speaker etc) for all units on map (enemy, civilians etc) not only for players group. This is not a problem.

Share this post


Link to post
Share on other sites
I cant check this right now by i think you write wrong classname for druglord and that way game crashes.

Try:

Face118_pmc not face_a2_face118_pmc.

---------- Post added at 06:48 AM ---------- Previous post was at 06:38 AM ----------

You can use setidentity in mission/description.ext (faces,glasses,speaker etc) for all units on map (enemy, civilians etc) not only for players group. This is not a problem.

Hi Tom,

Not sure it will got straight in like that. Doesn't it need brackets and colons?

{

druglord setIdentity "Face118_pmc"

};

Like that above or like this below?

druglord setIdentity "Face118_pmc"

Share this post


Link to post
Share on other sites

description.exe as the BIS wiki says, it doesn't work. Game crashes

Possibly I am not putting correct code in the description?

Maybe just a typo, but be sure that its description.ext and not an exe-file!

Also you should consider the execution-order...dunno if it was init.sqs -> description.ext -> scripts.sqs..was written somewhere in the biki. The Officer-face should be set at last to overwrite the custom-faction-face you set via script.

Share this post


Link to post
Share on other sites

KK in description.ext you add:

Class CfgIdentities
{
class druglord
{
name = "Naw Kham";
face = "face118_pmc";
glasses = "none";
speaker = "male01en";
pitch = 1.00;
};
};

In editor in druglord init field:

s1 setidentity "druglord"

s1-unit name in editor.

Ps: you can check missions from my campaign and copy that part of description if you will still have problems with this.

Share this post


Link to post
Share on other sites
Maybe just a typo, but be sure that its description.ext and not an exe-file!

Also you should consider the execution-order...dunno if it was init.sqs -> description.ext -> scripts.sqs..was written somewhere in the biki. The Officer-face should be set at last to overwrite the custom-faction-face you set via script.

Thanks for the reminder on that. Indeed, typos can really throw you off.

KK in description.ext you add:

Class CfgIdentities
{
class druglord
{
name = "Naw Kham";
face = "face118_pmc";
glasses = "none";
speaker = "male01en";
pitch = 1.00;
};
};

In editor in druglord init field:

s1 setidentity "druglord"

s1-unit name in editor.

Ps: you can check missions from my campaign and copy that part of description if you will still have problems with this.

Got it working, Tom. Thanks for the help on that!

As usual, you go in the Credits on the Intro, so set back, eat some pop-corn and watch your name appear.

Got Twrily in there as well......

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  

×