Jump to content
Sign in to follow this  
Spriterfight

HELP ammo with forEach returns nothing

Recommended Posts

_all = {_x ammo "1715_Seapat"} forEach _musketers;
hint format["%1", _all];

so i want the loaded ammo count for each unit from a gorup.If i loop throug them the script returns nothing but if i run the ammo code individually like this _ammocount = _musketer ammo "1715_Seapat"; it returns the loaded ammo.How can i return all the loaded ammo from a group?

Share this post


Link to post
Share on other sites

 

_all = 0;

{

_all  = _all + (_x ammo "1715_Seapat");

} forEach _musketers;


hint format["%1", _all];

 

should do it, code not tested

 

  • Like 1

Share this post


Link to post
Share on other sites
12 minutes ago, gc8 said:

 


_all = 0;

{

_all  = _all + (_x ammo "1715_Seapat");

} forEach _musketers;


hint format["%1", _all];

 

should do it, code not tested

 

my squad conatins two unit the player and the teammate.If i fire it retruns 0 but it sohuld return 1 because my teammate 

hasn't shot yet.The 1715_Seapat has only 1 round in the magazine.

Share this post


Link to post
Share on other sites
13 minutes ago, Spriterfight said:

my squad conatins two unit the player and the teammate.If i fire it retruns 0 but it sohuld return 1 because my teammate 

hasn't shot yet.The 1715_Seapat has only 1 round in the magazine.

Meanwhile i realised the rifle was not  1715_Seapat so i renamed it and now works.Thank you

 

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  

×