[Solved] Reincarnation + Summon

Level 9
Joined
Mar 26, 2020
Messages
205
-Sorry for a lot of spams in this forum lately, i just have too much time this month for me to make mess of my random maps and experimenting triggers-
With that said, how to summon unit when the ability is in effect? I've tried all these 3 but nothing happens
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability being cast) Equal to Reincarnation
  • Actions
    • Unit - Create 2 *PlaceholderUnits for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Reincarnation
  • Actions
    • Unit - Create 2 *PlaceholderUnits for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Reincarnation
  • Actions
    • Unit - Create 2 *PlaceholderUnits for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
 
Reincarnation is an ability that doesn't really follow/emit standard trigger events: The unit in question does not trigger 'Unit dies' event and the ability itself is not cast. It is why none of your three trigger is working.

The solution is to use a modified version of Footman's 'Defend' ability, because when unit dies (even for reincarnation), it will be ordered to turn Defend ability off. There's a few caveats - for example 'turn Defend off' is issued also when boarding a transport.

The below could work:
1) Create a custom version of 'Defend' ability.
  • Remove its Techtree requirements
  • Remove values from its 'Text - Hotkey' fields
  • Set its Button Position X to 0 and Position Y to -11 (may require to open the field while holding SHIFT key down to allow negative values). This will make it so that the ability is not visible in the command card.
I have named this ability 'Reincarnation Check'

2) Detect when unit learns Reincarnation
Following trigger will add the 'Reincarnation Check' ability to hero that learns first level of Reincarnation heroic ability:
  • Reincarnation Learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Reincarnation
      • (Learned skill level) Equal to 1
    • Actions
      • Set VariableSet abilCode = Reincarnation Check
      • Unit - Add abilCode to (Triggering unit)
      • Custom script: call UnitMakeAbilityPermanent( GetTriggerUnit(), true, udg_abilCode)
This assumes that unit will reincarnate by using Heroic ability.
If unit reincarnates:
  • via Ankh of Reincarnation item, then you will need to detect when unit gains and drops that item and add/remove the 'Reincarnation Check' ability accordingly.
  • via non-heroic version of Reincarnation ability that the unit has in its Ability List in Object Editor, then just add the 'Reincarnation Check' via object editor to unit's spell list as well.

3) Detect when unit dies and will reincarnate:
  • Reincarnation Start
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(undefend))
      • (Level of Reincarnation Check for (Triggering unit)) Greater than 0
      • (Level of Reincarnation for (Triggering unit)) Greater than 0
      • (Life of (Triggering unit)) Less than 0.01
    • Actions
      • Set VariableSet ReincarnationAbility = (Unit: (Triggering unit)'s Ability with Ability Code: Reincarnation)
      • Set VariableSet ReincarnationLevel = ((Level of Reincarnation for (Triggering unit)) - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability Cooldown Remaining of (Triggering unit) for ability Reincarnation..) Greater than ((Ability: ReincarnationAbility's Real Level Field Cooldown ('acdn'), of Level: ReincarnationLevel) - 0.01)
        • Then - Actions
          • Set VariableSet ReincarnationUnit = (Triggering unit)
          • Set VariableSet ReincarnationDelay = (Ability: ReincarnationAbility's Real Level Field Reincarnation Delay ('Ore1'), of Level: ReincarnationLevel)
          • Countdown Timer - Start ReincarnationTimer as a One-shot timer that will expire in ReincarnationDelay seconds
        • Else - Actions
This detects when unit is issued to 'Turn off Defend' ability. It checks that unit has both the Reincarnation Check and Reincarnation heroic ability. It also checks if health of unit is less than 0.01 (this should negate situations like unit boarding transport).
In actions, I set ReincarnationLevel as (ability_level - 1), because the following actions use zero-based indexing for abilities (meaning value '0' represents level 1, value '1' represents level 2, etc.).
I also check that the Reincarnation ability is off cooldown. As this is 'real'-type comparison, it is better to check that remaining cooldown is > (ability_cooldown - 0.01) rather than doing string equality check as that may fail due to rounding errors. (Note: I am writing about checking if ability is off cooldown, but here I check if remaining cooldown is basically equal to ability's base cooldown. That is because at the time this trigger fires, Reincarnation just starts its own cooldown).
Finally, it gets the value of 'Reincarnation Delay' field as set in object editor - that is how long the unit remains dead before it becomes alive again. It uses that value to start a timer.

Final trigger reacts to the timer expiring:
  • Reincarnation End
    • Events
      • Time - ReincarnationTimer expires
    • Conditions
    • Actions
      • Set VariableSet location = (Position of ReincarnationUnit)
      • Unit - Create 2 Footman for (Owner of ReincarnationUnit) at location facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_location)
 
Last edited:
Did a quick test, you can use the Unit - Life event with a piss easy trigger like that:

  • Reincarnation
    • Events
      • Unit - Tauren Chieftain 0000 <gen>'s life becomes Less than or equal to 0.00
    • Conditions
      • (Ability Cooldown Remaining of (Triggering unit) for ability Reincarnation..) Equal to 0.00
    • Actions
      • -------- blablabla --------
The trigger fires on the death with the reincarnation, but not on the subsequent one if the spell is on cooldown. If you want to reference a variable or a generic unit, you need another trigger to add the event
  • Register Unit
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Trigger - Add to Reincarnation <gen> the event (Unit - MyHeroVariable's life becomes Less than or equal to 0.00)
 
ohh, sounds very complex, i thought it will be that easy...will try this one later

EDIT: I ended up making different, instead of triggering upon death, it will summon at very low health, which is fine but
doing the custom spell with script...i find it hard (bad at coding)
 
Last edited:
This adds some "missing" Events, can't promise it's up to date though:
 
Back
Top