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

[Trigger] Custom Chain Lightning

Status
Not open for further replies.
Level 12
Joined
Mar 24, 2011
Messages
1,082
Greetings
I have been working on a custom chain lightning spell so I can use a heroes stats for the damage. The thing is that what I have done so far crashes the game after a few uses (~after 3 uses) which is highly undesireable as you can suggest.
I am not much into jass and I have no idea if the custom script is ok (I suppose it is as I have only edited a script from another post around) or I am doing something whrong on fundamental level in war3.

So can someone point out my mistake ? Or suggest a better way of creating the desired effect ?

Thats what I have done so far:
  • Chain Lightning
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain Lightning New Far Seer
    • Actions
      • Set CL_Caster = (Triggering unit)
      • Set CL_Owner = (Owner of CL_Caster)
      • Set CL_Target = (Target unit of ability being cast)
      • Set CL_Level = (Level of Chain Lightning New Far Seer for CL_Caster)
      • Set CL_Damage = (Real((CL_Level x (50 + (Intelligence of CL_Caster (Include bonuses))))))
      • Set CL_Count = (3 + CL_Level)
      • Set CL_Point = (Position of CL_Target)
      • Unit - Cause CL_Caster to damage CL_Target, dealing CL_Damage damage of attack type Spells and damage type Normal
      • Unit - Create 1 Chain Lightning for CL_Owner at CL_Point facing Default building facing degrees
      • Set Temp_Unit = (Last created unit)
      • Unit - Add a 1.00 second Generic expiration timer to Temp_Unit
      • Unit - Add Chain lightning dummy buff to Temp_Unit
      • Unit - Set level of Chain lightning dummy buff for Temp_Unit to CL_Level
      • Unit - Order Temp_Unit to Undead Banshee - Curse CL_Target
      • Trigger - Turn on CLLoop <gen>
  • CLLoop
    • Events
      • Time - Every 0.40 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CL_Count Greater than 0
        • Then - Actions
          • Set TempGroup = (Units within 350.00 of CL_Point matching ((((Matching unit) has buff Lightning Strike ) Equal to False) and ((((Matching unit) belongs to an enemy of CL_Owner) Equal to True) and (((Matching unit) is alive) Equal to True))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempGroup) Greater than 0
            • Then - Actions
              • Set CL_Count = (CL_Count - 1)
              • Set CL_Target = (Random unit from TempGroup)
              • Set TempPoint = (Position of CL_Target)
              • Set CL_Damage = (0.85 x CL_Damage)
              • Unit - Cause CL_Caster to damage CL_Target, dealing CL_Damage damage of attack type Spells and damage type Normal
              • Lightning - Destroy CL_Light
              • Custom script: set udg_CL_Light = AddLightningEx("CLPB", true , GetLocationX(udg_CL_Point), GetLocationY(udg_CL_Point), GetLocationZ(udg_CL_Point) + 70, GetLocationX(udg_TempPoint), GetLocationY(udg_TempPoint), GetLocationZ(udg_TempPoint) + 70)
              • Custom script: call RemoveLocation(udg_CL_Point)
              • Set CL_Point = (Position of CL_Target)
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Unit - Create 1 Chain Lightning for CL_Owner at CL_Point facing Default building facing degrees
              • Set Temp_Unit = (Last created unit)
              • Unit - Add a 1.00 second Generic expiration timer to Temp_Unit
              • Unit - Add Chain lightning dummy buff to Temp_Unit
              • Unit - Set level of Chain lightning dummy buff for Temp_Unit to CL_Level
              • Unit - Order Temp_Unit to Undead Banshee - Curse CL_Target
            • Else - Actions
              • Lightning - Destroy CL_Light
              • Custom script: call DestroyGroup(udg_TempGroup)
              • Custom script: call RemoveLocation(udg_CL_Point)
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Trigger - Turn off (This trigger)
        • Else - Actions
          • Lightning - Destroy CL_Light
          • Custom script: call DestroyGroup(udg_TempGroup)
          • Custom script: call RemoveLocation(udg_CL_Point)
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Trigger - Turn off (This trigger)
Regards, Nedio95
 
Status
Not open for further replies.
Top