• 🏆 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!

Item class

Status
Not open for further replies.
Level 4
Joined
Mar 30, 2011
Messages
63
Good afternoon, I have a question, how to make that unit could not pick up 2 items from one class.
 
Level 8
Joined
Jul 8, 2013
Messages
249
Good afternoon, I have a question, how to make that unit could not pick up 2 items from one class.
Good afternoon, I have an answer!

Use something like this:

  • Item Classes and Dropping
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Triggering unit) in slot 1))
              • (Item carried by (Triggering unit) in slot 1) Not equal to (Item being manipulated)
          • And - All (Conditions) are true
            • Conditions
              • (Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Triggering unit) in slot 2))
              • (Item carried by (Triggering unit) in slot 2) Not equal to (Item being manipulated)
          • And - All (Conditions) are true
            • Conditions
              • (Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Triggering unit) in slot 3))
              • (Item carried by (Triggering unit) in slot 3) Not equal to (Item being manipulated)
          • And - All (Conditions) are true
            • Conditions
              • (Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Triggering unit) in slot 4))
              • (Item carried by (Triggering unit) in slot 4) Not equal to (Item being manipulated)
          • And - All (Conditions) are true
            • Conditions
              • (Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Triggering unit) in slot 5))
              • (Item carried by (Triggering unit) in slot 5) Not equal to (Item being manipulated)
          • And - All (Conditions) are true
            • Conditions
              • (Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Triggering unit) in slot 6))
              • (Item carried by (Triggering unit) in slot 6) Not equal to (Item being manipulated)
    • Actions
      • Hero - Drop (Item being manipulated) from (Triggering unit)

Basically, when the unit picks up an item, the item is immediately dropped if it is the same class as any OTHER item the unit already has.

Thus a unit can never have two items of the same class.
 

sentrywiz

S

sentrywiz

@Melth - This is a very bare-bones solution. it is also inefficient and can resolve multiple times. a loop would be better.

Here is my take on this. Much more efficient and clean:

  • item block and drop
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer INT_TEMP) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item being manipulated) Not equal to (Item carried by (Triggering unit) in slot INT_TEMP)
              • (Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Triggering unit) in slot INT_TEMP))
            • Then - Actions
              • Hero - Drop (Item being manipulated) from (Triggering unit)
              • Custom script: exitwhen true
            • Else - Actions
      • Set INT_TEMP = 0
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
Best solution is mine since I am using it in my map to prevent the picking of similar items (no matter what class/category). It is very flexible, easy to create and fully-functional. Create an event "Unit - A unit Acquires an item" then do the following actions:


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Item-type of (Item being manipulated)) Equal to [Item 1]
      • ((Hero manipulating item) has an item of type [Item 1] Equal to True
    • Then - Actions
      • Hero - Drop (Item being manipulated) from (Hero manipulating item)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Hero manipulating item) has an item of type [Item 1]) Equal to False
          • ((Hero manipulating item) has an item of type [Item 2]) Equal to False
        • Then - Actions
          • Hero - Give (Item being manipulated) to (Hero manipulating item)
        • Else - Actions
    • Else - Actions
Where [Item 1] and [Item 2] cannot be picked together. You may other items of course in the set of conditions to prevent them from being picked together [Item 3, 4, 5 etc...). so that even if they are of different classes/categories, it will work anyway.
 
Level 4
Joined
Mar 30, 2011
Messages
63
I myself tried to do but failed (
 

Attachments

  • 1.w3x
    17.6 KB · Views: 109

sentrywiz

S

sentrywiz

@Shadow Fury - how is your solution best?
i don't even understand what your solution is frankly. why do you drop an item then have a condition to give it back?

also I tested my solution, and works like a charm.
no init variables of item classes or items needed before hand, which I guess is how your solution works.
 
Level 4
Joined
Mar 30, 2011
Messages
63
Here is the same test map with my solution.

EDIT: Didn't think a few triggers would increase the filesize by so much.

Thanks, but that's not what I need, it is necessary to take the unit could not carry items of a one class

im rus. sorry for bad english)
 
Last edited by a moderator:

sentrywiz

S

sentrywiz

Thanks, but that's not what I need, it is necessary to take the unit could not carry items of a one class

Try my solution. I tested it, and it only works with one trigger.
You don't need anything else.
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
Mine also works with one trigger and has no variables. It is based on the fact that when you pick the item, you drop it, if you have one of the forbidden items, the item is not repicked. Otherwise it is repicked. That's how it works. Well, now it's up to you to decide which you prefer, I offered my solution.
 

sentrywiz

S

sentrywiz

Mine also works with one trigger and has no variables. It is based on the fact that when you pick the item, you drop it, if you have one of the forbidden items, the item is not repicked. Otherwise it is repicked. That's how it works. Well, now it's up to you to decide which you prefer, I offered my solution.

Yeah, but your solution relies on specified items, rather than an item class. That's why its not practical, unless you have
an entire array of variables with all the items. In anycase you will still have to loop through them.

Can you upload your solution I do not understand how to do some of the conditions.

Here you go.

INT_TEMP is an integer used in the loop. the native integer A/B usually bug out when used

exitwhen true is a custom script to exit the loop when an item of same class is found. The rest you should understand
 

Attachments

  • item class.w3x
    16.6 KB · Views: 52

Ardenian

A

Ardenian

Sure, though its not always that a system is the best solution.
Its the user's choice.

IDS is recommended for complex RPG systems and item class systems.
If you only have two or three classes, then it might be not the best solution.
 
Status
Not open for further replies.
Top