• 🏆 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!

[Spell] Lightning Spell Bug

Status
Not open for further replies.
Level 3
Joined
Jul 14, 2017
Messages
49
Hi,



I am having trouble with the Lightning Shield ability, I have modified it to heal nearby units by changing the damage value to "-20", it works but it's not consistent in that sometimes only some units are affected even when they are standing right next to it and overall is buggy and stressful.

I was wondering if maybe that's just the nature of the Lightning Spell ability.
But what's even more annoying is that when I try to replicate it on a test map it all works perfectly while on my main map it bugs.


If anyone could help me making this ability work consistently.
 
Level 3
Joined
Jul 14, 2017
Messages
49
Well your response is troubling, none of what you said applies to my map. I have barely edited a few units, and the map is 256x256.

I have seen similar spells in larger maps like Azeroth Wars, and the spells work fine even though I imagine they would have had a lot of triggers and regions and the map is around 384x384 so even if my map had been like that it could have worked.

I can try make a new map and it may indeed work fine but if what you say is true problems may appear later in production, so at this point I just want to understand what exactly is happening.

EDIT: I tried sending you the actual problem map but I can not private message you as it says it is spam.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
EDIT: I tried sending you the actual problem map but I can not private message you as it says it is spam.
This must be a site wide spam filter, recently it was attacked by plagues of spam bots.

It could be map complexity related. For example maybe your map has more units/destructables on it than the test map? One approach to test this would be to dump 20,000 trees and 2,000 units onto a test map where the ability seems to work perfectly and see if it still works perfectly.
 
Level 3
Joined
Jul 14, 2017
Messages
49
Alright, I've replaced the test map, so you can try it yourself. And as you will see there are barely any objects that may appear to interfere.
 
Level 3
Joined
Jul 14, 2017
Messages
49
From what I can tell the ability does not like negative damage values. Change it back to positive damage and it works perfectly again.


Alright thanks, so the map ain't corrupted or something, well if that spell won't work it ain't the end of the world. Thanks.

EDIT: Though wait, is there any way to make that ability work?
 
Last edited:
Level 13
Joined
May 10, 2009
Messages
868
Yes, you could make your own Healing Shield through triggers. I have triggered a lightning shield for someone, and edited it recently for another person. It works as intended - it supports buff, multiple levels, etc. You only have to change its damage function to a "Set Unit Life" function and a couple of conditions, and also change its special effects.

  • 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 [Custom]
      • -------- 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
                          • (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
Code:
How to import it:

1st - You need to mark the following option -> File - Preferences... - General Tab ->
 [x] Automatically create unknown variables while pasting trigger data

2nd - Go to the Object Editor (Abilities Tab) and copy the spell "Lightning Shield", and also its buff "Lightning Shield [Custom]". Don't load your map yet, because you can copy the triggers at the same time. Now paste them in your map.

3rd - You need to pay attention for minor bugs with some trigger data. For example, the AbilityId variable probably has a different value now, because the Lightning Shield RawID changes while pasting it in your object editor. Fix it by setting its value back to Set LS0_Ability = Lightning Shield. Do the same thing for the buff and abilitybuff. Also, the action "Trigger - Turn on Lightning Shield Loop <gen>" is marked as disabled, enable it if so.

4th - Give the ability to a hero, and it's done.
 

Attachments

  • Lightning Shield.w3x
    26 KB · Views: 45
Status
Not open for further replies.
Top