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

Pick Every Item - Pick 1 Item?

Status
Not open for further replies.
Level 1
Joined
Jan 18, 2008
Messages
4
Not sure if this post goes here or in the helper trigger creation forum.

Ok I probably dont need the "random 1 unit" bit. And I added the random Item hoping it would help, wich it seemed to when there was only two Crates, but htat coudl have been a randomizer issue.

When a 'trap blueprint unit' "enters playable map area"
I wanted 1 Imp to grab 1 Crate near the Workshop, regardless of how many Crates are there.

What happens now is for every Crate near the Workshop an Imp moves toward the Crates.
example if there are 2 Crates then two imps move, up to about 10 imps can move towards 10 Crates, but I think some are targeting the same crates since only 8 pick them up.

I just want 1 Imp to pick up 1 Crate!

I think the problem is the "Pick Every Item" function when all I need to do is just pick 1 item, but how?

  • Untitled Trigger 003
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Freeze Trap Blueprint
    • Actions
      • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Workshop) and do (Actions)
        • Loop - Actions
          • Item - Pick every item in (Region centered at (Position of (Picked unit)) with size (401.00, 401.00)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Picked item)) Equal to Freeze Trap Crate
                • Then - Actions
                  • Unit - Order (Random unit from (Random 1 units from (Units owned by (Owner of (Triggering unit)) of type Imp))) to Right-Click (Random item in (Region centered at (Position of (Picked unit)) with size (401.00, 401.00)) matching ((Item-type of (Picked item)) Equal to (Item-type of (Picked item))))
                • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I tried this kind of trigger, I had ten paladins and ten claws of attack:

  • Heroes items pick up
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set ItemPickers = (Units in ItemPickersHere <gen>((Unit-type of (Matching unit)) Equal to Paladin))
      • Set WorkLocation = (Random point in GoToWork <gen>)
      • Unit Group - Pick every unit in ItemPickers and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has an item of type Claws of Attack +15) Equal to True
            • Then - Actions
              • Unit - Order (Picked unit) to Move To WorkLocation
            • Else - Actions
              • Unit - Order (Picked unit) to Pick Up (Compatibility) (Random item in ItemsHere <gen> matching ((Item-type of (Matching item)) Equal to Claws of Attack +15))
      • Custom script: call DestroyGroup(udg_ItemPickers)
      • Custom script: call RemoveLocation(udg_WorkLocation)
Sure enough, everyone picked one claw and ran to the other location. I hope this helps.
 
Level 1
Joined
Jan 18, 2008
Messages
4
"That'll do, donkey. That'll do"

  • Untitled Trigger 003
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Spike Trap
    • Actions
      • Unit - Order (Random unit from (Units owned by (Owner of (Triggering unit)) of type Imp)) to Right-Click (Random item in (Region centered at (Position of (Random unit from (Units owned by (Owner of (Triggering unit)) of type Workshop))) with size (401.00, 401.00)) matching ((Item-type of (Matching item)) Equal to Spike Trap Crate))
thats looks more like what im using now
I'll check the leakable forums to see if I still need location leakstopper.
I think I was just trying to make it too complex


Maker, yours seems good for ordering a group to pick up items without "fighting" over the same item. Altho, instead of looping it every 2 seconds, could the event be "Unit Aquires Item" Then you just have to order 1 unit to pick up an item and the rest of the group monkey see monkey do. Good for GROUP managing, I think.

Thanx to everyone!
 
Status
Not open for further replies.
Top