[Spell] Why doesn't this ability damage structures?

Level 16
Joined
Jul 19, 2007
Messages
942
I have an ability in my map that I renamed to "Grenade" and it is meant to damage all enemy units in the target area and cause 1/3 of the damage to structures but it doesn't damage structures at all and I dunno why. Pls help!

  • Grenade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shrapnel_Ability
    • Actions
      • Set VariableSet Caster = (Triggering unit)
      • Set VariableSet Identificador = (Triggering unit)
      • Set VariableSet Entero = ((Load (Key Shrapnel 0.) of (Key Identificador.) from TablaHash.) + 1)
      • Set VariableSet Punto = (Position of (Triggering unit))
      • Hashtable - Save (X of Punto) as (Key ((S_X + 0) + (String(Entero))).) of (Key Identificador.) in TablaHash.
      • Hashtable - Save (X of Punto) as (Key ((S_Y + 0) + (String(Entero))).) of (Key Identificador.) in TablaHash.
      • Set VariableSet Punto2 = (Target point of ability being cast)
      • Hashtable - Save (X of Punto2) as (Key ((S_X + (String(1))) + (String(Entero))).) of (Key Identificador.) in TablaHash.
      • Hashtable - Save (Y of Punto2) as (Key ((S_Y + (String(1))) + (String(Entero))).) of (Key Identificador.) in TablaHash.
      • Set VariableSet Real = (Angle from Punto to Punto2)
      • For each (Integer A) from 0 to 3, do (Actions)
        • Loop - Actions
          • Set VariableSet Punto3 = (Punto2 offset by 340.00 towards (Real + (90.00 x (Real((Integer A))))) degrees.)
          • Hashtable - Save (X of Punto3) as (Key ((S_X + (String(((Integer A) + 2)))) + (String(Entero))).) of (Key Identificador.) in TablaHash.
          • Hashtable - Save (Y of Punto3) as (Key ((S_Y + (String(((Integer A) + 2)))) + (String(Entero))).) of (Key Identificador.) in TablaHash.
          • Custom script: call RemoveLocation(udg_Punto3)
          • Set VariableSet Punto3 = (Punto2 offset by 220.00 towards (Real + (45.00 + (90.00 x (Real((Integer A)))))) degrees.)
          • Hashtable - Save (X of Punto3) as (Key ((S_X + (String(((Integer A) + 6)))) + (String(Entero))).) of (Key Identificador.) in TablaHash.
          • Hashtable - Save (Y of Punto3) as (Key ((S_Y + (String(((Integer A) + 6)))) + (String(Entero))).) of (Key Identificador.) in TablaHash.
          • Custom script: call RemoveLocation(udg_Punto3)
      • Hashtable - Save (12.00 x (Real((Level of (Ability being cast) for (Triggering unit))))) as (Key (S_Damage + (String(Entero))).) of (Key Identificador.) in TablaHash.
      • Hashtable - Save 0.28 as (Key (S_Delay1 + (String(Entero))).) of (Key Identificador.) in TablaHash.
      • Hashtable - Save 0.52 as (Key (S_Delay2 + (String(Entero))).) of (Key Identificador.) in TablaHash.
      • Hashtable - Save 0.00 as (Key (S_Delay3 + (String(Entero))).) of (Key Identificador.) in TablaHash.
      • Hashtable - Save 0.00 as (Key (S_Time + (String(Entero))).) of (Key Identificador.) in TablaHash.
      • Hashtable - Save Entero as (Key Shrapnel 0.) of (Key Identificador.) in TablaHash.
      • Unit Group - Add (Triggering unit) to Shrapnel_Grupo
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Shrapnel_Grupo) Equal to 1
        • Then - Actions
          • Trigger - Turn on Grenade Loop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Punto)
      • Custom script: call RemoveLocation(udg_Punto2)
  • Grenade Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Shrapnel_Grupo) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in Shrapnel_Grupo and do (Actions)
            • Loop - Actions
              • Custom script: local real x
              • Custom script: local real y
              • Custom script: local integer Id = GetHandleId(GetEnumUnit())
              • Set VariableSet Caster = (Picked unit)
              • Set VariableSet Jugador = (Owner of (Picked unit))
              • Set VariableSet Identificador = (Picked unit)
              • Set VariableSet Entero = (Load (Key Shrapnel 0.) of (Key Identificador.) from TablaHash.)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Entero Greater than 0
                • Then - Actions
                  • For each (Integer i) from 1 to Entero, do (Actions)
                    • Loop - Actions
                      • Set VariableSet Damage = (Load (Key (S_Damage + (String(i))).) of (Key Identificador.) from TablaHash.)
                      • Set VariableSet Real = (Load (Key (S_Delay1 + (String(i))).) of (Key Identificador.) from TablaHash.)
                      • Set VariableSet Real = (Real - 0.04)
                      • Hashtable - Save Real as (Key (S_Delay1 + (String(i))).) of (Key Identificador.) in TablaHash.
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Real Less than 0.01
                        • Then - Actions
                          • Set VariableSet Real2 = (Load (Key (S_Delay2 + (String(i))).) of (Key Identificador.) from TablaHash.)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Real2 Greater than or equal to 0.01
                            • Then - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Real2 Equal to 0.60
                                • Then - Actions
                                  • Custom script: set x = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_X" + "0" ) + I2S(udg_i) )))
                                  • Custom script: set y = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_Y" + "0" ) + I2S(udg_i) )))
                                  • Custom script: set udg_Punto = Location(x,y)
                                  • For each (Integer A) from 1 to 9, do (Actions)
                                    • Loop - Actions
                                      • Custom script: set x = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_X" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                      • Custom script: set y = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_Y" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                      • Custom script: set udg_Punto2 = Location(x,y)
                                      • Unit - Create 1 Dummy for Jugador at Punto facing (Angle from Punto to Punto2) degrees
                                      • Animation - Change (Last created unit) flying height to 500.00 at 0.00
                                      • Special Effect - Create a special effect attached to the origin of (Last created unit) using Shrapnel_ModelEffectMisil
                                      • Hashtable - Save Handle Of(Last created unit) as (Key ((S_Dummy + (String((Integer A)))) + (String(i))).) of (Key Identificador.) in TablaHash.
                                      • Hashtable - Save Handle Of(Last created special effect) as (Key ((S_Efecto + (String((Integer A)))) + (String(i))).) of (Key Identificador.) in TablaHash.
                                      • Hashtable - Save ((Distance between Punto and Punto2) / 13.00) as (Key Speed.) of (Key (Last created unit).) in TablaHash.
                                      • Custom script: call RemoveLocation(udg_Punto2)
                                  • Custom script: call RemoveLocation(udg_Punto)
                                • Else - Actions
                              • For each (Integer A) from 1 to 9, do (Actions)
                                • Loop - Actions
                                  • Custom script: set x = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_X" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                  • Custom script: set y = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_Y" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                  • Set VariableSet Dummy_Grenade = (Load (Key ((S_Dummy + (String((Integer A)))) + (String(i))).) of (Key Identificador.) in TablaHash.)
                                  • Custom script: set udg_Real3 = LoadReal(udg_TablaHash, GetHandleId(udg_Dummy_Grenade), StringHash("Speed"))
                                  • Set VariableSet Punto = (Position of Dummy_Grenade)
                                  • Custom script: set udg_Punto2 = Location(x,y)
                                  • Set VariableSet Punto3 = (Punto offset by Real3 towards (Angle from Punto to Punto2) degrees.)
                                  • Unit - Move Dummy_Grenade instantly to Punto3
                                  • Animation - Change Dummy_Grenade flying height to ((Current flying height of Dummy_Grenade) - 38.46) at 0.00
                                  • Custom script: call RemoveLocation(udg_Punto2)
                                  • Custom script: call RemoveLocation(udg_Punto)
                              • Set VariableSet Real2 = (Real2 - 0.04)
                              • Hashtable - Save Real2 as (Key (S_Delay2 + (String(i))).) of (Key Identificador.) in TablaHash.
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Real2 Equal to 0.00
                                • Then - Actions
                                  • For each (Integer A) from 1 to 9, do (Actions)
                                    • Loop - Actions
                                      • Set VariableSet Dummy_Grenade = (Load (Key ((S_Dummy + (String((Integer A)))) + (String(i))).) of (Key Identificador.) in TablaHash.)
                                      • Set VariableSet Efecto = (Load (Key ((S_Efecto + (String((Integer A)))) + (String(i))).) of (Key Identificador.) in TablaHash.)
                                      • Custom script: call FlushChildHashtable(udg_TablaHash, GetHandleId(udg_Dummy_Grenade))
                                      • Unit - Kill Dummy_Grenade
                                      • Special Effect - Destroy Efecto
                                  • Hashtable - Save -0.10 as (Key (S_Delay2 + (String(i))).) of (Key Identificador.) in TablaHash.
                                • Else - Actions
                              • Set VariableSet Real = ((Load (Key (S_Time + (String(i))).) of (Key Identificador.) from TablaHash.) + 0.04)
                              • Set VariableSet Real3 = (Load (Key (S_Delay3 + (String(i))).) of (Key Identificador.) from TablaHash.)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Real3 Equal to 0.00
                                • Then - Actions
                                  • Custom script: set x = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_X" + I2S(1) ) + I2S(udg_i) )))
                                  • Custom script: set y = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_Y" + I2S(1) ) + I2S(udg_i) )))
                                  • Custom script: set udg_Punto = Location(x,y)
                                  • For each (Integer A) from 1 to 9, do (Actions)
                                    • Loop - Actions
                                      • Custom script: set x = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_X" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                      • Custom script: set y = LoadReal(udg_TablaHash, Id, StringHash(( ( "S_Y" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                      • Custom script: set udg_Punto2 = Location(x,y)
                                      • Special Effect - Create a special effect at Punto2 using Shrapnel_ModelEffectEfecto
                                      • Special Effect - Destroy (Last created special effect)
                                      • Custom script: call RemoveLocation(udg_Punto2)
                                  • Set VariableSet Grupo = (Units within 400.00 of Punto matching ((((Matching unit) is Mechanical) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of Jugador.) Equal to True))).)
                                  • Unit Group - Pick every unit in Grupo and do (Actions)
                                    • Loop - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • ((Picked unit) is A structure) Equal to True
                                        • Then - Actions
                                          • Unit - Cause Caster to damage (Picked unit), dealing (Damage x 0.33) damage of attack type Spells and damage type Normal
                                        • Else - Actions
                                          • Unit - Cause Caster to damage (Picked unit), dealing Damage damage of attack type Spells and damage type Normal
                                          • Set VariableSet Punto3 = (Position of (Picked unit))
                                          • Unit - Create 1 Dummy for Jugador at Punto3 facing Default building facing degrees
                                          • Unit - Add Grenade Dummy to (Last created unit)
                                          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                                          • Unit - Set level of Grenade Dummy for (Last created unit) to (Level of Shrapnel_Ability for Caster)
                                          • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                                          • Custom script: call RemoveLocation(udg_Punto3)
                                  • Custom script: call DestroyGroup(udg_Grupo)
                                  • Set VariableSet Real3 = 1.04
                                  • Custom script: call RemoveLocation(udg_Punto)
                                • Else - Actions
                              • Set VariableSet Real3 = (Real3 - 0.04)
                              • Hashtable - Save Real3 as (Key (S_Delay3 + (String(i))).) of (Key Identificador.) in TablaHash.
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Real Greater than or equal to 9.00
                                • Then - Actions
                                  • For each (Integer A) from 1 to 9, do (Actions)
                                    • Loop - Actions
                                      • Custom script: call RemoveSavedReal(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( ( "S_X" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                      • Custom script: call RemoveSavedReal(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( ( "S_Y" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                  • Custom script: call RemoveSavedReal(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( ( "S_X" + "0" ) + I2S(udg_i) )))
                                  • Custom script: call RemoveSavedReal(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( ( "S_Y" + "0" ) + I2S(udg_i) )))
                                  • Custom script: call RemoveSavedReal(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( "S_Damage" + I2S(udg_i) )))
                                  • Custom script: call RemoveSavedReal(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( "S_Delay1" + I2S(udg_i) )))
                                  • Custom script: call RemoveSavedReal(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( "S_Delay2" + I2S(udg_i) )))
                                  • Custom script: call RemoveSavedReal(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( "S_Delay3" + I2S(udg_i) )))
                                  • Custom script: call RemoveSavedReal(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( "S_Time" + I2S(udg_i) )))
                                  • Custom script: call RemoveSavedHandle(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( ( "S_Dummy" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                  • Custom script: call RemoveSavedHandle(udg_TablaHash, GetHandleId(udg_Identificador), StringHash(( ( "S_Efecto" + I2S(bj_forLoopAIndex) ) + I2S(udg_i) )))
                                  • Custom script: call SaveInteger( udg_TablaHash, GetHandleId(udg_Identificador), StringHash("Shrapnel 0"), udg_Entero - 1 )
                                • Else - Actions
                              • Hashtable - Save Real as (Key (S_Time + (String(i))).) of (Key Identificador.) in TablaHash.
                        • Else - Actions
                • Else - Actions
                  • Unit Group - Remove (Picked unit) from Shrapnel_Grupo.
        • Else - Actions
          • Trigger - Turn off (This trigger)
 
Back
Top