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

Auto Power-ups Pickup System {picking up an item instantly if it is in 100 range}

Status
Not open for further replies.
Level 5
Joined
Jun 7, 2008
Messages
141
The Title says it all. I need a system where

Every .2 seconds of th game, if a unit is in 100 range between a power-up (ill be using the "gold" powerup), the item is automatically used or whatsoever.

So if i had a unit walk over an item thats a power up specifically, the power up is automatically picked up.

I have seen this system before on Pyramid Escape (the "pac-man" challenge thingy) so i'm sure this is possible ^^
 
So far i've made this, but it's not working :S Also it leaks and it's only for one player

  • Untitled Trigger 001
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    • Actions
      • Item - Pick every item in (Entire map) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-class of (Picked item)) Equal to Powerup
              • (Distance between (Position of (Triggering unit)) and (Position of (Picked item))) Less than or equal to 100.00
            • Then - Actions
              • Hero - Give (Picked item) to (Triggering unit)
            • Else - Actions
 
Level 5
Joined
Jun 7, 2008
Messages
141
Hmmm, first tell me if the item spawns on the region, or does it spawn on totally random spot.
If you're asking how the item spawns or are created, items are created through when a unit type is killed.

Something like
A unit dies
Triggering unit type is a [Footoman] equal to True
Create 1 [Gold Coin(Small)] on position of [Triggering Unit]
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
If the problem is the person is not getting gold then simply add an action

Player - Add 20 to Player 1 (Red) Current gold

Something like that should add the gold for you. I didn't look at the map provided above, but if you add that in it should work with the gold, if the item you are picking up is gold.


Well, I had planned on giving u a trigger, but my WE decided to spazz out on me and break o.o

Hope this helps!

EDIT: I'm actually looking for a similar system myself for a project of mine, so I'll be keeping an eye on this Thread, ^^

EDIT 2: I worked with it a bit, built upon the trigger shown above to try and make this work, though i don't have time to test it, here we go.

You need 2 variables, a region variable, and an item array variable.

two triggers, one called drop item and one called pickup item.

  • Drop Item
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Footman
    • Actions
      • Item - Create Gold Coins at (Position of (Dying unit))
      • Set ItemDropped[1] = (Last dropped item)
and then (WARNING: The following trigger does not work - if anyone would care to fix it, please do. I do not know what is wrong with it):

  • Pickup Item
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
    • Actions
      • Set Point = (Playable map area)
      • Item - Pick every item in Point and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Multiple ConditionsAnd - All (Conditions) are true
                • Conditions
                  • (Distance between (Position of (Picked unit)) and (Position of (Picked item))) Less than or equal to (<=) 100.00
                  • (Item-class of (Picked item)) Equal to (==) Powerup
            • Then - Actions
              • Item - Remove ItemDropped[1]
              • Player - Add 100 to (Owner of (Matching unit)) Current gold
              • Custom script: call RemoveLocation(udg_Point)
            • Else - Actions
              • Do nothing
EDIT: I just tried to test it upon returning home, and it doesn't work. Maybe someone can fix it? I'm not certain what exactly is wrong with it, but I'm thinking I have made some silly little mistake somewhere that causes the whole thing to not work.
 
Last edited:
Status
Not open for further replies.
Top