• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Only one Item-Type

Status
Not open for further replies.
Level 10
Joined
Nov 24, 2010
Messages
546
Hello everyone

Im trying to make a system that decect when unit allready have item of that type. ( You can carry only 1 sword lets say ).
Permanent = Weapon
Charged = Offhand
Artifact = Head
Purchaseable = Chest
Campaing = Special

Anyone can give me a example on 1 item type? so i can make make rest of triggers i just dont know how to start
 
  • Trigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • 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 (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
              • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
            • Then - Actions
              • -------- Actions here --------
              • Skip remaining actions
            • Else - Actions
 
Level 10
Joined
Nov 24, 2010
Messages
546
If I understood correctly you don't want unit to has more than 1 item of given type., if so that should help you.

Not exactly, lets say There are 5 swords. Unit can carr maximum one sword at time

  • Trigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • 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 (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
              • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
            • Then - Actions
              • -------- Actions here --------
              • Skip remaining actions
            • Else - Actions


Any chance you upload me a demo map? I dont understand this


For each (Integer A) from 1 to 6, do (Actions)
 
Use a Player Group variable (Create in the Variable Editor, Ctrl + B), with a name of e.g. "Group1".
  • Set Group1 = (Player Group(Triggering player))
When you are going to set its value, from the field with the preset functions, scroll to Convert Player Group to Player.
Final output would be something like this:
  • Set Group1 = (Player Group(Triggering player))
  • Game - Display to Group1 the text "You already carry an item of this type."..
  • Custom script: call DestroyForce (udg_Group1)
 
Status
Not open for further replies.
Top