Jump to content
Sign in to follow this  
mrmoon

Setface command and loading savegame

Recommended Posts

Ok so I have a squad all with custom faces issued via setface command but when I reload the game they are all random default bis faces.

Any way round this?

Share this post


Link to post
Share on other sites

Could you use identities defined in description.ext instead? Like so:

class CfgIdentities
{
class Officer
{
	name = "James Abrams";
	face = "Face33";
	glasses = "none";
	speaker = "Adam";
	pitch = 1.00;
};
class Commander
{
	name = "John Peterson";
	face = "Face2";
	glasses = "none";
	speaker = "Adam";
	pitch = 1.00;
};
};

this setIdentity "Commander";

Share this post


Link to post
Share on other sites

Yeah I thought about that but would having 200 or so setidentity commands be a good idea?

Share this post


Link to post
Share on other sites

You need to have a constant script running in the mission checking the passed time. In init.sqs type the following:

#loop
? time < 2 : goto "setface"
~1
goto "loop"

#setface
unit1 setFace "faceX"
goto "loop"

This would reset the selected face back to unit1 every time the mission is loaded. You need to do that to every unit.

Share this post


Link to post
Share on other sites

hi,

You need to have a constant script running in the mission checking the passed time. In init.sqs type the following:

#loop
? time < 2 : goto "setface"
~1
goto "loop"

#setface
unit1 setFace "faceX"
goto "loop"

This would reset the selected face back to unit1 every time the mission is loaded. You need to do that to every unit.

Thanks for the tips Rellikki. I never learned SP scripting especially the saveGame, saveVar, saveIdentity stuffs. Somebody could guide me to a complete tuorial since I'm working on SP campaign. (sorry for pirating the topic)

EDIT: nvm I found what I need in OFPEC.

cya.

Nikiller.

Edited by Nikiller

Share this post


Link to post
Share on other sites

Hmm yeah this could work thanks, might slow down the mission though it is a huge one after all.

Share this post


Link to post
Share on other sites

It's a good practice to use iterators, like conditional loop with a counter or the forEach command, for such repetitive tasks, so you can do with only one script instead of 200 hundred copies of the same thing running. ForEach will block other execution so it's best to use it for light tasks, or initialization that only happen once.

Why do you need 200 faces? Are the faces random, or all the same face or what?

Share this post


Link to post
Share on other sites

hi,

Hmm yeah this could work thanks, might slow down the mission though it is a huge one after all.

For big missions, you should use a spawn manager. It fragments the mission init since all the AI are not initialized at the same time. Moreover, it decreases the mission.sqm size making the mission faster to load. Having a lot of scripts executed at the same time and running in parallele is never good. Better to use use a random delay (i.e: ~1+random 1)

Init fields in sqm is good when you need very fast execution like moveInCargo a lot of units in a BMP who is in the sea. Like that it avoids that some units are not loaded (especially in MP). I is also good to give name to a group.

That's why I asked you if you setFace your units in their init field. When you start the game and load the mission it works since element are not loaded in RAM yet. But when you load the mission another time, setFace in the init field is faster and is overwriten by the default config.cpp random face system who seems executed few microseconds later. That's why Rellikki made a loop to check if the mission has started. I think that just execute a set face script from the init.sqs should be enough since stuffs in the init are only executed when the mission starts.

If you are lazy (like me) here's a trick to execute a script for a lot of units without repeating the same thing over and over.

init.sqs

;**********************
;Init Script by Nikiller
;Contact: nikillerofp@hotmail.fr
;**********************
_allgrplist = [grp1,grp2,grp3,grp4,grp5,grp6]
_all_ar=[]
{_all_ar=_all_ar+(units _x)} forEach _allgrplist
{[_x] exec "whateverscript.sqs"} forEach _all_ar

exit

Give a name to each groups (MyGroupName=group this in each leader's init field). Copy this script in your init.sqs, change the group name array by your own groups name and change whateverscript.sqs by your setFace script name. I suggest you this setFace script.

cya.

Nikiller.

Edited by Nikiller

Share this post


Link to post
Share on other sites

Thanks for the help guys for now Im using the set face loop as it doesnt seem to be slowing things down that much despite the very long script.

I need the 200 faces because the mission is set in iran and its quite long requiring an occasional reload, I tried doing it without but the iranian soldiers and civilians just look terrible with bis white faces.

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  

×