This is what I got from the Cast and Loop trigger...
Notes
- You may need to add some more documentation clarifying the purpose of the cast and loop triggers.
- To streamline variable declaration, you should outsource it to a function.
- The point variable SW_Point might fail on recursion (e.g., a spell-effect occuring on a spell-effect event), though this situation is extremely rare. (e.g. a dummy casting a shockwave spell on the start of shockwave, messy stuff.)
Seeing the examples derived from the main Cast trigger, I would prefer that you write a function that eases out on variable declaration.
The following part of a trigger..
-
Set SW_Max = (SW_Max + 1)
-
Set SW_Caster[SW_Max] = (Triggering unit)
-
Set SW_Point[0] = (Position of (Triggering unit))
-
Set SW_Point[1] = (Target point of ability being cast)
-
Set SW_Lvl[SW_Max] = (Level of (Ability being cast) for (Triggering unit))
-
Set SW_WaveEffect[SW_Max] = Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmMissile.mdl
-
Set SW_WaveEffectEnd[SW_Max] = <Empty String>
-
Set SW_LoopingSfx[SW_Max] = False
-
Set SW_ExtraEffectTargetCheck[SW_Max] = True
-
Set SW_ExtraEffectTarget[SW_Max] = Carrion Swarm Heal <gen>
-
Set SW_AffectAlly[SW_Max] = True
-
Set SW_AffectEnemy[SW_Max] = True
-
Set SW_AffectAir[SW_Max] = True
-
Set SW_AffectGround[SW_Max] = True
-
Set SW_AffectStructure[SW_Max] = False
-
Set SW_OneInstance[SW_Max] = True
-
Set SW_AttackType[SW_Max] = Spells
-
Set SW_DamageType[SW_Max] = Magic
-
Set SW_Attachment = origin
-
Set SW_Damage[1] = 100.00
-
Set SW_Damage[2] = 200.00
-
Set SW_Damage[3] = 300.00
-
Set SW_AreaInitial[1] = 100.00
-
Set SW_AreaInitial[2] = 100.00
-
Set SW_AreaInitial[3] = 100.00
-
Set SW_AreaFinal[1] = 500.00
-
Set SW_AreaFinal[2] = 500.00
-
Set SW_AreaFinal[3] = 500.00
-
Set SW_Speed[1] = 1100.00
-
Set SW_Speed[2] = 1100.00
-
Set SW_Speed[3] = 1100.00
-
Set SW_Distance[1] = 800.00
-
Set SW_Distance[2] = 800.00
-
Set SW_Distance[3] = 800.00
Can be shortened to something like this...
-
Custom Script: call SW_create()
-
Set SW_WaveEffect[SW_Max] = Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmMissile.mdl
-
Set SW_WaveEffectEnd[SW_Max] = <Empty String>
-
Set SW_LoopingSfx[SW_Max] = False
-
Set SW_ExtraEffectTargetCheck[SW_Max] = True
-
Set SW_ExtraEffectTarget[SW_Max] = Carrion Swarm Heal <gen>
-
Custom Script: call SW_setBehavior(udg_SW_Max, true, true, true, true, false, true)
-
Set SW_AttackType[SW_Max] = Spells
-
Set SW_DamageType[SW_Max] = Magic
-
Set SW_Attachment = origin
-
Trigger - Run Shockwave Cast <gen> (ignoring conditions)
The functions can be stated like these (Suggest placing it on Map Header) (You can CnP)
Note: An additional variable SW_Point_Counter was added
JASS:
// You automate the instance creation here
function SW_create takes nothing returns integer
local integer this = udg_SW_Max + 1
set udg_SW_Max = this + 1
set udg_SW_Point_Counter = udg_S_Point_Counter + 2
set udg_SW_Caster[this] = GetTriggerUnit()
set udg_SW_Point[udg_SW_Point_Counter - 2] = GetUnitLoc(udg_SW_Caster[udg_SW_Max])
set udg_SW_Point[udg_SW_Point_Counter - 1] = GetSpellTargetLoc()
set udg_SW_Lvl[this] = GetUnitAbilityLevel(udg_SW_Caster[udg_SW_Max], GetSpellAbilityId())
return this
endfunction
function SW_setBehavior takes integer this, boolean affectAllies, boolean affectEnemy, boolean affectAir, boolean affectGround, boolean affectStructure, boolean once returns nothing
set udg_SW_AffectAlly[this] = affectAllies
set udg_SW_AffectEnemy[this] = affectEnemy
set udg_SW_AffectAir[this] = affectAir
set udg_SW_AffectGround[this] = affectGround
set udg_SW_AffectStructure[this] = affectStructure
set udg_SW_OneInstance[this] = once
endfunction
Changing the Cast trigger slightly at the end...
-
Comment: ---------- -------------------- Removes the
-
Custom script: call RemoveLocation(udg_SW_Point[udg_SW_Point_Counter - 1])
-
Custom script: call RemoveLocation(udg_SW_Point[udg_SW_Point_Counter - 2])
-
Set SW_Point_Counter = (SW_Point_Counter - 2)
This can possibly simplify the examples you've already given from the map script towards something less taxing in the long run.
Other than that, I see no reason for this not to be approved.