• 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.

[Trigger] Auto-pic up of items for non-hero units.

Status
Not open for further replies.
Level 8
Joined
Feb 20, 2007
Messages
338
I have enemy units that drop 12 types of items upon their decay/death (creep drop upon death via object editor). They are given the hero inventory and classification of 'a hero' upon creation.

I have 5 types of non-hero units that have back back abilities - they are able to carry 2 items.

The trigger below is what I have tried, mind the italics function I tried first and then I tried the other one.

  • ItemDrop
    • Events
      • Unit - A unit owned by Player 10 (Light Blue) Loses an item
    • Conditions
      • (Item-class of (Item being manipulated)) Not equal to Powerup
    • Actions
      • Item - Set the custom value of (Item being manipulated) to 2
      • [I]Unit - Order (Random unit from (Units within 2000.00 of (Position of (Last dropped item)))) to Right-Click (Item being manipulated)[/I]
      • Hero - Give (Last dropped item) to (Random unit from (Units within 2000.00 of (Position of (Last dropped item))))
I've tried is as manipulated item and as dropped item.

How can I get non-hero units to automatically pick up these dropped items?
 
Level 8
Joined
Feb 20, 2007
Messages
338
Nope. didn't work.

I used:

  • ItemDrop Copy
    • Events
      • Unit - A unit owned by Player 10 (Light Blue) Loses an item
    • Conditions
      • (Item-class of (Last dropped item)) Not equal to Powerup
    • Actions
      • Item - Set the custom value of (Item being manipulated) to 2
      • Unit - Order (Random unit from (Units within 2000.00 of (Position of (Last dropped item)))) to Right-Click (Last dropped item)
All the units just stood there.

I am also using:

  • ItemRemove
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked item) is owned) Equal to False
              • ((Picked item) is invulnerable) Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Custom value of (Picked item)) Less than or equal to 0
                • Then - Actions
                  • Item - Remove (Picked item)
                • Else - Actions
                  • Item - Set the custom value of (Picked item) to ((Custom value of (Picked item)) - 1)
            • Else - Actions
This removes all the excess/unclaimed items on the map after about minute. At the least the item sits there 30 seconds.

I'm thinking it has something to do with how these items are being generated.

Upon creation of the enemy units that carry these items, I add the classification of 'A Hero' to them, give them the hero pack-back and they use the items (Claws of attack, boots of speed, orb of frost, etc). These are neutral hostile creep units. I also give them power-up for more health upon their creation.

When these 'enemy' units die the items do not just appear, instead its not until their bodies decay when the items appear on the map.
 
Level 8
Joined
Feb 20, 2007
Messages
338
Ok I did a few experiments, instead of attempting to get other units to pick up the items, I decided to immediately remove the items with:

  • ItemDrop Copy
    • Events
      • Unit - A unit owned by Player 10 (Light Blue) Loses an item
    • Conditions
      • (Item-class of (Last dropped item)) Not equal to Powerup
    • Actions
      • Item - Remove (Last dropped item)
The items where not removed - they just stacked up on the map.

I have attempted using 'manipulated item' in all of the spaces, and they still remain.
 
Level 11
Joined
Nov 15, 2007
Messages
800
  • Events
    • Unit - A unit dies
  • Conditions
    • Whatever conditions
  • Actions
    • For every [Integer A] from 1 to 6 do Remove item from (dying unit's) inventory in slot (Integer A) from the game.
I wrote this in a hurry but I think you get the gist of it. If all you need to do is remove items this should work.
 
Level 8
Joined
Feb 20, 2007
Messages
338
Yeah I get the gist of that Meticulous.

I tested just removing items that my enemy bodies leave around to try to figure out what command function I actually need to reference those items that have dropped from a dying/decaying unit. Last dropped, Manipulated?

The reality is is that I want units within 2000 (that's about 4 large squares in the map editor) of the item to pick up items - be it the left over enemy units, or be it the player's non hero units.

It seems that while I can set the custom value of items via 'player loses an item' being those items that those decaying bodies leave, getting other units to pick-up (right click???) those items is not working. and it appears removing those items instantly via that trigger is not working. I want to know why it isn't working do I can cobble together a non-hero unit pick-up system.
 
Level 11
Joined
Nov 15, 2007
Messages
800
  • trigger
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set point = (Position of (Dying unit))
      • Set unitgroup = (Units within 2000.00 of aa_point matching (((Matching unit) is alive) Equal to (==) True))
        • Do Multiple ActionsFor each (Integer A) from 1 to 6, do (Actions)
          • Loop - Actions
            • Item - Create (Item-type of (Item carried by (Dying unit) in slot (Integer A))) at point
            • Item - Remove (Item carried by (Dying unit) in slot (Integer A))
            • Unit - Order (Random unit from unitgroup) to Right-Click (Last created item)
      • Custom script: call RemoveLocation(udg_point)
      • Custom script: call DestroyGroup(udg_unitgroup)
That'll work.

Issues: will interrupt unit orders, including canceling channeling spells. If a unit dies on its way to pick up an item the item will remain on the ground. Units with full inventory can be ordered to pick up the item.
 
Level 8
Joined
Feb 20, 2007
Messages
338
That'll work.

Issues: will interrupt unit orders, including canceling channeling spells. If a unit dies on its way to pick up an item the item will remain on the ground. Units with full inventory can be ordered to pick up the item.

I was expecting units to 'stop' what ever they are doing when they are picked to pick up an item. And I am expecting some items to be left over per round or wave of creeps - thus I have my item removal trigger removing excess items (left overs) every couple of rounds.

Kind of odd that I cannot call or reference items that automatically appear on the map from dying/decaying units. Having to create 'new' items and remove existing ones seems kind of strange to me.

Thanks for your help. Much appreciated.
 
Status
Not open for further replies.
Top