Modifying in game HP with Triggers

Uszi

New Member
Reaction score
5
So I want to do difficulty settings in my game, and on higher difficulties, I want the enemies to move faster, hit harder, and take more damage.

The enemies spawn in waves, btw.

So two ways to do this: Create a unit for each difficulty, so Unit01(easy), Unit01(normal) etc. This is rather tedious.

Or, I thought I could use a trigger like this:

Trigger:
  • Modifiy zombies
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 12 (Brown)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GameDifficulty Equal to 0
        • Then - Actions
          • Do nothing
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GameDifficulty Equal to 1
            • Then - Actions
              • Unit - Set life of (Entering unit) to ((Life of (Entering unit)) x 1.25)
              • Unit - Set (Entering unit) movement speed to ((Default movement speed of (Entering unit)) x 1.25)
              • Unit - Add CustomDamageBuffAbility1 to (Entering unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GameDifficulty Equal to 2
                • Then - Actions
                  • Unit - Set life of (Entering unit) to ((Life of (Entering unit)) x 1.50)
                  • Unit - Set (Entering unit) movement speed to ((Default movement speed of (Entering unit)) x 1.50)
                  • Unit - Add CustomDamageBuffAbility2 to (Entering unit)
                • Else - Actions


GameDifficulty is an integer that is set when the host picks a difficulty settign.
0 is easy
1 is normal
etc, etc.

Except it doesn't look like I can use the Unit - Set Life function like that (their HP stays the same). Seems like they are moving faster though.

Is there a function that *does* let me modify their hp, etc in game, so I don't have to trigger it to spawn different custom units for each difficulty?
 

Uszi

New Member
Reaction score
5
Like automatically research a tech upgrade?
Heh, that makes a lot of sense actually. :D

Thanks.

I was kinda hoping for a 2 page debugging thread like my last one, but the easier the better I suppose.
 

Uszi

New Member
Reaction score
5
No, but the upgrade system works for that -- I used the berserker upgrade from the orc tech tree.

Which is actually a nice upgrade, since with one upgrade you can do a lot of different things.

Anyway, this system works out awesome: As the game progressess, I can continue to research upgrades to make the zombies stronger, instead of creating new ones. So with one zombie unit, and a custom upgrade with like 50 levels, I'm good to go.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top