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

Question about item detection?

Status
Not open for further replies.
Level 15
Joined
Nov 26, 2005
Messages
1,151
A rather wierd question this is :

Let's say I want to pickevery item of type 'X' in 300 AoE from point 'A'. How can I do that ? I didn't find any option "pick items in range", only "pick items in region".

Help appreciated with rep!
 
Last edited:
Level 13
Joined
Mar 24, 2010
Messages
950
here this will work for you :)

  • items
    • Events
    • Conditions
    • Actions
      • Set Temp_Point = (Center of (Playable map area))
      • 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
              • (Item-type of (Picked item)) Equal to Crown of Kings +5
              • ((Picked item) is in (Region centered at Temp_Point with size (256.00, 256.00))) Equal to True
            • Then - Actions
              • -------- do what u want here --------
            • Else - Actions
      • Custom script: call RemoveLocation (udg_Temp_Point)
eh forgot u could just do it this way..

  • items
    • Events
    • Conditions
    • Actions
      • Set Temp_Point = (Center of (Playable map area))
      • Item - Pick every item in (Region centered at Temp_Point with size (256.00, 256.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 Crown of Kings +5
            • Then - Actions
              • -------- do what u want here --------
            • Else - Actions
      • Custom script: call RemoveLocation (udg_Temp_Point)
 
Level 15
Joined
Nov 26, 2005
Messages
1,151
Yes, that's what I did, but doesnt this make a rectangular region around the point with height and width and NOT a circle with a radius ?

What I meant is that I need a circle with a radius, also known as "range".

Is there a way to do that ?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
This picks items withinn 600 range.

  • Untitled Trigger 008
    • Events
    • Conditions
    • Actions
      • Set p = (Center of (Playable map area))
      • Set r = (Region centered at p with size (600.00, 600.00))
      • Item - Pick every item in r and do (Actions)
        • Loop - Actions
          • Set p2 = (Position of (Picked item))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between p and p2) Less than or equal to 600.00
            • Then - Actions
              • -------- Is withing 600 range --------
            • Else - Actions
          • Custom script: call RemoveLocation(udg_p2)
      • Custom script: call RemoveLocation(udg_p2)
      • Custom script: call RemoveRect(udg_r)
 
Status
Not open for further replies.
Top