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

[Solved] Limit an item

Status
Not open for further replies.
Level 10
Joined
Jun 20, 2017
Messages
333
Any ideas + Rep

How to limit an item?
  • Cant Buy Item Copy
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item level of (Item being manipulated)) Greater than (>) 1
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by (Hero manipulating item) of type Gold of Wall)) Equal to (==) Gold of Wall
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Gold of Wall)
          • Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: |cffFF0000You can n...
        • Else - Actions
 
Last edited:
Level 28
Joined
Feb 18, 2014
Messages
3,580
This might work...
  • Trigger 1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Gold of Wall
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on Trigger 2 <gen>
  • Trigger 2
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Gold of Wall) Equal to TRUE
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated)))
        • Else - Actions
          • Do nothing
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
This might work...
  • Trigger 1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Gold of Wall
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on Trigger 2 <gen>
  • Trigger 2
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Gold of Wall) Equal to TRUE
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated)))
        • Else - Actions
          • Do nothing

I would not suggest this solution but if you insist you can still use:
Item - Remove Item being manipulated

Maybe that does not work for items in inventory so perhaps the hero action would be safer, but point is that item being manipulated is the more efficient reference.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Yeah I figured out that much.

What is relevant however is knowing how much of the trigger works. (debug with messages)
Does the trigger pass the first condition, or is the problem with the second conditions in the actions block.

Because I think the second part should work, probably.

And the first one is map specific so I cannot really tell if it is correct or not.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,889
Do you even check what you're doing when you made the trigger? You are comparing item levels, not how many items of the same type the unit has.
However, I bring you the heaven with the solution.
  • Greedy Limiter
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Potion of Healing
    • 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 being manipulated) Not equal to (Item carried by (Triggering unit) in slot (Integer A))
              • (Item-type of (Item being manipulated)) Equal to (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
            • Then - Actions
              • Game - Display to (All players) the text: HAHA! YOU CAN'T HAV...
              • Hero - Drop (Item being manipulated) from (Triggering unit)
            • Else - Actions
I made a dedicated demo, make sure to play it, beat it and have fun!
 

Attachments

  • Item Limiter.w3x
    20.2 KB · Views: 26

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,889
Yes gold was reduced, but the item was dropped. If you want to refund gold, then you'd better remove the item manipulated else it could be abused to get extra gold.
According to your trigger, it should look like this for a final phase, of course you can add more item types.
  • Greedy Limiter
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Gold of Wall
          • (Item-type of (Item being manipulated)) Equal to Vampiric Shield
    • 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 being manipulated) Not equal to (Item carried by (Triggering unit) in slot (Integer A))
              • (Item-type of (Item being manipulated)) Equal to (Item-type of (Item carried by (Triggering unit) in slot (Integer A)))
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item being manipulated)) Equal to Gold of Wall
                • Then - Actions
                  • Player - Add 100 to (Owner of (Triggering unit)) Current gold
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of (Item being manipulated)) Equal to Vampiric Shield
                    • Then - Actions
                      • Player - Add 500 to (Owner of (Triggering unit)) Current gold
                    • Else - Actions
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Can't do that
              • Hero - Drop (Item being manipulated) from (Triggering unit) //Remove = (Item beingManupulated) ???
            • Else - Actions
Also, what the hell does Gold of Wall means?! I guess you meant Wall of Gold :D
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,889
You're removing the item carried by hero (hero manipulating item) of type and not the acquired item, you just need
  • Item - Remove (Item being manipulated)
Equivalent to the conditions you use for item type, should be
  • (Item-type of (Item being manipulated)) Equal to Gold of Wall
instead of
  • (Item-type of (Item carried by (Hero manipulating unit) of type Gold of Wall)) Equal to Gold of Wall
which will always return true
 
Last edited:
Status
Not open for further replies.
Top