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

[Spell] Triggering an Aura

Status
Not open for further replies.
Level 5
Joined
Mar 26, 2004
Messages
53
Been attempting a new aura spell that gives the effected unit a chance to deal bonus damage. All levels have a 10% to deal the bonus damage, but the damage scales from 3 to 6 to 9 as the aura increases its level. The issue I'm having is that my triggers don't let allied units deal the bonus damage, or work with an item that bestows the level 1 aura. Whats more, it's not able to differentiate and choose the higher of two versions of the aura, thus making units deal inconsistent damage. Which is to say, my attempt is an utter failure.

At this point I've clearly surpassed my skill level and could use some help. If anyone could come up with a GUI/MUI code I'd be much obliged.

-Thanks
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
To differentiate ability levels, just make a different buff for every level. All of these will look exactly the same, but you can see which one it is in the triggers. The problem with this approach is that if multiple heroes have different levels of this aura and are near each other, units will have multiple icons. You can still trigger it to only use the highest level (you'll need to use a few more if/then/elses).

As for implementation, I'd recommend getting a damage detection system. Here's the one I like to use: http://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-v2-2-1-0-a-201016/

Your trigger will look like this:

Event - Damage event (read up in the damage engine system how to set this up, very easy)
Actions:
If damage source has buff of type (Aura Level 1) equal to true then {damage target}
else (check level 2 etc)

Just be sure to turn off the trigger before and turn on after dealing the damage, or you'll get an infinite loop.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Units would receive all 3 buffs, but the system picks the best one and only deals that bonus damage.

It is possible to do it without separate buffs:
- On damage, search all units around the damage source for units that have the aura ability (filter out enemies, dead heroes, etc)
- Check the level of the aura for all nearby units with this ability
- Pick the highest level and deal that damage

The (minor) issue with this method is that when a unit leaves the aura range of the hero, the aura usually sticks for a few seconds, but in this case even if the buff sticks it won't deal any bonus damage since no aura givers will be found.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
Is it possible to do without creating 3 separate buffs? Would look odd if your units had 3 of the same buff, and what would differentiate which would take priority?
Wc3 is not able to detect which level the buff is, because the jass value to return if a unit has a buff, and if its true. Not the level of the buff. That's why you have to create a unique buff for every level if you want the different levels to be detected by triggers.

Another way is to just check the level of aura ability of the hero from a certain range as long it has a certain buff and thus not needing to create a buff for each level.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
I think that it is almost ready to be uploaded but want to give you some preview because I will change documentation and maybe 10 lines of code in the next hours :D (next to some more epic examples like my forked lightning)

The Death Knight has your spell.
Just take a look and implement it in your map.

I'll explain a bit what happens:
Once the Death Knight learned his critical strike aura, he picks all units in 900 range every 1 second.
Then he filters out structures, dead units and enemies.
Then he gives or updates the picked units Effect Over Time.
That EOT gives the target a critical strike ability that is put in a disabled spellbook.
It also gives a buff and a special effect to tell the player that that unit has the buff.
 

Attachments

  • Effect Over Time System 1.2b.w3x
    65.3 KB · Views: 65
Level 31
Joined
Jul 10, 2007
Messages
6,306
The aura system I'm thinking does a unit in range event instead of a GroupEnumUnits on a timer.

At the very least, you can use the algorithms it provides to correctly manage auras that shouldn't stack.

Scenario:

A unit has aura A of level 1. 5 units are in range, they all get the aura. Unit 2 in range learns the aura. Nothing happens. Source unit leaves, all units come under the aura from Unit 2, still level 1. Original source unit levels the aura, which changes the range to now include the previous 5 units. Now the 5 units are under the aura from the original source.

Does a simple effect over time system manage all of this? Nope.

There are some drawbacks. Standard Object Editor auras can't be used as they break the unit in range event. Pros are that you can customize the aura however you like.

Here is the API

JASS:
/************************************************************************************
*
*   module AuraMod
*
*       Creator
*       -----------------------
*
*           static method register takes UnitIndex source, real auraRange returns nothing
*
*       Interface
*       -----------------------
*
*           private static constant boolean AURA_STACKS
*               (required) -   Does the aura stack?
*
*           private static constant real AURA_INTERVAL
*               (required) -   How often to run the aura
*
*           private static method getLevel takes UnitIndex sourceId returns integer
*               (required) -    Returns the level of the aura on the unit
*
*           private static method onLevel takes UnitIndex source, integer level returns nothing
*               (optional) -    Runs when aura levels up
*
*           private static method getRange takes UnitIndex source, integer level returns real
*               (required) -    Should return the range of the aura
*
*           private method onEndEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
*               (optional) -    Runs when the aura effect ends (aura no longer on unit)
*
*           private method onEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
*               (optional) -    Runs when aura effect starts (aura just went on to unit)
*
*           private method onPeriodicEffect takes UnitIndex source, UnitIndex affected, integer level returns nothing
*               (optional) -    Runs every period of the aura. First run is right after onEffect
*
*           private static method absFilter takes UnitIndex source, UnitIndex entering returns boolean
*               (optional) -    Runs when the unit initially enters in the range of the aura. If this returns false, the
*                          -    unit is ignored as if it doesn't exist and it will never be able to get the aura
*
*           private method filter takes UnitIndex source, UnitIndex affected, integer level returns boolean
*               (optional) -    Runs whenever the aura cycles (every TIMEOUT seconds). This helps determine if the
*                          -    aura is active or not for the unit.
*
*           private static method removeBuff takes unit source, unit whichUnit, integer level returns nothing
*               (optional) -    Runs when the buff icon should be removed from the unit
*
*           private static method addBuff takes unit source, unit whichUnit, integer level returns nothing
*               (optional) -    Runs when the buff icon should be added to the unit
*
************************************************************************************/
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
A unit has aura A of level 1. 5 units are in range, they all get the aura. Unit 2 in range learns the aura. Nothing happens. Source unit leaves, all units come under the aura from Unit 2, still level 1. Original source unit levels the aura, which changes the range to now include the previous 5 units. Now the 5 units are under the aura from the original source.

Does a simple effect over time system manage all of this? Nope.

Most of it does... practically.
When there are 2 units having the aura, the units in both ranges gain the effect of both. However as they already have that effect the other is overridden. So the effect is only active once.
The level check is not done by my system automatically because then I would not be able to reduce the levels of any other EOT any more.
I also do not want to go into datatypes specificly for certain effecttypes like auras.

When the level is increased and thus the range, then everything updates automatically on the next interval.

There are some drawbacks. Standard Object Editor auras can't be used as they break the unit in range event. Pros are that you can customize the aura however you like.
Do you mean you cannot use them or you cannot modify them?
 
Status
Not open for further replies.
Top