Jump to content
R4IDER

Counting inventory items

Recommended Posts

Hi,

I am currently making a mission where I would like to limit the amount of items that a player can carry so for example I would only like a player to carry a maximum of 2 first aid kits how would I go about counting the number of kits in a players inventory?

Share this post


Link to post
Share on other sites

Something like this should do

limit = 2;
numberOfKits = {"FirstAidKit" == _x} count (items player);
if (numberOfKits > limit) then {
for "_i" from 1 to (numberOfKits - limit) do {
	player removeItem "FirstAidKit";
};
};

Share this post


Link to post
Share on other sites

Please RISE !! , RISE from the DEAD !!

 

ok, enough of that,

 

I have a trigger condition that activates a task as succeeded. The condition:

 

"SatchelCharge_Remote_Mag" in magazines player

 

Thats all fine and good. No problems there...  But I don't want to activate the trigger until the player has acquired three charges. (or however many)

 

I tried just doing:  "SatchelCharge_Remote_Mag, 3"...    but I'm sure you can figure out how that went.   I'm thinking I need to sort of follow what Larrow posted above? I know part of his code was deleting objects that went above 2, so that would have to be removed.

 

Any ideas? Simple ones are always better!

 

Thank you,

Fire

 

Share this post


Link to post
Share on other sites

Are you a necromancer?  :smiley-evil:

 

{_x == "SatchelCharge_Remote_Mag"} count magazines player > 2

 

That should do it, now get back to Hades!

  • Like 2

Share this post


Link to post
Share on other sites

@das attorney

 

Ha ha,   couldn't help it   LOL

 

Awesome, I'll give it a shot.  I've been working on a lot of randomization in a mission lately and I've been learning a lot because of it. 

 

Thanks!! 

 

edit:  Right on - Thank you

Edited by FireWalker
confim

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

×