Making a unit constantly lose mana when idle, but gain when in combat?

Noritox

New Member
Reaction score
0
Is it possible to make it so a hero will gain mana when he attacks people, then lose it when he's idle not attacking anyone? I can't get it to work.

Gain Mana
Events
Unit - A unit Is attacked
Conditions
(Unit-type of (Attacking unit)) Equal to Warlord
Actions
Advanced - For (Attacking unit) Increase mana maximum by 30
 

SpaceBar

New Member
Reaction score
16
Trigger:
  • Events
    • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Warlord
    • Actions
      • Unit - Set mana of (Attacking unit) to (Mana of (Attacking unit)) + 30


Something like this perhaps? I'm not sure, i'm currently not near any wc3 source
 

Noritox

New Member
Reaction score
0
Hmm I'll try it. But will it raise it +30 every time he hits the unit, or would I have to back him off and attack him again to get +30 again...

Lemmie test and I'll tell you!

EDIT: Works perfectly! Thank you! Now how to I drain his mana?
 

Noritox

New Member
Reaction score
0
here's what i have for the drain mana but its not working

Warlord Hero
Events
Unit - A unit Is detected
Conditions
(Unit-type of (Triggering unit)) Equal to Warlord
Actions
Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 1.00)
 

blooman

New Member
Reaction score
16
here's what i have for the drain mana but its not working

Trigger:
  • Warlord Hero
    • Events
      • Unit - A unit Is detected
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Warlord
    • Actions
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 1.00)
change to a unit is attacked
condition change to attacking unit equal to warlord
set mana of attacked unit to ((mana of (Attacked unit)) - 30.00
 

SpaceBar

New Member
Reaction score
16
Trigger:
  • Events
    • Player - Player 1 (Red) selects a unit
    • Conditions
      • (Unit type of (Triggering unit)) Equal to Warlord
    • Actions
      • Unit - Set mana of (Triggering unit) to (Mana of (Triggering unit)) - <X amount of mana>


Lol, pretty random, but i'm not 100% sure how you go about it
 

Noritox

New Member
Reaction score
0
By idle I mean, he's not attacking someone. He could be walking, doing other crap. I don't even care if he loses it while he's attacking (since he's gaining more than he's losing). I just want him to be losing mana at all times.
 

blooman

New Member
Reaction score
16
Trigger:
  • checker
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Attacking unit)) Equal to (==) Warlord
        • Then - Actions
          • Set unit = (Attacking unit)
          • Set check = 1
        • Else - Actions
          • Set check = 0

Trigger:
  • check
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • check Equal to (==) 0
    • Actions
      • Unit - Set life of unit to ((Life of unit) - 30.00)

try that
unit is a unit variable
and check is a integer
EDIT: Changed Check Equal to 1 to 0
 

SpaceBar

New Member
Reaction score
16
Trigger:
  • Events
    • Time - Every 5 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Warlord) and do (Actions)
        • Loop - Actions
          • Unit - Set mana of (Picked unit) to (Mana of (Picked unit) - <X amount>
 

blooman

New Member
Reaction score
16
Trigger:
  • Events
    • Time - Every 5 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Warlord) and do (Actions)
        • Loop - Actions
          • Unit - Set mana of (Picked unit) to (Mana of (Picked unit) - <X amount>
That wont work cuz even if hes fighting hell still lose hp
 

SpaceBar

New Member
Reaction score
16
>That wont work cuz even if hes fighting hell still lose hp

Check through Noritox's post again. He said >I just want him to lose mana at all times
 

blooman

New Member
Reaction score
16
Then im wondering whats the point of it fighting for hp if hes gonna lose it anywaiz XD
w/e nj Spacebar:D
 

Noritox

New Member
Reaction score
0
Think Warriors on World of Warcraft.

And it's not HP i needed, it's mana.

The point of this hero, he has a lot of fast abilities with fast cool downs. He fights to get his mana up, then uses abilities. I've been working on a Footmen Frenzy map with a friend for a year and a half, we're finishing up heroes now. This just seemed like a fun yet challenging hero to play.

If anyone has ideas for heroes or sweet ideas for a footies map (we already have mass movement, income, leadership board an eppiiicccc hero system, reagents for items (adds effects to certain spells), and an optional 3v3v3v3 or 6v6 mode) and we're also working on AI and game-modes within footies. :eek: and has MSN or xFire message me :)
MSN - [email protected]
xfire - pixelninja

Thanks again everyone for the help. This trigger had me puzzled on how I'd do it.
 

blooman

New Member
Reaction score
16
Lol Another Footies
I seen like 59278937 footman frenzy type games but w/e
add custom heroes of course:D
add different difficulties like change the amount of spawn if the player wants a harder challenge
Creeps because none has these
 

PrisonLove

Hard Realist
Reaction score
78
I have an idea: give him negative mana regeneration (like the obsidian destroyer), and just have a trigger for him to gain mana when he attacks a unit. This way you don't need to trigger him losing mana.

Note: if the warlord is a hero, negative mana regeneration may be a little buggy with stats and such.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
If you have NewGen, which any map maker should, use this:
JASS:
scope WarlordMana initializer WMInit

// +-------------------------------------+
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// +-------------------------------------+

    globals
        private constant real INTERVAL = 2.00
        //The amount of time between each mana loss
        
        private constant integer WL_ID = 'Hpal'
        //Rawcode of the 'Warlord' unit
        
        private constant integer MANAGAIN = 10
        //How much mana to gain when per attack
        
        private constant integer MANALOSS = 2
        //How much mana to lose when not attacking
    endglobals

// +----------------------------------------------+
// |       -=-=- NO TOUCHIE PAST HERE -=-=-       |
// |       -=-=- NO TOUCHIE PAST HERE -=-=-       |
// |       -=-=- NO TOUCHIE PAST HERE -=-=-       |
// +----------------------------------------------+    
    
    private function WMConditions takes nothing returns boolean
        return (GetUnitTypeId(GetAttacker()) == WL_ID)
    endfunction

    private function WMActions takes nothing returns nothing
        call SetUnitState(GetAttacker(), UNIT_STATE_MANA, GetUnitState(GetAttacker(), UNIT_STATE_MANA) + MANAGAIN)
    endfunction
    
    private function UnitCondition takes nothing returns boolean
        return (GetUnitTypeId(GetFilterUnit()) == WL_ID)
    endfunction
    
    private function ManaLoss takes nothing returns nothing
        if(GetUnitCurrentOrder(GetEnumUnit()) != OrderId("attack")) then
            call SetUnitState(GetEnumUnit(), UNIT_STATE_MANA, GetUnitState(GetEnumUnit(), UNIT_STATE_MANA) - MANALOSS)
        endif
    endfunction
    
    private function LMActions takes nothing returns nothing
        call ForGroup(GetUnitsInRectMatching(bj_mapInitialPlayableArea, Condition(function UnitCondition)), function ManaLoss)
    endfunction

//====================================================================================================
    private function WMInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        
        loop
            call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_ATTACKED, null)
            set i = i + 1
        exitwhen i == bj_MAX_PLAYER_SLOTS
        endloop
        call TriggerAddCondition(t, Condition(function WMConditions))
        call TriggerAddAction(t, function WMActions)
        
        set t = CreateTrigger()
        call TriggerRegisterTimerEvent(t, INTERVAL, true)
        call TriggerAddAction(t, function LMActions)
    endfunction

endscope
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top