• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How do i make hero only able to use 1 of an item?

Status
Not open for further replies.
Level 19
Joined
Feb 15, 2008
Messages
2,184
i gona have like 5 diffrent items. how do i make so that the hero only can use one item of this item at time.

Its because i have diff wepaons on those items.

And note im using other items to. so i need good solution.

For example.

Sword
Axe
Hammer
Club
Mace

It wont look good if the hero have sword + axe + hammer + club + mace at same time.

How can i solve this?

Or is there any other good solution for this?
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
An easy and efficient way is to use Item levels.
Every item has "Stats - Level" which doesn't really serve anything important for the item itself. However you may use it as a category.
For example -> weapons will be items with level 1, armor will have level 2, potions level 3, etc.

Then when hero picks up an item, you check if he doesn't already have an item with same level, if yes, make him drop picked item.


Edit
Something like this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set unit_var = (Triggering unit)
      • Set item_var = (Item being manipulated)
      • For each (Integer loopInt) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item level of (Item carried by unit_var in slot loopInt)) Equal to (Item level of item_var)
              • (Item carried by unit_var in slot loopInt) Not equal to item_var
            • Then - Actions
              • Hero - Drop item_var from unit_var
            • Else - Actions
      • Set unit_var = No unit
      • Set item_var = No item
 

Attachments

  • ItemRestriction.w3x
    16.6 KB · Views: 33
Last edited:
Status
Not open for further replies.
Top