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

Anti pickup system!

Status
Not open for further replies.
Level 4
Joined
Oct 15, 2008
Messages
83
Ok i really need help on this one.

I want a trigger that prevents units from picking up an item if they already got one item of that type in inventory.

Ive had several suggestions about making a trigger that drops the item when equipped.

But what i need is a trigger that PREVENTS units from picking up the item if matching conditions. Ask questions if i am unclear about something and rep + for help.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
  • Anti Pickup
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Target item of issued order) Equal to item
    • Actions
      • Set TempLoc = (Position of (Target item of issued order))
      • Unit - Order (Ordered unit) to Move To TempLoc
      • Custom script: call RemoveLocation(udg_TempLoc)
I guess you can connect the dots, change the condition (you probably need to make an if/then/else-function with the conditions you want), the actions should work.

Edit:
Changed the trigger

Reason:
My previous trigger worked, but the hero (who wants to pick up the item) was ordered to stop - even if he was far away from the item.
That way, it would be hard to move through a field of items, with this trigger it's even easier than normally :)
It's also not really natural (a hero who stops the moment he tries to pick up an item),now he just moves to it, but never picks it up.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Here, I tested it, and it works:

  • PreventItemPick
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • (Target item of issued order) Not equal to No item
    • Actions
      • Set Picker = (Triggering unit)
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 0.00 seconds
  • Stop
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Unit - Order Picker to Stop
Ask if you have some questions.

P.S. If you're wondering why I used a timer, it apparently doesn't work directly (I tested that too).
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Here, I tested it, and it works:

  • PreventItemPick
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • (Target item of issued order) Not equal to No item
    • Actions
      • Set Picker = (Triggering unit)
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 0.00 seconds
  • Stop
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Unit - Order Picker to Stop
Ask if you have some questions.

P.S. If you're wondering why I used a timer, it apparently doesn't work directly (I tested that too).

Hehh, I just tested that myself and found that out :D
Though I think my trigger is easier =(

Well, doesn't really matter xD
 
Level 4
Joined
Oct 15, 2008
Messages
83
Here, I tested it, and it works:

  • PreventItemPick
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • (Target item of issued order) Not equal to No item
    • Actions
      • Set Picker = (Triggering unit)
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 0.00 seconds
  • Stop
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Unit - Order Picker to Stop
Ask if you have some questions.

P.S. If you're wondering why I used a timer, it apparently doesn't work directly (I tested that too).

Going to rep+ you because of the best answer and you tested it be4 you replied. Sweet
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Apoocylpse is right, his solution is better, when you have many items, as it would be hard to move because you would have to avoid clicking on items. In my solution the unit doesn't move at all if you click on an item it can't pick.

It really depends on what effect you want.
 
Status
Not open for further replies.
Top