Jump to content
Sign in to follow this  
JVez

Change the type of the unit

Recommended Posts

Hi everybody. I would like to change the type of the unit after activating an add action. Here is the action:

hqwest addAction ["Sapper2", "sapperj.sqf",nil,1.5,true,true,"","str _this != 'generalwest'",5]; 

 

Now I have to create the sapperj.sqf script and I do not know how to start it. I want the player who activates the action to become this unit: LIB_GER_Sapper_w

 

I'm struggling...

Share this post


Link to post
Share on other sites

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

Example on Wiki. What do you mean for the action? The action text? Display name of unit or? Need more info please. Something like (tested in debug):

player addAction [format ["%1", getText (configFile >> "CfgVehicles" >> typeOf player >> "displayName")], {hintSilent "Hello!";}];

 

Share this post


Link to post
Share on other sites

 

I want the player who activates the action to become a sapper: LIB_GER_Sapper_w

Share this post


Link to post
Share on other sites

You'd need to use createUnit + selectPlayer for that then.

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

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

Have a good reason of the comments on selectPlayer, especially in MP. You may not need to use this. What are you trying to do exactly? Also, check out...

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

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

Not sure if these have been fixed since I last tried. Not sure, test and see.

Share this post


Link to post
Share on other sites

 

In my mission I have a HQ and on the side I put a sign. From this sign the player can choose to become a sapper. (an engineer)

 

 

If I understand I must create a unit and have the player transfer to this unit?

Share this post


Link to post
Share on other sites

Yeah... I got that. Read my previous post. The links I provided. You can give any unit type the role of engineer, or whatever.

Share this post


Link to post
Share on other sites

 

I managed to create a sapper that joined the player's group. Hold I must transfer the player into this one.

 

"LIB_GER_Sapper_w" createUnit [position player, group player];

 

Share this post


Link to post
Share on other sites

Again, read my second post. The answer is right there!

Share this post


Link to post
Share on other sites

 

It works but I can not delete the original unit ...

Share this post


Link to post
Share on other sites

 

I have this for now: however, line 4 does not work.

 

player setVariable ["none",true,true];
"LIB_GER_Sapper_w" createUnit [position player, group player, "sapper = this"];
selectPlayer sapper;
deleteVehicle none;

I do not know what to do now.

  • Confused 1

Share this post


Link to post
Share on other sites

 

it works :O 

none = player;
"LIB_GER_Sapper_w" createUnit [position player, group player, "sapper = this"];
selectPlayer sapper;
deleteVehicle none;

:don11:

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  

×