• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Make Lightning Shield damage only enemy units

Status
Not open for further replies.
Level 13
Joined
May 10, 2009
Messages
868
Unfortunately, Lightning Shield is hardcoded which means that any change applied to Targets Allowed won't make any difference.

A few years ago someone asked me to remake it in GUI so that the person could be able to change the Targets Allowed, and I still have that map. I just added some comments so you'll know what's the purpose of every variable, and also how to import it in your map.

EDIT: Also, the ability is based on Channel. You may want to change its Targets Allowed field, so you'll be able to target enemy units too - Currently it's marked as: Neutral, Self, Ground

  • Lightning Shield Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- You can remove all these comments if you want to. --------
      • -------- ---------------------------------------------------------- --------
      • -------- IDs --------
      • -------- The spell itself, the one a caster will have on their command card. --------
      • Set LS0_Ability = Lightning Shield
      • -------- AbilityBuff is actually another ability based on Slow Tornado ability. It's just there in order to force a buff to be shown. --------
      • -------- The actual buff --------
      • Set LS0_Buff = Lightning Shield
      • -------- Here's the basic formula which I used in order to calculate every data which belongs to this spell. --------
      • -------- DATA_INC * LEVEL + DATA_BASE --------
      • -------- So, be careful, because the base does NOT represent the level 1 data. --------
      • -------- For example, currently the damage for level 1 is 10 = [ 15 * 1 +(- 5) ] --------
      • -------- AoE: --------
      • Set LS0_AoE_Base = 160.00
      • Set LS0_AoE_Increment = 0.00
      • -------- Damage and Attack Type --------
      • Set LS0_AttackType = Spells
      • Set LS0_DamageType = Magic
      • -------- Damage Amount --------
      • Set LS0_Damage_Base = -5.00
      • Set LS0_Damage_Increment = 15.00
      • -------- The variable below determines how much time this spell should wait so that i can start damaging units nearby. --------
      • -------- The default value is 0.6 which is the time that it takes to finish the birth animation for the LightningShieldTarget model --------
      • Set LS0_Damage_Delay = 0.60
      • -------- Duration --------
      • Set LS0_Duration_Base = 20.00
      • Set LS0_Duration_Increment = 0.00
      • -------- Should its effect stack with other instances? --------
      • Set LS0_Damage_Stackable = False
      • -------- Damage SFX --------
      • Set LS0_SFX_DamagedUnits = Abilities\Spells\Orc\LightningShield\LightningShieldBuff.mdl
      • -------- Target SFX --------
      • Set LS0_SFX_Shield = Abilities\Spells\Orc\LightningShield\LightningShieldTarget.mdl
      • -------- Attachment points for both Target and Damaged units, respectively. --------
      • Set LS0_Attach_Target = origin
      • Set LS0_Attach_DamagedUnits = origin
      • -------- Since 0.1 timeout is a very small interval for repeating special effects. I've added the variables below where you can stablish a chance for special effects to be shown on damaged units. --------
      • -------- In a random number between 1 and 5. What's the chance to show the Damage SFX? In this case 2 and 1 (LS0_Chance less than or equal to 2). --------
      • Set LS0_Chance = 2
      • Set LS0_Chance_Minimum = 1
      • Set LS0_Chance_Maximum = 5
      • -------- This is the Timer Interval. Whenever you modify this value, you should change the interval in the Loop trigger as well. --------
      • Set LS0_PeriodicTimer = 0.10
      • -------- ---------------------------------------------------------- --------
      • -------- You can change the Targets allowed in the Lightning Shield Loop trigger inside the group block. --------
  • Lightning Shield Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to LS0_Ability
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LS1_Index_Size Equal to 0
        • Then - Actions
          • Trigger - Turn on Lightning Shield Loop <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LS0_Damage_Stackable Equal to False
            • Then - Actions
              • Set lstmp_filter = (Target unit of ability being cast)
              • For each (Integer lstmp_int) from 1 to LS1_Index_Size, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LS1_Target[LS1_Index_Array[lstmp_int]] Equal to lstmp_filter
                    • Then - Actions
                      • Set LS1_Duration[LS1_Index_Array[lstmp_int]] = 0.00
                      • Custom script: exitwhen true
                    • Else - Actions
            • Else - Actions
      • Set LS1_Index_Size = (LS1_Index_Size + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LS1_Index_Size Greater than LS1_Index_Max
        • Then - Actions
          • Set LS1_Index_Array[LS1_Index_Size] = LS1_Index_Size
          • Set LS1_Index_Max = LS1_Index_Size
        • Else - Actions
      • Set LS1_Current = LS1_Index_Array[LS1_Index_Size]
      • Set LS1_Caster[LS1_Current] = (Triggering unit)
      • Set LS1_Target[LS1_Current] = (Target unit of ability being cast)
      • Set lstmp_int = (Level of LS0_Ability for LS1_Caster[LS1_Current])
      • Set LS1_AoE[LS1_Current] = ((LS0_AoE_Increment x (Real(lstmp_int))) + LS0_AoE_Base)
      • Set LS1_Damage[LS1_Current] = (((LS0_Damage_Increment x (Real(lstmp_int))) + LS0_Damage_Base) x LS0_PeriodicTimer)
      • Set LS1_Duration[LS1_Current] = ((LS0_Duration_Increment x (Real(lstmp_int))) + LS0_Duration_Base)
      • Set LS1_DamageDelay[LS1_Current] = LS0_Damage_Delay
      • Special Effect - Create a special effect attached to the LS0_Attach_Target of LS1_Target[LS1_Current] using LS0_SFX_Shield
      • Set LS1_SFX[LS1_Current] = (Last created special effect)
  • Lightning Shield Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer LS1_Loop) from 1 to LS1_Index_Size, do (Actions)
        • Loop - Actions
          • Set LS1_Current = LS1_Index_Array[LS1_Loop]
          • -------- Wait for the damage delay variable to get to 0, so we can start damaging units. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LS1_DamageDelay[LS1_Current] Greater than or equal to LS0_PeriodicTimer
            • Then - Actions
              • Set LS1_DamageDelay[LS1_Current] = (LS1_DamageDelay[LS1_Current] - LS0_PeriodicTimer)
            • Else - Actions
              • -------- Check the duration --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LS1_Duration[LS1_Current] Greater than or equal to LS0_PeriodicTimer
                • Then - Actions
                  • Set LS1_Duration[LS1_Current] = (LS1_Duration[LS1_Current] - LS0_PeriodicTimer)
                  • Set lstmp_point = (Position of LS1_Target[LS1_Current])
                  • Custom script: set bj_wantDestroyGroup = true
                  • Unit Group - Pick every unit in (Units within LS1_AoE[LS1_Current] of lstmp_point) and do (Actions)
                    • Loop - Actions
                      • Set lstmp_filter = (Picked unit)
                      • -------- It is time to filter out units from the Unit Group. --------
                      • -------- TARGETS ALLOWED: --------
                      • -------- not Structure, not Magic Immune, not Dead, Ground, Enemy, not Self. --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • And - All (Conditions) are true
                            • Conditions
                              • (lstmp_filter is A structure) Equal to False
                              • (lstmp_filter is Magic Immune) Equal to False
                              • (lstmp_filter is Mechanical) Equal to False
                              • (lstmp_filter is dead) Equal to False
                              • (lstmp_filter is A ground unit) Equal to True
                              • (lstmp_filter belongs to an enemy of (Owner of LS1_Caster[LS1_Current])) Equal to True
                              • LS1_Target[LS1_Current] Not equal to lstmp_filter
                        • Then - Actions
                          • Custom script: call UnitDamageTarget( udg_LS1_Caster[udg_LS1_Current], udg_lstmp_filter, udg_LS1_Damage[udg_LS1_Current], true, true, udg_LS0_AttackType, udg_LS0_DamageType, null )
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Random integer number between LS0_Chance_Minimum and LS0_Chance_Maximum) Less than or equal to LS0_Chance
                            • Then - Actions
                              • Special Effect - Create a special effect attached to the LS0_Attach_DamagedUnits of lstmp_filter using LS0_SFX_DamagedUnits
                              • Special Effect - Destroy (Last created special effect)
                            • Else - Actions
                        • Else - Actions
                  • Custom script: call RemoveLocation(udg_lstmp_point)
                  • -------- If target is dead, then we should stop this instance immediately. --------
                  • Custom script: if IsUnitType(udg_LS1_Target[udg_LS1_Current], UNIT_TYPE_DEAD) or GetUnitTypeId(udg_LS1_Target[udg_LS1_Current]) == 0 or GetUnitAbilityLevel(udg_LS1_Target[udg_LS1_Current], udg_LS0_Buff) == 0 then
                  • Set LS1_Duration[LS1_Current] = 0.00
                  • Custom script: endif
                • Else - Actions
                  • -------- The duration has just expired; this is the end of this instance. --------
                  • Special Effect - Destroy LS1_SFX[LS1_Current]
                  • Set LS1_Index_Array[LS1_Loop] = LS1_Index_Array[LS1_Index_Size]
                  • Set LS1_Index_Array[LS1_Index_Size] = LS1_Current
                  • Set LS1_Index_Size = (LS1_Index_Size - 1)
                  • Set LS1_Loop = (LS1_Loop - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LS1_Index_Size Equal to 0
                    • Then - Actions
                      • Trigger - Turn off Lightning Shield Loop <gen>
                      • Skip remaining actions
                    • Else - Actions

EDIT: Well, the old version didn't have any buff.
 

Attachments

  • Lightning Shield.w3x
    25.8 KB · Views: 109
Last edited:
Level 10
Joined
Oct 5, 2008
Messages
355
Interestingly, i have made a custom buff for my GBS as an example (#shamelessadvertising) which replicates almost the exact same effect as lightning shield, but has some other effects as well since it was made to replicate immolation. (It's the immolation buff, you only need to change the sfx, remove the mana drain out of the trigger and remove the events which switches out the abilities for toggling immolation on and off).
It would take over most of the indexing operations Bloodsoul's trigger is making, but since its a bit more modular and heavy on its side i wouldn't recommend using it when you only need to trigger the lightning shield (it really pays off when you trigger more than like 5-7 buffs, since it can be used to centralize a lot).

Link: GUI Buff System (GBS) V. 1.4

If you need some help with that you can pm me.
 
Last edited:
Level 22
Joined
Aug 27, 2013
Messages
3,973
It didn't have any so far, and, to be honest, I forgot about such a thing. hahaha
Thanks for reminding me of that. Now it has a buff based on tornado slow. However, the only downside is that it can't be purged/removed.
Why don't just give the actual lightning shield buff with no damage? Then just check if the target has the buff during the loop, if not then deindex, so it can be purged or removed.
 
Level 13
Joined
May 10, 2009
Messages
868
I've been editing that file piece by piece within time, and I haven't fixed simple problems such as that one. So we have that combined with my lazy power which resulted into this mess. Though, that's a good idea, I'll fix it.

EDIT: There... working as intended.
 
Last edited:
Status
Not open for further replies.
Top