Jump to content
Neonz27

Is it possible to add an action to all playable units?

Recommended Posts

I think the title is pretty self-explanatory, but I can provide my details if they are requested. I only need the action on playable units; not NPCs. Demonstrations would be very helpful.

Share this post


Link to post
Share on other sites

Yes you can pretty much add it to anything in the game you want playable units placeable objects even backpacks.

Watch this video we'll explain everything. 

 

Share this post


Link to post
Share on other sites

@Neonz27,
It's just this,

Spoiler

{ 

addAction

} forEach playableUnits;

so something like,


{ 

null=[ _x, "Generic Hold Action", 
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
"alive _this", "alive _this", {}, {}, {

systemChat "Action Complete!";

}, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd;

} forEach playableUnits;

playableUnits


Have fun!

  • Like 1

Share this post


Link to post
Share on other sites

Depending on what you want to do with your action...

 

playableUnits  are all slots (lobby) if you don't disable AIs in the lobby. If you disable them, you'll get just something equivalent to allPlayers, then depending on when you are running your code and the effective players.  In SP, but I guess it's not the aim, you must use switchableUnits.

 

Now, do you want to addAction on the player himself (self addAction) ?

In this case, forget playableUnits, and add the action on the player when he is a player (initPlayerLocal.sqf) . And don't forget to run again the addAction after respawn. It's not persistent.

 

 

  • Like 3

Share this post


Link to post
Share on other sites

pierremgi is right... If you want to add the action only to players you should place the addAction inside the initPlayerLocal.sqf and in addition to that inside the onPlayerRespawn.sqf which is run when a player is respawned. For more info on both initPlayerLocal.sqf and onPlayerRespawn.sqf and the arguments that are passed to them see this site.

  • Like 1
  • Thanks 1

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

×