• 🏆 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 limit problem

Status
Not open for further replies.
Level 14
Joined
Jan 8, 2015
Messages
424
Hi, i have an issue, i want to make certain item impossible to by by certain unit hero if it already owns one. I would like to use it for some weapons and armour so it wont be spammed to have more damage. LIke hero has already a gun type weapon and he can have nor 2 of same weaps but also cant buy other gun while carrying forementioned one. How to restrict it in triggers?

If there is thread for that sorry but i could find one covering this problem
 
Level 10
Joined
Apr 4, 2010
Messages
509
Go boolean, I'm sure theres a condition that says Unit has specific item equal to true, or you can do integer condition to see if the unit is holding greater than 1. Or you can make a group, if unit is already in the group, then drop item.
 
Level 6
Joined
Aug 5, 2015
Messages
202
this for same type of item
+rep pls if you are satisfied :p

  • ItemOnce Item 1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Whatever Item
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
              • (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
            • Then - Actions
              • Hero - Drop the item from slot (Integer A) of (Hero manipulating item)
              • Quest - Display to (Player group((Owner of (Hero manipulating item)))) the Warning message: Sorry, You can't ha...
            • Else - Actions
and this for group of item

  • ItemOnce Group
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Value
    • Actions
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Value
            • Then - Actions
              • For each (Integer B) from ((Integer A) + 1) to 6, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer B))) Equal to Value
                    • Then - Actions
                      • Hero - Drop the item from slot (Integer B) of (Hero manipulating item)
                      • Quest - Display to (Player group((Owner of (Hero manipulating item)))) the Warning message: Sorry, You can only...
                    • Else - Actions
            • Else - Actions
 
Level 14
Joined
Jan 8, 2015
Messages
424
this for same type of item
+rep pls if you are satisfied :p

  • ItemOnce Item 1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Whatever Item
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
              • (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
            • Then - Actions
              • Hero - Drop the item from slot (Integer A) of (Hero manipulating item)
              • Quest - Display to (Player group((Owner of (Hero manipulating item)))) the Warning message: Sorry, You can't ha...
            • Else - Actions
and this for group of item

  • ItemOnce Group
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Value
    • Actions
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Value
            • Then - Actions
              • For each (Integer B) from ((Integer A) + 1) to 6, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer B))) Equal to Value
                    • Then - Actions
                      • Hero - Drop the item from slot (Integer B) of (Hero manipulating item)
                      • Quest - Display to (Player group((Owner of (Hero manipulating item)))) the Warning message: Sorry, You can only...
                    • Else - Actions
            • Else - Actions

Didnt work, i needed to swap type to class cuz it's just few items i want to restrict from stacking. Nothing happens, i set items in artifact and powerup classes and nothing happens when i buy 2 of same class. How to fix it? Here is the trigger.(items in these classes from stock game are impossible to aquire or move to other categories, only these few are in two classes(two separate triggers). None of them works
 

Attachments

  • TRIGGER.png
    TRIGGER.png
    27.9 KB · Views: 80
Level 21
Joined
Nov 4, 2013
Messages
2,017
In my map, I use some triggers to do that. When your hero acquires this item, let him drop it. Check if he has that type of item. If not, give the dropped item back. If yes, do nothing. Here it is:

  • Events
    • Unit - A unit Acquires an item
  • Conditions
  • Actions
    • Trigger - Turn off (This trigger)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Item-type of (Item being manipulated)) Equal to [Your Item]
        • ((Hero manipulating item) has an item of type [Your Item]) 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 [Your Item]) Equal to False
          • Then - Actions
            • Hero - Give (Item being manipulated) to (Hero manipulating item)
          • Else - Actions
      • Else - Actions
    • Trigger - Turn on (This trigger)
In the first set of conditions you add all the items the hero must not have to pick the required item.
 
Level 11
Joined
Jan 23, 2015
Messages
788
Make a custom item based on a rune, remove the rune's ability and put your limited item description, price and all that stuff, but without a model.. make another custom item but base it on item, and make it the same like the rune, but with a model ofc.. put the rune in your shop..

