How to have a certain ability damage only a very specific unit-type through Triggers?

Level 3
Joined
May 27, 2023
Messages
18
The Dispel ability in-game has an built-in damage stat against summoned units which is handy if you want to kill hordes of Skeletons. However, this would prove a complication if said Skeleton is not summoned through an ability, rendering the Dispel damage useless.

What ways can I use, through Triggers, to simulate the damage to certain Unit-Types through an ability?

I've tried "Unit - Casting Spell" with condition "Ability = Dispel", but I can't figure out how to use the "Unit - Damage Target" to effect only a very specific unit-type.

Any ideas?
 
Level 30
Joined
Aug 29, 2012
Messages
1,382
You can do something like this

  • Dispel
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dispel Magic
    • Actions
      • Set VariableSet TargetPoint = (Target point of ability being cast)
      • Set VariableSet TempGroup = (Units within 200.00 of TargetPoint.)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is Summoned) Equal to False
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Skeleton Warrior
                  • (Unit-type of (Picked unit)) Equal to Skeletal Mage
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 200.00 damage of attack type Spells and damage type Universal
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_TempGroup)
I check "is summoned" otherwise it would do the standard dispel damage + the triggered damage to summons
 

Rheiko

Spell Reviewer
Level 26
Joined
Aug 27, 2013
Messages
4,214
Some units have classification in the game, summoned units is one of them. In trigger editor you can filter them in condition block. When you create a new trigger, there is an event block, condition block, and action block. You can create a if-then-else for additional condition block inside an action block.

For example:
  • Damage Specific Unit
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • -------- This will only damage structure --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A structure) Equal to True
        • Then - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Spells and damage type Normal
        • Else - Actions
      • -------- This will only damage hero unit --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A Hero) Equal to True
        • Then - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Spells and damage type Normal
        • Else - Actions
      • -------- This will only damage unit whose type is footman --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Target unit of ability being cast)) Equal to Footman
        • Then - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Spells and damage type Normal
        • Else - Actions
Since you mentioned you want to damage specific unit-type, this might be what you are looking for:
  • -------- This will only damage unit whose type is footman --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Target unit of ability being cast)) Equal to Footman
      • Then - Actions
        • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Spells and damage type Normal
      • Else - Actions
If you want to deal an area damage, you can do something like this:
  • Damage Specific Unit
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • Unit Group - Pick every unit in (Units within 500.00 of (Target point of ability being cast)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Footman
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
            • Else - Actions
Be noted this is not leakless. If you're wondering about what leakless means, you can check this thread: Memory Leaks

Edit:
Chaosium beats me 😅
 
Some classifications can be added successfully with the trigger action to do so. Create unit -> add summoner classification.

Instead of spawning units with a trigger you can use a dummy-cast Summon Water Elemental with the ability field natives used to manipulate the created unit type.
I vouch for this.

Unless it must be exclusively that this particular dispel that can deal damage to it, using classification allows for all dispels to deal damage to it. Remember, there's Ancestral Spirit, Abolish Magic, and Devour Magic (probably more) that also shares this damage summon trait, so if you want all four abilities (and all their custom variations) to treat summon as damage-able, consider this option.

If you want it specific for one custom variation of the spell, then approach from Rheiko and Chaosium is suitable. Otherwise, you need to cover for multiple spells (and their different AOEs)
 
Top