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

Why i cannot find pick every item within region?

Status
Not open for further replies.
Level 18
Joined
Jun 2, 2009
Messages
1,233
Hello everyone. I want to create ability that picks every item within x range of the caster and give it to the unit.
I cannot find the "region WITHOUT offset"

Short question: How can i detect every item within x range, then pick the items?
 
Level 24
Joined
Feb 27, 2019
Messages
833
Item - Pick every item in Playable map area and do (Actions)
Then you click on "Playable map area" and select your region.
If you want to pick every item within 150 range then the region has to be at least 300, 300, twice the range.
This method can be used to pick units aswell and its more accurate than just using a region since regions are rectangular.
For example:
  • Pick every item within range
    • Events
    • Conditions
    • Actions
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • Set VariableSet TempRegion = (Region centered at TempPoint with size (400.00, 400.00))
      • Item - Pick every item in TempRegion and do (Actions)
        • Loop - Actions
          • Set VariableSet TempPoint2 = (Position of (Picked item))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between TempPoint and TempPoint2) Less than 150.00
            • Then - Actions
              • Hero - Give (Picked item) to (Triggering unit)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveRect(udg_TempRegion)
 
Level 18
Joined
Jun 2, 2009
Messages
1,233
Item - Pick every item in Playable map area and do (Actions)
Then you click on "Playable map area" and select your region.
If you want to pick every item within 150 range then the region has to be at least 300, 300, twice the range.
This method can be used to pick units aswell and its more accurate than just using a region since regions are rectangular.
For example:
  • Pick every item within range
    • Events
    • Conditions
    • Actions
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • Set VariableSet TempRegion = (Region centered at TempPoint with size (400.00, 400.00))
      • Item - Pick every item in TempRegion and do (Actions)
        • Loop - Actions
          • Set VariableSet TempPoint2 = (Position of (Picked item))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between TempPoint and TempPoint2) Less than 150.00
            • Then - Actions
              • Hero - Give (Picked item) to (Triggering unit)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveRect(udg_TempRegion)
WoW it's you again. You helped me on this topic Detect more than 1 type weapon
Thank you my friend today i will try this one
 
Status
Not open for further replies.
Top