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

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 25
Joined
Sep 26, 2009
Messages
2,383
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: 31
Last edited:
Status
Not open for further replies.
Top