- Joined
- Dec 13, 2018
- Messages
- 2,368
Hello
I am trying to make a spell that absorbs all damage over 15 seconds, then deals 20% of that damage to all units within 350 range that hit the shielded unit. It kinda works, but the units that are actually damaged at the end of the shield time seems to be picked at random. Here's how it looks (please look away from possible leaks if any, it will be cleaned up and fixed when the spell mechanics are working properly).
Are any of you able to see what might be wrong here?
I am trying to make a spell that absorbs all damage over 15 seconds, then deals 20% of that damage to all units within 350 range that hit the shielded unit. It kinda works, but the units that are actually damaged at the end of the shield time seems to be picked at random. Here's how it looks (please look away from possible leaks if any, it will be cleaned up and fixed when the spell mechanics are working properly).
-
Sacred Shield Spell
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
((Ability being cast) Equal to Sacred Shield LvL 1 ) or ((Ability being cast) Equal to Sacred Shield LvL 2 )
-
-
Actions
-
Set ShieldBoolean = True
-
Set ShieldCaster = (Triggering unit)
-
Set SacredShieldLocation[1] = (Position of ShieldCaster)
-
Special Effect - Create a special effect attached to the weapon of ShieldCaster using Abilities\Spells\Orc\Disenchant\DisenchantSpecialArt.mdl
-
Special Effect - Create a special effect at SacredShieldLocation[1] using Abilities\Spells\Items\ResourceItems\ResourceEffectTarget.mdl
-
Unit - Set Unit: ShieldCaster's Integer Field: Armor Type ('uarm') to Value: ARMOR_TYPE_ETHEREAL
-
Special Effect - Create a special effect attached to the origin of ShieldCaster using SacredShield.mdx
-
Set ShieldEffect = (Last created special effect)
-
Sound - Play ManaShieldCaster1 <gen> at 100.00% volume, located at SacredShieldLocation[1] with Z offset 0.00
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of Sacred Shield LvL 1 for ShieldCaster) Equal to 1
-
-
Then - Actions
-
Wait 12.00 seconds
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of Sacred Shield LvL 2 for ShieldCaster) Equal to 1
-
-
Then - Actions
-
Wait 15.00 seconds
-
-
Else - Actions
-
-
Unit - Set Unit: ShieldCaster's Integer Field: Armor Type ('uarm') to Value: ARMOR_TYPE_FLESH
-
Set ShieldUnitsNearby = (Units within 350.00 of SacredShieldLocation[1] matching ((((Matching unit) is in ShieldUnitGroup) Equal to True) and (((Matching unit) is alive) Equal to True)))
-
Unit Group - Pick every unit in ShieldUnitsNearby and do (Actions)
-
Loop - Actions
-
Camera - Shake the camera for Player 1 (Red) with magnitude 8.00
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of Sacred Shield LvL 1 for ShieldCaster) Equal to 1
-
-
Then - Actions
-
Unit - Cause ShieldCaster to damage (Picked unit), dealing (DamageTotalShield x 0.15) damage of attack type Spells and damage type Magic
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of Sacred Shield LvL 2 for ShieldCaster) Equal to 1
-
-
Then - Actions
-
Unit - Cause ShieldCaster to damage (Picked unit), dealing (DamageTotalShield x 0.20) damage of attack type Spells and damage type Magic
-
-
Else - Actions
-
-
Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
-
Special Effect - Destroy (Last created special effect)
-
-
-
Set ShieldBoolean = False
-
Custom script: call DestroyGroup(udg_ShieldUnitsNearby)
-
Wait 0.00 seconds
-
Camera - Stop swaying/shaking the camera for Player 1 (Red)
-
Unit Group - Pick every unit in ShieldUnitGroup and do (Actions)
-
Loop - Actions
-
Unit Group - Remove (Picked unit) from ShieldUnitGroup
-
-
-
Set ShieldCaster = No unit
-
Set DamageTotalShield = 0.00
-
Special Effect - Destroy ShieldEffect
-
Custom script: call RemoveLocation(udg_SacredShieldLocation[1])
-
Custom script: call RemoveLocation(udg_SacredShieldLocation[2])
-
-
-
Accumulate Damage
-
Events
-
Game - DamageEvent becomes Equal to 1.00
-
-
Conditions
-
ShieldBoolean Equal to True
-
DamageEventSource Not equal to ShieldCaster
-
(DamageEventSource belongs to an enemy of (Owner of ShieldCaster)) Equal to True
-
DamageEventTarget Equal to ShieldCaster
-
-
Actions
-
Set DamageTotalShield = (DamageTotalShield + DamageEventPrevAmt)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is Magic Immune) Equal to False
-
((Picked unit) is A structure) Equal to False
-
((Picked unit) is invulnerable) Equal to False
-
-
Then - Actions
-
Unit Group - Add DamageEventSource to ShieldUnitGroup
-
-
Else - Actions
-
-
Game - Display to (All players) the text: (String(DamageTotalShield))
-
-
-
Absorb Damage
-
Events
-
Game - DamageModifierEvent becomes Equal to 1.00
-
-
Conditions
-
ShieldBoolean Equal to True
-
(DamageEventSource belongs to an enemy of (Owner of ShieldCaster)) Equal to True
-
DamageEventTarget Equal to ShieldCaster
-
-
Actions
-
Set DamageEventAmount = 0.00
-
-
Are any of you able to see what might be wrong here?