sickboy 13 Posted August 21, 2006 I am creating a script for custom faces for the llauma heads, that puts on specific faces depending on the name of the unit... I am using these codebits in a script in the init eventhandlers of my units:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_u=_this select 0 _playn=name _u _face=format["SIX_%1",_playn] _u setFace _face to select the right face from the faces pbo I created. The problem now arises .. that when a player has a space in his name.. it will not work, since the class definitions of the faces do not allow spaces, of coarse. I was breaking my head about a solution and came up with either removing the space from the name with some kind of string manipulation, of which I don't think is possible in OFP....(plz correct me if im wrong!! Or, create 2 arrays, the first with the playernames with a space, the second with the playernames (or other facedesignation) without a space. Then lookup on which position the playername is in array1, and then select the right face from array2. Now the question is...how do I lookup the position of the playername in array1, so I can use it to get the corresponding face from array2? The hard way would be to count the faces and do a 1on1 check on every face and then use this codebit to determine the position:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">while "_i >0" do {_ppos=(_i - 1); if ((SIX_FACES select _ppos) == _playn) then { _i=0 }; _i=(_i - 1) } _playns=(SIX_FACESS select _ppos) _face=format["SIX_%1_%2",_playns,_typ] Any help, or alternatives welcome & appreciated! The above code is a working codebit from my code, but it's a bit much calculation in comparison to a possible simple command to obtain the position of a value within an array Share this post Link to post Share on other sites
UNN 0 Posted August 21, 2006 Hi, You can add the real names to a stringtable.csv file in your addon, for all the names you want to check. Then use the localize command to retrieve the face name assigned to the real name: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Face=Localize "REAL NAME" It works with spaces, but I'm not sure what other characters it supports. Share this post Link to post Share on other sites
sickboy 13 Posted August 21, 2006 Hi,You can add the real names to a stringtable.csv file in your addon, for all the names you want to check. Then use the localize command to retrieve the face name assigned to the real name: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Face=Localize "REAL NAME" It works with spaces, but I not sure what other characters it supports. Holy crap, great idea.. gonna fiddle around with it Share this post Link to post Share on other sites
sickboy 13 Posted August 21, 2006 Ok the solution with localize is perfect, works as a charm Thanks ! Moving to ME & S. My bad Didn't find such category in the flashpoint forums, I should've looked better.. Share this post Link to post Share on other sites