when the hero buys the item (the rune), check if the unit already owns an item of that type, and if it doesn't, create the item (based on item) and give it to the hero.. if the hero already owns the item, just give him the gold needed for the item back and don't create any item..
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
I use This in my own map and it Works.


  • IN Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set IN_ItemClass_String[1] = |cFFFF0000Helmet|r
      • Set IN_ItemClass_String[2] = |cFF6A798BArmor|r
      • Set IN_ItemClass_String[3] = |cFF7EBFF1Main-Hand|r
      • Set IN_ItemClass_String[4] = |cFF1CE6B9Off-Hand|r
      • Set IN_ItemClass_String[5] = |cFF00FF00Trinket|r
      • Set IN_ItemClass_String[6] = |cFF4E2A04Pair of Boots|r
  • Acquiring
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Not equal to Powerup
    • Actions
      • Set IN_Item_Index = 0
      • Set IN_Item_Slot = 0
      • For each (Integer IN_ItemClass_Index) from 1 to 7, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item level of (Item being manipulated)) Equal to IN_ItemClass_Index
            • Then - Actions
              • For each (Integer IN_Item_Slot) 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 (Triggering unit) in slot IN_Item_Slot)) Equal to IN_ItemClass_Index
                    • Then - Actions
                      • Set IN_Item_Index = (IN_Item_Index + 1)
                    • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IN_Item_Index Greater than 1
                • Then - Actions
                  • Hero - Drop (Item being manipulated) from (Triggering unit)
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: (|cFFFFCC00You can only Carry 1|r + (IN_ItemClass_String[IN_ItemClass_Index] + |cFFFFCC00.|r))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Item-class of (Item being manipulated)) Equal to Miscellaneous
                          • IN_ItemClass_Index Equal to 5
                          • And - All (Conditions) are true
                            • Conditions
                              • (Item-class of (Item being manipulated)) Equal to Permanent
                              • (Unit-type of (Triggering unit)) Equal to |cFFFF0000Warrior|r
                          • And - All (Conditions) are true
                            • Conditions
                              • (Item-class of (Item being manipulated)) Equal to Artifact
                              • Or - Any (Conditions) are true
                                • Conditions
                                  • (Unit-type of (Triggering unit)) Equal to Mage
                                  • (Unit-type of (Triggering unit)) Equal to |cFFFFCC00Priest|r
                          • And - All (Conditions) are true
                            • Conditions
                              • (Item-class of (Item being manipulated)) Equal to Campaign
                              • (Unit-type of (Triggering unit)) Equal to Ranger
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Or - Any (Conditions) are true
                            • Conditions
                              • IN_ItemClass_Index Equal to 3
                              • IN_ItemClass_Index Equal to 4
                              • IN_ItemClass_Index Equal to 7
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • IN_ItemClass_Index Equal to 3
                            • Then - Actions
                              • For each (Integer IN_Item_Slot) 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 (Triggering unit) in slot IN_Item_Slot)) Equal to 7
                                    • Then - Actions
                                      • Set IN_Item_Index = (IN_Item_Index + 1)
                                    • Else - Actions
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • IN_ItemClass_Index Equal to 4
                                • Then - Actions
                                  • For each (Integer IN_Item_Slot) 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 (Triggering unit) in slot IN_Item_Slot)) Equal to 7
                                        • Then - Actions
                                          • Set IN_Item_Index = (IN_Item_Index + 1)
                                        • Else - Actions
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • IN_ItemClass_Index Equal to 7
                                    • Then - Actions
                                      • For each (Integer IN_Item_Slot) 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 (Triggering unit) in slot IN_Item_Slot)) Equal to 4
                                            • Then - Actions
                                              • Set IN_Item_Index = (IN_Item_Index + 1)
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Item level of (Item carried by (Triggering unit) in slot IN_Item_Slot)) Equal to 3
                                                • Then - Actions
                                                  • Set IN_Item_Index = (IN_Item_Index + 1)
                                                • Else - Actions
                                    • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • IN_Item_Index Greater than 1
                            • Then - Actions
                              • Hero - Drop (Item being manipulated) from (Triggering unit)
                              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cFFFFCC00You Eithe...
                            • Else - Actions
                              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: (|cFFFFCC00Acquired:|r + (Name of (Item being manipulated)))
                        • Else - Actions
                          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: (|cFFFFCC00Acquired:|r + (Name of (Item being manipulated)))
                    • Else - Actions
                      • Hero - Drop (Item being manipulated) from (Triggering unit)
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cFFFFCC00Your Clas...
            • Else - Actions



