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.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      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