• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Bribe's Reincarnation Detection Trigger

Status
Not open for further replies.
Level 8
Joined
Jul 18, 2010
Messages
332
http://www.hiveworkshop.com/forums/spells-569/unit-event-v2-0-0-0-a-201641/

I already PM Bribe about this but I'm a bit impatient, sorry about that, so I'll ask it here too.
Does anybody know the variable that represents the reincarnated unit in his triggers?

I'm having trouble making my trigger work and I don't even know where exactly shall I put my triggers.

I also only need the reincarnation triggers actually but I don't know which ones are to keep and which ones to delete.
 
right from the tutorial explanation

How to use
To detect when a unit starts reincarnating (the instant it dies) use the event:
"Game - DeathEvent becomes Equal to 0.50" (I use 0.50 because it's a half-death). Use
the event "Game - DeathEvent becomes Equal to 1.00" (a full death). This is the same
as the event "Unit - Any unit Dies" except that it also fires when a dead unit is created.

Use the event "Game - DeathEvent becomes Equal to 2.00" to detect when a unit finishes
reincarnating, when it's reanimated or resurrected. You can determine between the three
of these as well. If it is summoned, that means it was reanimated. If IsUnitReincarnating[UDex]
is true, that means it finished reincarnating. Otherwise, it was simply resurrected.

Use the event "Game - DeathEvent becomes Equal to 3.00" to detect when a unit is
removed from the game or when its corpse has completely decayed.
 
The variable that represents the reincarnated unit is "UDexUnits[UDex]".

Also, if you just need the reincarnation triggers, then just copy the triggers "Unit Event" and "Unit Indexer". Unit Event contains the other events as well, but I don't really recommend altering it much since a lot of the code is intertwined. Besides, it is not that much extra code.
 
Level 8
Joined
Jul 18, 2010
Messages
332
Where shall I put my triggers, in the unit event, right?

Here's what I got.
I actually remove the "unitindexevent becomes equal to 2.00" at first. That probably was the problem.

  • Unit Event
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
      • Game - UnitIndexEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • -------- --------
      • -------- Functionality credits go to Nestharus (for vJass UnitEvent) and grim001 (for AutoEvents) --------
      • -------- --------
      • Custom script: if udg_DEvAbility == 0 then
      • -------- --------
      • -------- Copy Death Event Ability from Object Editor, then set DEvAbility to it as follows --------
      • -------- --------
      • Set DEvAbility = Death Event Ability (Undefend Detect)
      • -------- --------
      • Custom script: call ExecuteFunc("InitDeathEvent")
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UDexUnits[UDex] is in bunkerherogroup) Equal to True
        • Then - Actions
          • Animation - Change UDexUnits[UDex]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
          • Sound - Play WarStompBirth1 <gen> at 100.00% volume, attached to UDexUnits[UDex]
          • Unit - Set UDexUnits[UDex] movement speed to (Default movement speed of UDexUnits[UDex])
          • Unit - Turn collision for UDexUnits[UDex] On
          • Unit - Remove classification of An Ancient from UDexUnits[UDex]
          • Unit - Remove Cargo Hold (Orc Burrow) from UDexUnits[UDex]
          • Unit - Remove Disable Spells buff from UDexUnits[UDex]
          • Unit Group - Remove UDexUnits[UDex] from bunkerherogroup
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Rifleman Point Copy <gen> contains UDexUnits[UDex]) Equal to True
            • Then - Actions
              • Custom script: call UnitRemoveAbility(udg_riflemandummy, 'Aloc')
              • Unit - Add classification of A peon-type unit to riflemandummy
              • Unit - Pause riflemandummy
              • Unit - Change ownership of riflemandummy to Neutral Passive and Change color
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Rifleman Point Copy 7 <gen> contains UDexUnits[UDex]) Equal to True
            • Then - Actions
              • Custom script: call UnitRemoveAbility(udg_riflemandummy_Copy_3, 'Aloc')
              • Unit - Add classification of A peon-type unit to riflemandummy_Copy_3
              • Unit - Pause riflemandummy_Copy_3
              • Unit - Change ownership of riflemandummy_Copy_3 to Neutral Passive and Change color
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Rifleman Point Copy 10 <gen> contains UDexUnits[UDex]) Equal to True
            • Then - Actions
              • Custom script: call UnitRemoveAbility(udg_riflemandummy_Copy_2, 'Aloc')
              • Unit - Pause riflemandummy_Copy_2
              • Unit - Add classification of A peon-type unit to riflemandummy_Copy_2
              • Unit - Change ownership of riflemandummy_Copy_2 to Neutral Passive and Change color
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Rifleman Point Copy 4 <gen> contains UDexUnits[UDex]) Equal to True
            • Then - Actions
              • Custom script: call UnitRemoveAbility(udg_riflemandummy_Copy, 'Aloc')
              • Unit - Pause riflemandummy_Copy
              • Unit - Add classification of A peon-type unit to riflemandummy_Copy
              • Unit - Change ownership of riflemandummy_Copy to Neutral Passive and Change color
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Khufu Bunker <gen> contains UDexUnits[UDex]) Equal to True
            • Then - Actions
              • Custom script: call UnitRemoveAbility(udg_riflemandummy_Copy_4, 'Aloc')
              • Unit - Pause riflemandummy_Copy_4
              • Unit - Add classification of A peon-type unit to riflemandummy_Copy_4
              • Unit - Change ownership of riflemandummy_Copy_4 to Neutral Passive and Change color
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexEvent Equal to 1.00
        • Then - Actions
          • Unit - Add DEvAbility to UDexUnits[UDex]
          • Custom script: call UnitMakeAbilityPermanent(udg_UDexUnits[udg_UDex], true, udg_DEvAbility)
          • Set DEvBlock[UDex] = True
          • Set IsUnitAlive[UDex] = True
          • Custom script: call ExecuteFunc("DEvCheckDeathProxy")
        • Else - Actions
          • Set IsUnitAlive[UDex] = False
          • Set IsUnitReincarnating[UDex] = False
          • Set DEvRemoved[UDex] = False
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CargoTransportUnit[UDex] Not equal to No unit
            • Then - Actions
              • Custom script: call ExecuteFunc("CEvFireUnload")
            • Else - Actions
          • Custom script: if udg_CargoTransportGroup[udg_UDex] != null then
          • Custom script: call DestroyGroup(udg_CargoTransportGroup[udg_UDex])
          • Custom script: set udg_CargoTransportGroup[udg_UDex] = null
          • Custom script: endif
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvFireUnload takes nothing returns nothing
      • Unit Group - Remove UDexUnits[UDex] from CargoTransportGroup[(Custom value of CargoTransportUnit[UDex])]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CEvSpecial[UDex] Equal to True
        • Then - Actions
          • Set CEvSpecial[UDex] = False
          • Set CEvNext[CEvPrev[UDex]] = CEvNext[UDex]
          • Set CEvPrev[CEvNext[UDex]] = CEvPrev[UDex]
          • Set CEvPrev[UDex] = 0
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CEvNext[0] Equal to 0
            • Then - Actions
              • Countdown Timer - Pause CEvUnloadTimer
            • Else - Actions
        • Else - Actions
      • Set CEvBlock[UDex] = True
      • Set CargoEvent = 0.00
      • Set CargoEvent = 2.00
      • Set CargoEvent = 0.00
      • Set CEvBlock[UDex] = False
      • Custom script: if not IsUnitLoaded(udg_UDexUnits[udg_UDex]) or IsUnitType(udg_CargoTransportUnit[udg_UDex], UNIT_TYPE_DEAD) or GetUnitTypeId(udg_CargoTransportUnit[udg_UDex]) == 0 then
      • Set CargoTransportUnit[UDex] = No unit
      • Custom script: endif
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DEvOnDeath takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Set UDex = (Custom value of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UDex Not equal to 0
        • Then - Actions
          • Set IsUnitAlive[UDex] = False
          • Set DeathEvent = 0.00
          • Set DeathEvent = 1.00
          • Set DeathEvent = 0.00
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CargoTransportUnit[UDex] Not equal to No unit
            • Then - Actions
              • Custom script: call CEvFireUnload()
            • Else - Actions
        • Else - Actions
      • Custom script: set udg_UDex = pdex
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DEvCheckDeath takes nothing returns nothing
      • Set UDex = DEvList[0]
      • Set DEvList[0] = 0
      • Custom script: loop
      • Custom script: exitwhen udg_UDex == 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DEvBlock[UDex] Equal to True
        • Then - Actions
          • Set DEvBlock[UDex] = False
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IsUnitAlive[UDex] Equal to True
            • Then - Actions
              • Set IsUnitAlive[UDex] = False
              • Set IsUnitReincarnating[UDex] = True
              • Set DeathEvent = 0.50
              • Set DeathEvent = 0.00
            • Else - Actions
      • Set UDex = DEvList[UDex]
      • Custom script: endloop
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DEvCheckDeathProxy takes nothing returns nothing
      • Set DEvList[UDex] = DEvList[0]
      • Set DEvList[0] = UDex
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DEvOnOrder takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Set UDex = (Custom value of (Matching unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UDex Not equal to 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of DEvAbility for UDexUnits[UDex]) Equal to 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DEvRemoved[UDex] Equal to False
                • Then - Actions
                  • Set DEvRemoved[UDex] = True
                  • Set DeathEvent = 0.00
                  • Set DeathEvent = 3.00
                  • Set DeathEvent = 0.00
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IsUnitAlive[UDex] Equal to False
                • Then - Actions
                  • Set IsUnitAlive[UDex] = True
                  • Set DeathEvent = 0.00
                  • Set DeathEvent = 2.00
                  • Set DeathEvent = 0.00
                  • Set IsUnitReincarnating[UDex] = False
                • Else - Actions
                  • Custom script: if IsUnitType(udg_UDexUnits[udg_UDex], UNIT_TYPE_DEAD) then
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DEvBlock[UDex] Equal to True
                    • Then - Actions
                      • Set IsUnitAlive[UDex] = False
                      • Set DeathEvent = 0.00
                      • Set DeathEvent = 1.00
                      • Set DeathEvent = 0.00
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CEvSpecial[UDex] Equal to True
                          • (UDexUnits[UDex] is A Hero) Equal to True
                        • Then - Actions
                        • Else - Actions
                          • Custom script: call DEvCheckDeathProxy()
                  • Custom script: endif
          • Custom script: if udg_CargoTransportUnit[udg_UDex] != null and not udg_CEvBlock[udg_UDex] and not IsUnitLoaded(udg_UDexUnits[udg_UDex]) or IsUnitType(udg_UDexUnits[udg_UDex], UNIT_TYPE_DEAD) then
          • Custom script: call CEvFireUnload()
          • Custom script: endif
        • Else - Actions
      • Custom script: set udg_UDex = pdex
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvUnloadChecker takes nothing returns nothing
      • Set UDex = CEvNext[0]
      • Custom script: loop
      • Custom script: exitwhen udg_UDex == 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UDexUnits[UDex] is being transported) Equal to False
        • Then - Actions
          • Custom script: call CEvFireUnload()
        • Else - Actions
      • Set UDex = CEvNext[UDex]
      • Custom script: endloop
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvStartChecker takes nothing returns nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CEvNext[0] Equal to 0
        • Then - Actions
          • Custom script: call TimerStart(udg_CEvUnloadTimer, 0.03125, true, function CEvUnloadChecker)
        • Else - Actions
      • Set CEvSpecial[UDex] = True
      • Set CEvPrev[CEvNext[0]] = UDex
      • Set CEvNext[UDex] = CEvNext[0]
      • Set CEvNext[0] = UDex
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvOnLoad takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Custom script: local integer udg_TempInteger
      • Set UDex = (Custom value of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UDex Not equal to 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CargoTransportUnit[UDex] Not equal to No unit
            • Then - Actions
              • Custom script: call CEvFireUnload()
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IsUnitAlive[UDex] Equal to False
            • Then - Actions
              • Custom script: call CEvStartChecker()
            • Else - Actions
          • Set CargoTransportUnit[UDex] = (Transporting unit)
          • Set TempInteger = (Custom value of CargoTransportUnit[UDex])
          • Custom script: if udg_CargoTransportGroup[udg_TempInteger] == null then
          • Custom script: set udg_CargoTransportGroup[udg_TempInteger] = CreateGroup()
          • Custom script: endif
          • Unit Group - Add UDexUnits[UDex] to CargoTransportGroup[TempInteger]
          • Set CargoEvent = 0.00
          • Set CargoEvent = 1.00
          • Set CargoEvent = 0.00
        • Else - Actions
      • Custom script: set udg_UDex = pdex
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvOnPause takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Set UDex = (Custom value of (Matching unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UDexUnits[UDex] is paused) Equal to True
          • CargoTransportUnit[UDex] Not equal to No unit
          • CEvSpecial[UDex] Equal to False
        • Then - Actions
          • Custom script: call CEvStartChecker()
        • Else - Actions
      • Custom script: set udg_UDex = pdex
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitDeathEvent takes nothing returns nothing
      • Custom script: local integer i = 15
      • Custom script: local player p
      • Custom script: local trigger d = CreateTrigger()
      • Custom script: local trigger l = CreateTrigger()
      • Custom script: local trigger t = GetTriggeringTrigger()
      • Custom script: local boolexpr o = Filter(function DEvOnOrder)
      • Custom script: local boolexpr u = Filter(function CEvOnPause)
      • Custom script: call TriggerAddCondition(d, Filter(function DEvOnDeath))
      • Custom script: call TriggerAddCondition(l, Filter(function CEvOnLoad))
      • Custom script: loop
      • Custom script: set p = Player(i)
      • Custom script: call SetPlayerAbilityAvailable(p, udg_DEvAbility, false)
      • Custom script: call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_ISSUED_ORDER, o)
      • Custom script: call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, u)
      • Custom script: call TriggerRegisterPlayerUnitEvent(d, p, EVENT_PLAYER_UNIT_DEATH, null)
      • Custom script: call TriggerRegisterPlayerUnitEvent(l, p, EVENT_PLAYER_UNIT_LOADED, null)
      • Custom script: exitwhen i == 0
      • Custom script: set i = i - 1
      • Custom script: endloop
      • Custom script: set d = null
      • Custom script: set l = null
      • Custom script: set o = null
      • Custom script: set p = null
      • Custom script: set t = null
      • Custom script: set u = null
      • Custom script: call DestroyGroup(udg_CargoTransportGroup[0])
      • Custom script: set udg_CargoTransportGroup[0] = null
 
Status
Not open for further replies.
Top