Jump to content
BadHabitz

Assign setIdentity to a classname

Recommended Posts

Trying to put together a script, but it's beyond me. 

 

I have a custom soldier classname "OPRB_Poseidon", and I want him to have a specific identity, but when I put them in a mission from the editor or Zeus, it gives the character a random name from a list. 

 

So what I want is something where if it detects OPRB_Poseidon it will setIdentity OPRB_Poseidon_id on that character. I want to be able to place the character down and have the identity automatically assigned if I drop him in the editor or Zeus.

 

Is this even possible? Please keep in mind I'm looking for dedicated MP compatibility.

 

Something like this?

if (typeOf vehicle == "OPRB_Poseidon") then {this setidentity "OPRB_Poseidon_id"};

But I don't think it will work because I use "this"

 

 

Share this post


Link to post
Share on other sites

Addressing your example code only, it should be more along the lines of

{
if (typeOf unit _x == "OPRB_Poseidon") then {_x setidentity "OPRB_Poseidon_id"};
} forEach allUnits;

There is likely a better way to do that, just as there might be a better way to accomplish what you want.

 

 

Share this post


Link to post
Share on other sites

So, I did manage to get this to work.

 

Add to classname in config.cpp:

        class EventHandlers: EventHandlers {
            init = "(_this select 0) setIdentity ""OPRB_Poseidon_id""";
        };

Guy looks right being dropped in Zeus. In the editor the unit will have the default face in the editor, but will have the face and name I want when the mission runs. 

  • Like 2

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

×