[Trigger] Changing damage and health depending on custom difficulty

Status
Not open for further replies.
Level 5
Joined
Feb 5, 2021
Messages
89
Greetings

What i want is that when the game starts, a dialog appears to choose from 3 difficulties, where all the mobs i have made are considered "easy" mobs, and i want to be able to "activate" a trigger that does what the second trigger does pretty much just x2 base damage, hp and mana but i dont want to have 3 different spawner triggers to enable and disable, considering there might be around 100 or 200 spawner triggers when im done, and x3 that would be a pain, any ideas?

  • SpawnLevel1Mobs
    • Events
    • Conditions
      • Difficulty Equal to 1
    • Actions
      • Set VariableSet MobSpawnPoints = (Random point in Zone1EncounterArea <gen>)
      • Unit - Create 1 (Unit-type of (Random unit from Zone1MobUnitGroup)) for Neutral Hostile at MobSpawnPoints facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_MobSpawnPoints)
  • SpawnLevel1Mobs COPY
    • Events
    • Conditions
    • Actions
      • Unit - Set Base Damage of (Last created unit) to ((Base Damage of (Last created unit) for weapon index 0) x 2) for weapon index: 0
      • Unit - Set Max HP of (Last created unit) to ((Max HP of (Last created unit)) x 2)
      • Unit - Set Max Mana of (Last created unit) to ((Max Mana of (Last created unit)) x 2)
 
Last edited:
Level 5
Joined
Feb 5, 2021
Messages
89
God damn, i just had an idea and it seems like it worked pretty well, as i dont have any owner changes, i now use this to make it work.

With the ownership i only have 1 "line" to use every time i spawn unit so that it changes ownership and then triggers the "difficulty" setting block.

  • SpawnLevel1Mobs
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Set VariableSet MobSpawnPoints = (Random point in Zone1EncounterArea <gen>)
          • Unit - Create 1 (Unit-type of (Random unit from Zone1MobUnitGroup)) for Neutral Passive at MobSpawnPoints facing Default building facing degrees
          • Unit - Change ownership of (Last created unit) to Neutral Hostile and Change color
          • Custom script: call RemoveLocation (udg_MobSpawnPoints)
        • Else - Actions
  • Difficulty
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • (Owner of (Ownership-changed unit)) Equal to Neutral Hostile
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Difficulty Equal to 1
        • Then - Actions
          • Unit - Set Base Damage of (Ownership-changed unit) to ((Base Damage of (Ownership-changed unit) for weapon index 0) x 2) for weapon index: 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Difficulty Equal to 2
            • Then - Actions
              • Unit - Set Base Damage of (Ownership-changed unit) to ((Base Damage of (Ownership-changed unit) for weapon index 0) x 3) for weapon index: 0
            • Else - Actions
 
Level 41
Joined
Feb 27, 2007
Messages
5,229
What you did is clever, but it doesn't have to be. You could just use "A unit enters (Playable map area)" and then either check that the owner of the unit is Neutral Hostile (if all NH units spawned in should be buffed) or that the unit has some sort of invisible, useless passive ability that flags it as a unit-type that should have its HP and damage scaled. Also save the damage scaling into a real variable and just apply it every time, even if it's 1.00:
  • Events
    • Unit - A unit enters (Playable map area)
  • Conditions
    • (Owner of (Triggering Unit)) equal to Neutral Hostile
    • (Level of DIFFICULTY SCALING FLAG ABILITY for (Triggering Unit)) greater than 0
    • -------- one or the other, they're different methods --------
  • Actions
    • Unit - Set Base Damage of (Triggering Unit) to ((Base Damage of (Triggering Unit) for weapon index 0) x DIFFICULTY_SCALING_MODIFIER) for weapon index: 0
In your trigger that responds to the dialogue clicks do something like:
  • Set DIFFICULTY_SCALING_MODIFIER = Real(Difficulty + 1)
After modifying the unit's stats you may want to exclude it from being buffed any future times it 'enters' the playable map area (only likely to happen if you are doing something silly to cause that), which you could do by setting the flag ability to a different level or putting the unit into a unit-group that you maintain for this purpose. Also consider that (for example) if a neutral hostile unit used Feral Spirit to summon wolves, in your triggers those summoned wolves wouldn't have their stats altered but in mine they would (if they passed the condition checking for group/flag ability/ownership). Also a Neutral Hostile unit casting Charm to permanently steal another unit from a different player would not trigger my trigger, but it would trigger yours.

Also with the way damage dice work, doubling or tripling the base damage will not necessarily double/triple that unit's DPS. You might get a greater or smaller increase than you intend, depending on the specifics of their damage dice, number of sides per die, and base damage.
 
Level 5
Joined
Feb 5, 2021
Messages
89
Sometimes i wish i had your knowledge and creativity!

You are completely right, i had not thought of mind control and the summoning of units, i Will be going with your idea as it fits perfectly :D

Also in my map attack Damage is based 100% on base Damage as i set the Dice numbers to 1 so it only gives 1 Damage No matter what and thats fine with me :D
 
Level 5
Joined
Feb 5, 2021
Messages
89
Just implemented with what i think is a slight tweak but it marked everything quite easier for me and it works perfectly, also now had a buff to display the current difficulty om the mob, i am very pleased with it! :D
 
Status
Not open for further replies.
Top