Hope I helped.

Another thread like this.
NOTE: It has Player Group Leaks, Which are Currently Fixed.

How it works:
Item Level 1: helmet
Item Level 2: armor
Item Level 3: Main-hand
Item Level 4: Off-hand
Item Level 5: Trinket
Item Level 6: Boots
Item Level 7: Two-handed

All of them have Material types which are specified for certain Classes:

Metal (Permanent): Warrior
Leather (Artifact): Ranger
Cloth (Campaign): Wizard/Priest
Doesn't matter which Class is it used for (Miscellaneous)
Trinkets also don't care whether it is for Which class.


AND: You can wield whether a Main-hand, and an Off-hand, OR a Two-handed. with a Two-handed you cannot wield an Off-hand or Main-hand.


Hope this Helps.

PS: We three (Shadow Fury, RobertKMD or Me) have waaaay too different systems and Ideas. Mine is Simpler than RobertKMD's and has a Wider use than Shadow Fury's IMO. You can Decide yourself.
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
You cannot even imagine how straightforward mine is. Your system only restricts people from picking items of the same integer but mine allows you to choose as many items that cannot be picked together as you want. It's also a hell lot of work to construct compared to mine. Voting for my own method :wink:
 
Level 14
Joined
Jan 8, 2015
Messages
424
In my map, I use some triggers to do that. When your hero acquires this item, let him drop it. Check if he has that type of item. If not, give the dropped item back. If yes, do nothing. Here it is:

  • Events
    • Unit - A unit Acquires an item
  • Conditions
  • Actions
    • Trigger - Turn off (This trigger)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Item-type of (Item being manipulated)) Equal to [Your Item]
        • ((Hero manipulating item) has an item of type [Your Item]) 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 [Your Item]) Equal to False
          • Then - Actions
            • Hero - Give (Item being manipulated) to (Hero manipulating item)
          • Else - Actions
      • Else - Actions
    • Trigger - Turn on (This trigger)
In the first set of conditions you add all the items the hero must not have to pick the required item.
Thanks, i think i will go with your's tough i have like 3 items of this group which cannot be used together(3 guns, and i want to force usage of one at the time, same with armour(also 3 pieces only) and do i need just to add more condition which them? or it's possible to make group restriction work? It's just 3 guns and 3 armours which i want to limit(ppl were running with like 3 shotguns and 3 armours on my map and i want to avoid that).

2nd post
You cannot even imagine how straightforward mine is. Your system only restricts people from picking items of the same integer but mine allows you to choose as many items that cannot be picked together as you want. It's also a hell lot of work to construct compared to mine. Voting for my own method :wink:
Works great all i needed is to make separate trigger(for each gun but it's great, integers were unnessesarily complicated and didnt work at all) with only one condition changed for each item and it works as i wanted +rep for you :)
Sorry i was away for longer while, so kinda late thanks to you :v
 
Last edited:
Level 21
Joined
Nov 4, 2013
Messages
2,017
Works great all i needed is to make separate trigger with only one condition changed for each item and it works as i wanted +rep for you :)
Sorry i was away for longer while, so kinda late thanks to you :v

No problem, just make sure you do not double post again because it is forbidden by the Site Rules. If you could please merge your posts using the Edit button... :)
 
Status
Not open for further replies.
Top