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

Aura that gives nearby units an ability?

Status
Not open for further replies.
Level 31
Joined
Apr 17, 2009
Messages
3,571
Hey Guys, following problem:

I have some kind of berry picking system for what I have a Berry Picking ability that can be used on a berry bush.

What I need is, that you only get this ability if you are close to a bush. So my idea was to make an aura for the berry bush that gives nearby units the ability berry picking.

Is that possible? If not, how do I detect if a unit gets in range of the berry bush?

Greets chilla_killa
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
I think with aura method, you should check if the units have aura or no.

BerryPickers unitgroup variable
  • Detect Berry
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • -------- Check if there are any units near bushes --------
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) has buff BERRYAURABUFF) Equal to True) and ((Unit-type of (Matching unit)) Equal to GATHERER))) and do (Actions)
        • Loop - Actions
          • Unit - Add BERRYPICK to (Picked unit)
          • Unit Group - Add (Picked unit) to BerryPickers
      • -------- If a unit goes away from bushes, remove picking ability --------
      • Unit Group - Pick every unit in BerryPickers and do (Actions)
        • Loop - Actions
          • Unit - Remove BERRYPICK from (Picked unit)
          • Unit Group - Remove (Picked unit) from BerryPickers
 
Level 25
Joined
Sep 26, 2009
Messages
2,380
You can save point of each bush into variable array. Periodically (like every second) make a trigger where you pick unit, save its position into another variable, set some random bool to false and iterate through each point in the variable array and check the distance between the unit and saved point. If distance is close enough, set bool to true.
Once the loop is finished, check if bool == true - if yes, add ability; if no, remove ability.
 
Nichilus' idea.
Or you can give the berry bushes a dummy aura and run a periodic trigger which checks if a unit has the aura buff. If true then add the pick ability and set a boolean to true.
If not, set the boolean to false and remove the buff.

The reason for the boolean is to check if the unit already has the ability when staying near a bush.
 
Level 12
Joined
May 20, 2009
Messages
822
Nichilus' idea.
Or you can give the berry bushes a dummy aura and run a periodic trigger which checks if a unit has the aura buff. If true then add the pick ability and set a boolean to true.
If not, set the boolean to false and remove the buff.

The reason for the boolean is to check if the unit already has the ability when staying near a bush.

You actually don't need to set a variable or even check if the unit already has the ability, because if the ability being added to the unit has the same ID, it won't do anything. Or at least that's from my experience. I have several abilities in my mod that adds a new ability to a unit in a spellbook, and it never seems to interrupt things or stack or reset cooldowns or cause lag.
 
You actually don't need to set a variable or even check if the unit already has the ability, because if the ability being added to the unit has the same ID, it won't do anything. Or at least that's from my experience. I have several abilities in my mod that adds a new ability to a unit in a spellbook, and it never seems to interrupt things or stack or reset cooldowns or cause lag.

Probably. I wasn't sure so I just threw in the boolean for safety.
 
Level 25
Joined
Sep 26, 2009
Messages
2,380
give the aura into spell book, give spellbook to bush, disable the spellbook ability for that player. Spellbook won't be visible, but the aura inside will still take effect.

Or use tornado slow aura -> this has no icon to begin with but still applies (hostile) buff
 
Status
Not open for further replies.
Top