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

Help creating custom aura ability

Status
Not open for further replies.
Level 1
Joined
Apr 25, 2023
Messages
5
Disclaimer: Relatively new to map making in general and still learning how to make various abilities function.

I'm trying to create an ability that toggles between two or more different aura. Basically just press the ability to change from one effect to another. The actual effects of which are still to be determined. But something similar to say swapping auras like Paladins in Classic WoW.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
My approach to this would be as follows:
  • Have an ability through which you would change the auras
  • Create X non-hero aura abilities. Anytime you use the 'Change Aura' ability, it would cycle through one of these non-hero aura abilities
  • Create an Ability Code array in the trigger editor
  • Create trigger that fires on map initialization and populates the array from previous step with the non-hero aura abilities
  • Create integer variables that keep track of current active aura (CurrentAuraIndex) and the other that contains the total number of auras you populated the array with (MaxAuraIndex)
  • Create a trigger that detects when 'Change Aura' ability has been cast. In that trigger, increase the number of CurrentAuraIndex
  • Finally, in the trigger, remove the previous ability, add the new ability and set the new ability as enabled, but hidden in UI

Here is an example with 3 auras:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet ChangeAuraSpells[1] = Command Aura (Custom)
      • Set VariableSet ChangeAuraSpells[2] = Devotion Aura (Custom)
      • Set VariableSet ChangeAuraSpells[3] = Thorns Aura (Custom)
      • Set VariableSet CurrentAuraIndex = 0
      • Set VariableSet MaxAuraIndex = 3
  • Change Aura
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Change Aura
    • Actions
      • Unit - Remove ChangeAuraSpells[CurrentAuraIndex] from (Triggering unit)
      • Set VariableSet CurrentAuraIndex = ((CurrentAuraIndex mod MaxAuraIndex) + 1)
      • Unit - Add ChangeAuraSpells[CurrentAuraIndex] to (Triggering unit)
      • Unit - For (Triggering unit), Ability ChangeAuraSpells[CurrentAuraIndex], Disable ability: False, Hide UI: True
Note that the 'Math - Modulo' operation is used here to cycle the value between 1 and 3 (= matching the index range in ChangeAuraSpells[] array)

Variables:
  • ChangeAuraSpells: Ability Code (with Array checkbox ticked)
  • CurrentAuraIndex: integer
  • MaxAuraIndex: integer

Note2: The example I posted will work fine only if there is a single unit using this spell. If you want more units to use it, you would need to change the CurrentAuraIndex variable into array or use a unit indexer or hashtable to keep track of the current aura index for each unit

Edit: attached example map
 

Attachments

  • change auras.w3m
    17.4 KB · Views: 1
Level 1
Joined
Apr 25, 2023
Messages
5
My approach to this would be as follows:
  • Have an ability through which you would change the auras
  • Create X non-hero aura abilities. Anytime you use the 'Change Aura' ability, it would cycle through one of these non-hero aura abilities
  • Create an Ability Code array in the trigger editor
  • Create trigger that fires on map initialization and populates the array from previous step with the non-hero aura abilities
  • Create integer variables that keep track of current active aura (CurrentAuraIndex) and the other that contains the total number of auras you populated the array with (MaxAuraIndex)
  • Create a trigger that detects when 'Change Aura' ability has been cast. In that trigger, increase the number of CurrentAuraIndex
  • Finally, in the trigger, remove the previous ability, add the new ability and set the new ability as enabled, but hidden in UI

Here is an example with 3 auras:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet ChangeAuraSpells[1] = Command Aura (Custom)
      • Set VariableSet ChangeAuraSpells[2] = Devotion Aura (Custom)
      • Set VariableSet ChangeAuraSpells[3] = Thorns Aura (Custom)
      • Set VariableSet CurrentAuraIndex = 0
      • Set VariableSet MaxAuraIndex = 3
  • Change Aura
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Change Aura
    • Actions
      • Unit - Remove ChangeAuraSpells[CurrentAuraIndex] from (Triggering unit)
      • Set VariableSet CurrentAuraIndex = ((CurrentAuraIndex mod MaxAuraIndex) + 1)
      • Unit - Add ChangeAuraSpells[CurrentAuraIndex] to (Triggering unit)
      • Unit - For (Triggering unit), Ability ChangeAuraSpells[CurrentAuraIndex], Disable ability: False, Hide UI: True
Note that the 'Math - Modulo' operation is used here to cycle the value between 1 and 3 (= matching the index range in ChangeAuraSpells[] array)

Variables:
  • ChangeAuraSpells: Ability Code (with Array checkbox ticked)
  • CurrentAuraIndex: integer
  • MaxAuraIndex: integer

Note2: The example I posted will work fine only if there is a single unit using this spell. If you want more units to use it, you would need to change the CurrentAuraIndex variable into array or use a unit indexer or hashtable to keep track of the current aura index for each unit
And if I wanted these auras to be a hero ability what steps would I have to change/add. I assume there's a way to make it check the level of the ability being used before applying the aura? I'm fairly new at this so I apologize if this is a tedious question but you specified non-hero abilities.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Give each non-hero aura ability multiple levels (to match the number of levels the Change Aura ability has) and in trigger adds this:
  • Unit - Set level of ChangeAuraSpells[CurrentAuraIndex] for (Triggering unit) to (Level of (Ability being cast) for (Triggering unit))
This will set the level of the non-hero aura ability to same level as the ability being cast (which is the Change Aura ability)
 
Status
Not open for further replies.
Top