After centuries of AOM non-activity, I have created a new effect I will use in my Thrynn boss battle scenario. Yes, I called it an Effect not a trigger and yes, my thread title is redundant looking, but not really. Here are the details:
This is a self managing looped effect (must be set to loop). It is best to put this effect ALONE in a trigger because when all of its selected units have died, it will stop the entire trigger automatically. For the condition, I recommend Always because it needs to track the coordinates of the selected units before they die which makes the coordinates return -1, -1, -1, so it needs to run as frequently as you can afford it to (keeping lag in mind).
Parameters:
Looped effect index: you can use as many of these effects as you'd like, but give each one a different number for the effect index.
Change Proto on Death: This is optional and will do nothing if you leave it at Cinematic Block, but if you choose a protounit, the effect will change the unit to that protounit (usually halfway through their dying animation).
Create Proto At Corpse 1/2/3: When the unit is dead, you can set up to 3 objects to be created at the location of their death. This is good for special effects or additional blood, etc..
Revive Hitpoints: If you choose to change the dying unit into another living unit, here is where you set how many hitpoints they will come back to life with. Make sure this is at least 1 to make sure the replacement protounit has some life.
Video Preview: (watch in HD)
code
This is a self managing looped effect (must be set to loop). It is best to put this effect ALONE in a trigger because when all of its selected units have died, it will stop the entire trigger automatically. For the condition, I recommend Always because it needs to track the coordinates of the selected units before they die which makes the coordinates return -1, -1, -1, so it needs to run as frequently as you can afford it to (keeping lag in mind).
Video Preview: (watch in HD)
<Effect name="EL Enhanced Dying Effects">
<Param name="effidx" dispName="Unique effect index" varType="string"> 1< /Param>
<Param name="SrcObject" dispName="Unit(s)" varType="unit"> < /Param>
<Param name="protochange" dispName="Change Proto on Death" VarType="Protounit"> Cinematic Block< /Param>
<Param name="protocreate1" dispName="Create Proto at corpse 1" VarType="Protounit"> Cinematic Block< /Param>
<Param name="protocreate2" dispName="Create Proto at corpse 2" VarType="Protounit"> Cinematic Block< /Param>
<Param name="protocreate3" dispName="Create Proto at corpse 3" VarType="Protounit"> Cinematic Block< /Param>
<Param name="revivehp" dispName="Revive Hitpoints" VarType="float"> 1< /Param>
<Command> for(effidx = 0; > 1){} < /Command>
<Command> for(x = 0; > 1){} < /Command>
<Command> for(y = 0; > 1){} < /Command>
<Command> for(z = 0; > 1){} < /Command>
<Command> for(unithdng = 0; > 1){} < /Command>
<Command> for(deadcount = 0; > 1){} < /Command>
<Command> for(selcount = 0; > 1){} < /Command>
<Command> for(idx = 0; > 1){} < /Command>
<Command> for(unitblockid = 0; > 1){} < /Command>
<Command> for(prevcontext = 0; > 1){} < /Command>
<Command loop="" loopParm="SrcObject"> selcount++; < /Command> //count selected units
<Command> effidx = % effidx% ; < /Command>
<Command> if(trQuestVarGet("adeinit" + "% effidx% ")==0) { < /Command> //if we haven't intialized yet
<Command> trQuestVarSet("adeinit" + "% effidx% ", 1); < /Command> //now we have initialized it
<Command> } < /Command> //has this been initialized
<Command> < ![ CDATA[ for(idxunit= 0; < = selcount-1){ ] ] > < /Command> //for each selected unit
<Command> idx = 0; < /Command>
<Command loop="" loopParm="SrcObject"> if(idx == idxunit) unitblockid = kbGetBlockID("% SrcObject% "); idx++;< /Command> //remember the idxunit-th unit's block id
<Command> trUnitSelectClear(); < /Command> //make sure nothing is currently selected
<Command> trUnitSelectByID(unitblockid); < /Command> //select that unit
<Command> if(trUnitDead()) { < /Command> //is it dead?
<Command> if(trQuestVarGet("ade" + unitblockid)==0) { < /Command> //if we haven't processed this unit before
<Command> trQuestVarSet("ade" + unitblockid, 1); < /Command> //remember that we processed this unit
<Command> if("% protochange% " != "Cinematic Block") { < /Command> //if we are asked to change the protounit
<Command> trUnitSelectClear(); < /Command>
<Command> trUnitSelectByID(unitblockid); < /Command>
<Command> trUnitChangeProtoUnit("Arkantos"); < /Command> //make it a hero so it can come back to life
<Command> trUnitSelectClear(); < /Command>
<Command> trUnitSelectByID(unitblockid); < /Command>
<Command> trDamageUnit(-% revivehp% ); < /Command> //give it the given hitpoints
<Command> trUnitSelectClear(); < /Command>
<Command> trUnitSelectByID(unitblockid); < /Command>
<Command> trUnitChangeProtoUnit("% protochange% "); < /Command> //now we can change it to any protounit
<Command> } < /Command> //if we are asked to change the proto
<Command> if("% protocreate1% " + "% protocreate2% " + "% protocreate3% " != "Cinematic BlockCinematic BlockCinematic Block") {< /Command> //if they asked to create at least 1 unit
<Command> x = trQuestVarGet("ade" + effidx + "x" + idxunit); < /Command>
<Command> y = trQuestVarGet("ade" + effidx + "y" + idxunit); < /Command>
<Command> z = trQuestVarGet("ade" + effidx + "z" + idxunit); < /Command>
<Command> unithdng = trQuestVarGet("ade" + effidx + "heading" + idxunit); < /Command>
<Command> if("% protocreate1% " != "Cinematic Block") { < /Command> //if they asked to create proto unit 1
<Command> trUnitCreate("% protocreate1% ", "ade" + effidx + "u" + idxunit + "fx1", x, y, z, unithdng, 1);< /Command>
<Command> } < /Command> //create proto unit 1
<Command>