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

Stunt mana regen for single unit?

Status
Not open for further replies.
Level 1
Joined
Oct 23, 2016
Messages
2
I've been making a hero based off of rage and have used many different things to try and keep the hero from regenerating mana from brilliance or having mana destroyed (Negative regen) Anyone have any ideas on how to keep a unit from gaining a buff or just keep him from gaining mana from anything besides the trigger I have to gain mana on hit?
 
Level 39
Joined
Feb 27, 2007
Messages
4,992
what about a periodic trigger that checks for a condition then keeps setting the unit's mana to 0 ?
He doesn't want it to be always 0, he wants it to always be whatever value it's at but not go up or down, so it needs to be set to the 'previous' value. However, the unit can surely gain rage by casting other abilities/taking-/dealing damage, but a simple 'set to the previous value' would stop these from working. As I see it there are threechoices:
  1. Just don't use AoE mana regen abilities/fountains
  2. Trigger all mana related abilities (brilliance aura, siphon mana, etc: anything else in your map that may steal/give/change mana or grant mana regen) so you have complete control over which units are actually affected by them (e.g. not your rage unit)
  3. Use a unit indexer (something that assigns a unique number to each unit's Custom Value as it enters the map-- there are many in the resources forum), two real arrays (RAGE_CURRENT[] and RAGE_CHANGE[]), a group (RAGE_GROUP), and a periodic trigger on short timeout to keep track of the rage unit's current mana AND any changes to that number that occur between this iteration of the timer and the next iteration of the timer.
    • Add all units with rage to some global group whenever the enter the map (and remove when they die if they aren't heroes), so you only check the mana for the right units
      • Events
        • Time - Every 0.25 seconds of game-time //updates rage 4 times per second
      • Conditions
      • Actions
        • Unit Group - Pick every unit in RAGE_GROUP and do (Actions)
          • Loop - Actions
            • Set UIndex = Custom Value of (picked unit)
            • Set RAGE_CURRENT[UIndex] = RAGE_CURRENT[UIndex] + RAGE_CHANGE[UIndex]
            • Set RAGE_CHANGE[UIndex] = 0
            • Unit - Set (Picked unit) mana to value RAGE_CURRENT[UIndex]
      Then, whenever you need to increase or decrease a unit's rage instead of setting it's mana you'll do:
      • Set UIndex = Custom Value of <the unit>
      • Set RAGE_CHANGE[UIndex] = RAGE_CHANGE[UIndex] + <whatever value you want to add, could be negative for rage loss>
      The only major problem with this is that you'll also have to trigger your own rage depletion over time in the periodic trigger if you want it to slowly drain like WoW rage does when not in combat.
 
Level 39
Joined
Feb 27, 2007
Messages
4,992
I had another thought: you could use one of the basically unused unit classifications to differentiate between units with rage and units without rage. For this you can co-opt either the Ancient or Suicidal classifications to instead mean "this unit has rage". So for your warrior unit you'll have to add your classification of choice in the OE under "Stats - Unit Classification" and the same for all rage-based units.

If you then add Non-Ancient or Non-Suicidal to the list of allowed targets for Brilliance Aura (or any spell that shouldn't affect Rage units) it will the only affect units that aren't classified that way. Boom, problem solved. But you lose the ability to actually classify things as whichever one you choose, though, which could potentially be a headache if you're trying to fit this within the confines of a Melee map.

Edit: you also have to be smart and not mess with any Rage-based unit's mana via triggers, but you could write your own function check for that.
JASS:
function UnitHasRage takes unit whichUnit returns boolean
    return IsUnitType(whichUnit, UNIT_TYPE_ANCIENT)
endfunction

//Or make your own classifications:
globals
    constant unittype UNIT_TYPE_RAGE = UNIT_TYPE_ANCIENT
endglobals

//Then just check:
call IsUnitType(u, UNIT_TYPE_RAGE)

//Or write your own function
function SetUnitManaSafe takes unit u, real m returns boolean
    if not IsUnitType(u, UNIT_TYPE_RAGE) then
        call SetUnitState(u, UNIT_STATE_MANA, m)
        return true
    endif
    return false
endfunction
 
Last edited:
Status
Not open for further replies.
Top