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

How to pick items?

Status
Not open for further replies.
Level 14
Joined
Nov 4, 2006
Messages
1,241
i think you cannot use a circle region here, but sth like this:

  • Set tempregion = (Region centered at (Position of (unit)) with size (200.00, 200.00))
  • Item - Pick every item in tempregion and do actions
    • Loop - Actions
  • Custom script: call RemoveLocation(udg_tempregion)
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
i think you cannot use a circle region here, but sth like this:

  • Set tempregion = (Region centered at (Position of (unit)) with size (200.00, 200.00))
  • Item - Pick every item in tempregion and do actions
    • Loop - Actions
  • Custom script: call RemoveLocation(udg_tempregion)
I tried this one with
  • Unit - Order (Entering Unit) to right-click (Picked Item)
That works as long as there is only one item in the region. More than one item and the unit won't pick it up.
But i don't know if there is a better solution...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You use simple maths to get the distance of the item away from the unit. If it exceeds your circle's radius then it is not in the range you want it to be. Thus you basically ignore all items via an if statment that have a distance greater than the circle's radius as it loops though each item.

The maths you need to know is Pythagoras' theorem as WC3 uses an X and Y grid and thus forms a right angled tri-angle between the points.
 
Status
Not open for further replies.
Top