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

Triggers

Status
Not open for further replies.
Level 4
Joined
Nov 17, 2015
Messages
91
Hey, Beeszbuzz here. I'd like it so if a unit attempts to pick up an item, but already has an item of specified type, then said item does not move into his inventory. Can you put this into triggers? Pictures appreciated, and thanks! :goblin_good_job:
 

ILH

ILH

Model Reviewer
Level 26
Joined
May 8, 2012
Messages
1,245
Try to ask someone to optimize this :p
  • SpecificConfig
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SpecItems[1] = Claws of Attack +15
      • Set SpecItems[2] = Crown of Kings +5
      • Set SpecItemsTotal = 2
  • SpecificPrevent
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer A) from 1 to SpecItemsTotal, do (Actions)
        • Loop - Actions
          • Set SpecTempInt = 0
          • For each (Integer B) 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 (Triggering unit) in slot (Integer B))) Equal to SpecItems[(Integer A)]
                • Then - Actions
                  • Set SpecTempInt = (SpecTempInt + 1)
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SpecTempInt Greater than 1
            • Then - Actions
              • Hero - Drop (Item being manipulated) from (Triggering unit)
              • Game - Display to (Player group((Triggering player))) the text: Can't pick up item
            • Else - Actions
Attached test-map just in case
 

Attachments

  • BeeszBuzz's Request.w3x
    18.3 KB · Views: 34
Level 4
Joined
Nov 17, 2015
Messages
91
Try to ask someone to optimize this :p
  • SpecificConfig
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SpecItems[1] = Claws of Attack +15
      • Set SpecItems[2] = Crown of Kings +5
      • Set SpecItemsTotal = 2
  • SpecificPrevent
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer A) from 1 to SpecItemsTotal, do (Actions)
        • Loop - Actions
          • Set SpecTempInt = 0
          • For each (Integer B) 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 (Triggering unit) in slot (Integer B))) Equal to SpecItems[(Integer A)]
                • Then - Actions
                  • Set SpecTempInt = (SpecTempInt + 1)
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SpecTempInt Greater than 1
            • Then - Actions
              • Hero - Drop (Item being manipulated) from (Triggering unit)
              • Game - Display to (Player group((Triggering player))) the text: Can't pick up item
            • Else - Actions
Attached test-map just in case

Wow! No way I could've figured this out on my own! Thanks!!! :goblin_good_job:
 
Status
Not open for further replies.
Top