• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Solved] Item Limit Trigger (Needs Fix)

Status
Not open for further replies.
Level 5
Joined
Apr 11, 2011
Messages
107
What i want here is a system that only allows any unit to have 1 item of any type (except for charged).
example "billy" has an artifact in his hero inventory. he tries to pick up another artifact item, and cannot. if he were to drop his artifact (lets say artifact1), he could pick up the other artifact (artifact2, respectively). what i have below can be glitched and allow the hero to have both artifact1 and artifact2 if he receives the item from another inventory or if he drops an item of another type and then picks up the second artifact.

the map is also attached if you want to open it up and test. im all for you fixing it and uploading a fixed map too ;)

  • Artifact1
    • Events
      • Unit - A unit owned by Player 1 (Red) Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of (Item being manipulated)) Equal to Artifact
          • Artifact Equal to True
        • Then - Actions
          • Trigger - Turn off Artifact2 <gen>
          • Item - Move (Item being manipulated) to (Position of (Triggering unit))
          • Wait 0.01 seconds
          • Trigger - Turn on Artifact2 <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-class of (Item being manipulated)) Equal to Artifact
              • Artifact Equal to False
            • Then - Actions
              • Set Artifact = True
            • Else - Actions
  • Artifact2
    • Events
      • Unit - A unit owned by Player 1 (Red) Loses an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of (Item being manipulated)) Equal to Artifact
          • Artifact Equal to True
        • Then - Actions
          • Set Artifact = False
          • Wait 0.01 seconds
        • Else - Actions
          • Set Artifact = False
 

Attachments

  • Item&wep system needs fix.w3x
    260.5 KB · Views: 88
Level 5
Joined
Apr 11, 2011
Messages
107
Heres the one i ended up using, thanks for your direction :) (+rep)

  • All in 1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of (Item being manipulated)) Equal to Permanent
        • Then - Actions
          • Set Permanent = 0
          • For each (Integer Slot_Integer) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-class of (Item carried by (Hero manipulating item) in slot Slot_Integer)) Equal to Permanent
                • Then - Actions
                  • Set Permanent = (Permanent + 1)
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of (Item being manipulated)) Equal to Permanent
          • Permanent Greater than 1
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
        • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You could try modify it to be like this:

  • All in 1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of (Item being manipulated)) Equal to Permanent
        • Then - Actions
          • Set Permanent = 0
          • For each (Integer Slot_Integer) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-class of (Item carried by (Hero manipulating item) in slot Slot_Integer)) Equal to Permanent
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Permanent equal to 1
                    • Then - Actions
                      • Hero - Drop (Item being manipulated) from (Hero manipulating item)
                      • Skip remaining actions
                    • Else - Actions
                      • Set Permanent = (Permanent + 1)
                • Else - Actions
        • Else - Actions
 
Level 5
Joined
Apr 11, 2011
Messages
107
maker, i have a very mixed emotion for you festering in myself. i hate you because i just went through and did the trigger (my way) for each item type. now i have to go and do them all your way. +rep :)
 
Status
Not open for further replies.
Top