• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to check if hero has full inventory?

Status
Not open for further replies.
Level 12
Joined
Mar 26, 2005
Messages
790
If I want to make some action only if hero has his inventory full (i.e. has 6 items), what condition is for it or how to make it?


Thx, rep





edit:eek:k, maybe I know, with integer variable, when pick, +1, when loses item, -1, and when variable is 6 then actions...


But are there more solutions?
 
Level 11
Joined
Feb 16, 2009
Messages
760
Here it comes:

  • Inventory check
    • Events
  • [Your events]
    • Conditions
      • (Item carried by [your unit] in slot 1) Not equal to No item
      • (Item carried by [your unit] in slot 2) Not equal to No item
      • (Item carried by [your unit] in slot 3) Not equal to No item
      • (Item carried by [your unit] in slot 4) Not equal to No item
      • (Item carried by [your unit] in slot 5) Not equal to No item
      • (Item carried by [your unit] in slot 6) Not equal to No item
    • Actions
  • [Your actions
That should do it
 
Level 2
Joined
Jan 19, 2009
Messages
15
There is a mistake in that trigger, M4stah. Yo have to use a previous condition, in logic AND condition. All the conditions have to be inside an AND (multiple conditions), to tell the program that you only want to that happend IF ALL THE CONDITIONS ARE TRUE.
Do you know something about logic? Well, in logic in AND prepositions, all the conditions have to be true to something happens.
I hope have been clear. Bye!
 
Level 2
Joined
Jan 19, 2009
Messages
15
I don't think so. I'm programmer and AND is not a default logic operator in any languaje, specially in Jass C++. So, I asume that if it works, is ramdonly but is not the right way to do it...
 
Level 12
Joined
Mar 26, 2005
Messages
790
Heh, I had to be blind when I couldnt find that lol :-D

Both of solutions ofc works, but I will use the second one, couse its shorter.




And conditions must be ALL true to run the actions, so the AND is not neccessary.

Thats different from events.
 
Status
Not open for further replies.
Top