Jump to content
Sign in to follow this  
Kydoimos

Count Magazines then Detect if More Collected

Recommended Posts

Hi there,

 

 

Getting into a bit of a muddle with this one; I know I can count the player's current magazines with:

Magazines_Player = {_x == "30Rnd_556x45_Stanag"} count magazines player

But how would I detect if the player collects more than the original number? Basically, I would like to trigger a script when a player has a specific item - but I want it to trigger only if that item is in addition to any that are already in their inventory when the mission begins.

 

Thanks all! :P

Share this post


Link to post
Share on other sites

Something like this?

_startingMags = {_x == "30Rnd_556x45_Stanag"} count magazines player;

while {true} do {
	if (({_x == "30Rnd_556x45_Stanag"} count magazines player) > _startingMags) then {
		// something happens
	};
	
	sleep 1; // change this if you want
};
  • Like 1

Share this post


Link to post
Share on other sites

 

Something like this?

_startingMags = {_x == "30Rnd_556x45_Stanag"} count magazines player;

while {true} do {
	if (({_x == "30Rnd_556x45_Stanag"} count magazines player) > _startingMags) then {
		// something happens
	};
	
	sleep 1; // change this if you want
};

 

Instead of using a specific mag check, you could use a combination of magazines and currentMagazine to check the player's mags. I don't think that using the check you have already would pick up any tracer mags (i.e. "30Rnd_556x45_Stanag" != "30Rnd_556x45_Stanag_Tracer_Red") and so if the player picked up a trace mag it wouldn't register.

 

Obviously, if you were after a specific check, or loaded extra mag classnames into the check, then Icaruk's answer would be fine.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks ever so much chaps! That'll do the job perfectly! :) I'm sure I actually tried that solution and it didn't work - but I'll give it another shot! Again, thanks guys!

  • Like 1

Share this post


Link to post
Share on other sites

No worries mate. Let us know if you have any other dramas. I'm sure we'd be happy to help.

  • Like 1

Share this post


Link to post
Share on other sites


_startingMags = {_x == "30Rnd_556x45_Stanag"} count magazines player;

waitUntil { ({_x == "30Rnd_556x45_Stanag"} count magazines player) > _startingMags)};

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  

×