[Item] Trigger Question

Status
Not open for further replies.
Level 6
Joined
Jan 9, 2009
Messages
236
How do you loot an item with a spell when it is within range?
  • health
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Loot
        • Then - Actions
        • Else - Actions
          • Do nothing
Whats next?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ItemRegion = (Region 000 <gen>)
  • Picking Items
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to *loot*
    • Actions
      • Set Point = (Position of (Picked unit))
      • Region - Center ItemRegion on Point
      • Item - Pick every item in ItemRegion and do (Actions)
        • Loop - Actions
          • Hero - Give (Picked item) to (Picked unit)
      • Custom script: call RemoveLocation(udg_Point)
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Small mistake Maker, Triggering unit instead of Picked unit :D
However, isn't that better to temporary create region on given location and then destroy it?
Like:

  • Picking Items
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to *loot*
    • Actions
      • Set Point = (Position of (Triggering unit))
      • Set ItemRegion = Region centered at Point with <your parameters lets say 200x200>
      • Item - Pick every item in ItemRegion and do (Actions)
        • Loop - Actions
          • Hero - Give (Picked item) to (Triggering unit)
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call DestroyRec(udg_ItemRegion)
 
Level 6
Joined
Jan 9, 2009
Messages
236
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ItemRegion = (Region 000 <gen>)
  • Picking Items
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to *loot*
    • Actions
      • Set Point = (Position of (Picked unit))
      • Region - Center ItemRegion on Point
      • Item - Pick every item in ItemRegion and do (Actions)
        • Loop - Actions
          • Hero - Give (Picked item) to (Picked unit)
      • Custom script: call RemoveLocation(udg_Point)

Thanks bro :D i just had to chang picked unit to triggering unit and it worked!
+rep
 
Status
Not open for further replies.
Top