1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  4. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Do you have good ideas for new contests? If so, please open new threads in the Contest Submission sub-forum to discuss them.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Spell] Triggering an Aura

Discussion in 'World Editor Help Zone' started by Merry, Feb 7, 2015.

  1. Merry

    Merry

    Joined:
    Mar 26, 2004
    Messages:
    53
    Resources:
    0
    Resources:
    0
    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
     
  2. rulerofiron99

    rulerofiron99

    Joined:
    Jul 10, 2006
    Messages:
    3,129
    Resources:
    14
    Maps:
    4
    Spells:
    9
    Tutorials:
    1
    Resources:
    14
    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.
     
  3. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Isn't that one of the rules for creating a DDS?
     
  4. Merry

    Merry

    Joined:
    Mar 26, 2004
    Messages:
    53
    Resources:
    0
    Resources:
    0
    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?
     
  5. rulerofiron99

    rulerofiron99

    Joined:
    Jul 10, 2006
    Messages:
    3,129
    Resources:
    14
    Maps:
    4
    Spells:
    9
    Tutorials:
    1
    Resources:
    14
    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.
     
  6. Merry

    Merry

    Joined:
    Mar 26, 2004
    Messages:
    53
    Resources:
    0
    Resources:
    0
    How would you do the check on the ability level, including its source if from an item?
     
  7. rulerofiron99

    rulerofiron99

    Joined:
    Jul 10, 2006
    Messages:
    3,129
    Resources:
    14
    Maps:
    4
    Spells:
    9
    Tutorials:
    1
    Resources:
    14
    Ability level is an integer check, just check "level of ability for unit".

    AFAIK item abilities don't have multiple levels, so that won't be an issue there. To test for item you'd just check to see if the hero has the item.
     
  8. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    I will create the complete spell as an example for my Effect Over Time System.

    Don't bother looking yet, it is completely reworked and will be uploaded this night... I hope.
     
    Last edited: Feb 8, 2015
  9. TKF

    TKF

    Joined:
    Nov 29, 2006
    Messages:
    1,237
    Resources:
    5
    Maps:
    5
    Resources:
    5
    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.
     
  10. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    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.
     

    Attached Files:

  11. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    There's an aura resource that manages levels, srtacking, etc
     
  12. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    I don't think that there are very much differences between my EOT system and an Aura Management System... Except that mine has more possibilities but is harder to use.

    Can you give the link to the one you meant nes?
     
  13. Nestharus

    Nestharus

    Joined:
    Jul 10, 2007
    Messages:
    6,146
    Resources:
    8
    Spells:
    3
    Tutorials:
    4
    JASS:
    1
    Resources:
    8
    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

    Code (vJASS):

    /************************************************************************************
    *
    *   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
    *
    ************************************************************************************/

     
     
  14. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,640
    Resources:
    3
    Spells:
    3
    Resources:
    3
    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.

    Do you mean you cannot use them or you cannot modify them?
     
  15. Merry

    Merry

    Joined:
    Mar 26, 2004
    Messages:
    53
    Resources:
    0
    Resources:
    0
    I tried the effect overtime Wietlol, can't seem to configure it correctly.
    What is the Aura system Nestharus is referring to?