Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
hogmason

array inside an addaction

Recommended Posts

how can i use an array inside an addaction i.e

[color="#FF0000"]_crewType = ['USMC_SoldierS_Engineer','US_Soldier_Engineer_EP1','BAF_Soldier_EN_W','BAF_Soldier_EN_DDPM',
           'BAF_Soldier_EN_MTP','Soldier_Engineer_PMC','CDF_Soldier_Engineer'];[/color]


_id = _x addAction ["Repair Vehicle", "HOG_scripts\HOG_mechanic\repair.sqf", [], 1, false, true, "", "(getDammage _target) < 1 AND (getDammage _target) > 0 AND [color="#FF0000"](typeof _this) == _crewtype[/color] AND (vehicle _this) == _this"];

the reason is i need only the unit classnames inside the array to be able to recieve the addaction

Share this post


Link to post
Share on other sites

Use a global variable instead of a local one, by removing the underscore before the variable name:

_local_var = ""; //Local
global_var = ""; //Global

Please note that you cannot check a STRING against an ARRAY, in fact, you can't check anything against an ARRAY.

(typeof _this) == _crewtype //This does NOT work!
(typeof _this) in _crewtype  //This does work!

Share this post


Link to post
Share on other sites

oops nvm, didn't read neos post correctly

Edited by Iceman77
nvm

Share this post


Link to post
Share on other sites
Sign in to follow this  

×