Jump to content

Recommended Posts

Hey guys!

 

In the wiki entry of setIdentity is described how to create an identity in description.ext and set it by its classname.

 

here is the description.ext example of those wiki entry:

class CfgIdentities
{
    class MyLittleSoldier
    {
        name = "Givens";
        nameSound = "Givens";
        face="WhiteHead_06";
	glasses="None";
	speaker="Male05ENG";
	pitch=1.1;
    };
};

if u have that in ur description.ext then u can set a units identity with:

_soldier1 setIdentity "MyLittleSoldier";

I m working on a script which deletes units and spawns them at a later time. therefor i need to get the identity classname ("MyLittleSoldier" in the above example) directly from the unit.

Idk how to get it. Any help is appreciated...

Share this post


Link to post
Share on other sites

this is not an answer for your question but just to point out it should not be like this ?

this setIdentity "MyLittleSoldier";

Share this post


Link to post
Share on other sites

 

this is not an answer for your question but just to point out it should not be like this:

_soldier1 setIdentity "MyLittleSoldier";

but like this

this setIdentity "MyLittleSoldier";

 

that depends from where u use it. in units init line it would be this but in a script u use a local variable name like _soldier1

  • Like 1

Share this post


Link to post
Share on other sites

Is this something like that you need ?

 

getDescription unit

 

https://community.bistudio.com/wiki/getDescription

 

i don't know just trying to help

sadly its not helping because I need the sub-classname from the description.ext, not a classname for an object.

 

 

but I think i ve found a starting point:

BIS_fnc_getCfgIsClass

BIS_fnc_getCfgSubClasses

 

this function returns an array of sub classes from description.ext

i guess its used like this (plz correct me if i m wrong):

if(["CfgIdentities"] call Bis_fnc_getCfgIsClass) then
{
 _subclasses = ["CfgIdentities"] call Bis_fnc_getCfgSubClasses;
}
else
{
 hint "there is no class for identities in description.ext";
};
now I should have all classnames needed for setIdentity but idk how to get known which identity is currently used by a unit.

I need that info to store it before deleting and use it in setIdentity after spawning unit again. (just a reminder :-)

  • Like 1

Share this post


Link to post
Share on other sites

If your spawning the units and using setIdentity on them just save the classname used in a variable on the unit.

_identity = "MyLittleSoldier";
_solider setIdentity _identity;
_soldier setVariable [ "identity", _identity ];
If not, and all your identities reside in description.ext then you could find them by the units Name.

_identity = {
	if ( getText( _x >> "Name" ) isEqualTo ( name _soldier ) ) exitWith { configName _x }; 
}forEach ( "true" configClasses( missionConfigFile >> "CfgIdentities" ));
  • Like 1

Share this post


Link to post
Share on other sites
_identity = {
	if ( getText( _x >> "Name" ) isEqualTo ( name _soldier ) ) exitWith { configName _x }; 
}forEach ( "true" configClasses( missionConfigFile >> "CfgIdentities" ));

 

thx a lot. I think thats exactly what I need

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

×