Jump to content
Sign in to follow this  
OFPCAT

How to set random faces?

Recommended Posts

Any one could help to tell how to set the customzied random faces in an addon? For example, I wanna put Lauma's new face pack to my soldier pack in random. How should I do to get the random setting?

Share this post


Link to post
Share on other sites

Well, i haven't tried it but this should work if you launch that script through the eventhandler "init" of the config :

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

_unit = _this select 0

;array of your faces : use the config name of the face and don't forget the quotation marks :

_facearray = ["face01","face02","face03"]

;pick a random rounded number between 0 and 2 :

_r = random 2

_t = _r - (_r mod 1)

; select a face in the array :

_face = _facearray select _t

; apply the face on the unit :

_unit setface _face

exit

The config of your unit, if the previous script is named "randomface.sqs" :

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

class My_unit: soldier

    {

blablabla....

class EventHandlers

{

init=_this exec "\path_to_my_addon\randomface.sqs";

};  

};

Share this post


Link to post
Share on other sites

Thank you, but I'm afraid still haven't got the point. Should I need make a random face file in .sqs first?

Share this post


Link to post
Share on other sites

Two ways of modifying random face :

(1) modifiy config.bin of the game (as mods do), but if you only release an addon, you cannot do this ;

(2) launch a script on every units of your addon.

So :

(1) Create a script (adapt the previous posted one with accurate faces' names and adapt "_r = random 2") ;

(2) put the script in you addon pbo ;

(3) create an eventhandler "init" for your soldiers lauching the script.

Share this post


Link to post
Share on other sites
Two ways of modifying random face :

(1) modifiy config.bin of the game (as mods do), but if you only release an addon, you cannot do this ;

Their is a bug doing it this way and adding class EventHandlers

{

init=_this exec "\path_to_my_addon\randomface.sqs";

};  

};

Into you're custom config bin! When you start to play a saved game (single player or campaign) The face's appear to flash because they are continualy switching between different face's. I get this bug with all the latest unit's that use facetex2

Share this post


Link to post
Share on other sites

Sorry, i was replying on a standard face setting, but apparently facetex2 is something very specific with an animated part of the p3d model...you'd better check the facetex2 topic.

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  

×