Jump to content
Sign in to follow this  
Casso

getting unit name in script

Recommended Posts

Hi, I am wondering if it is possible to get the name of a unit within a script. I suppose getVariable might do the trick, but I do not know the "default" variable list every object has. Could someone perhaps point out such a list?

I am modifying the Xeno domination a bit, and I want to modify the x_helirespawn script a bit. I want some choppers (lift, wrecklift) to respawn pretty much instantly and others to respawn after 10 minutes. So I want to make a switch based on the unit name.

Share this post


Link to post
Share on other sites

I dont think that is it. I want the name of the unit given in the editor, like chopper1, not the name of the unit given through the setIdentity function.

Share this post


Link to post
Share on other sites

You're right, sorry.

vehicleVarName does the trick:

x = vehicleVarName this;
hint format ["%1", x];

http://community.bistudio.com/wiki/vehicleVarName

http://community.bistudio.com/wiki/setVehicleVarName

But there might be a problem, when the unit respawns. In setVehicleVarName it says: "Sets the name of the variable which contains a reference to this object. It is necessary in MP to change the variable content after a respawn.".

Share this post


Link to post
Share on other sites

                       _name = _vehicle getVariable "vec_name";
                       if ((_name == 301) || (_name == 302) || (_name == 304)) then {
                           sleep 0.5;
                       } else {
                           sleep 600;
                       };

solved... every time the new vehicle is created (respawned), its name is set by

_vehicle setVariable ["vec_name", _number_v, true];

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  

×