• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[Trigger] Spell Problems

Status
Not open for further replies.
Level 13
Joined
Oct 25, 2009
Messages
995
Does this triggers have leaks?Also,how can i create the MUI lightning effect?
i can't destroy after the multi unit casted.
  • LC Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Circle
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LC_Index1 Equal to 0
        • Then - Actions
          • Trigger - Turn on LC Loop <gen>
        • Else - Actions
      • Set LC_Index1 = (LC_Index1 + 1)
      • Set LC_Index2 = (LC_Index2 + 1)
      • Set LC_Caster[LC_Index2] = (Triggering unit)
      • Set LC_TargetPoint[LC_Index2] = (Target point of ability being cast)
      • Set LC_StartTimer[LC_Index2] = 200.00
      • Set LC_ExpiredTimer[LC_Index2] = 0.00
      • Set LC_Boolean[LC_Index2] = True
      • Set LC_Damage[LC_Index2] = (1.00 x (Real((Level of Lightning Circle for LC_Caster[LC_Index2]))))
      • Unit - Create 1 Lightning_Dummy for (Owner of LC_Caster[LC_Index2]) at LC_TargetPoint[LC_Index2] facing Default building facing degrees
      • Set LC_Dummy[LC_Index2] = (Last created unit)
      • Unit - Add a 10.00 second Generic expiration timer to LC_Dummy[LC_Index2]
      • Set LC_Group[LC_Index2] = (Units within 500.00 of (Position of LC_Dummy[LC_Index2]) matching (((Matching unit) belongs to an enemy of (Owner of LC_Dummy[LC_Index2])) Equal to True))
      • Set LC_Point[LC_Index2] = (Position of LC_Dummy[LC_Index2])
      • For each (Integer A) from 1 to 18, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Lightning_Dummy for (Owner of LC_Caster[LC_Index2]) at (LC_TargetPoint[LC_Index2] offset by 500.00 towards ((Real((Integer A))) x (360.00 / 18.00)) degrees) facing LC_TargetPoint[LC_Index2]
          • Set LC_Dummy2[LC_Index2] = (Last created unit)
          • Unit - Add a 10.00 second Generic expiration timer to LC_Dummy2[LC_Index2]
          • Set LC_DummyPoint[LC_Index2] = (Position of LC_Dummy[LC_Index2])
          • Set LC_UnitPoint[LC_Index2] = (Position of LC_Dummy2[LC_Index2])
          • Lightning - Create a Chain Lightning - Primary lightning effect from source LC_DummyPoint[LC_Index2] to target LC_UnitPoint[LC_Index2]
          • Set LC_LightningEffect[(Integer A)] = (Last created lightning effect)
          • Custom script: call RemoveLocation(udg_LC_UnitPoint[udg_LC_Index2])
          • Custom script: call RemoveLocation(udg_LC_DummyPoint[udg_LC_Index2])
      • Custom script: call RemoveLocation(udg_LC_TargetPoint[udg_LC_Index2])
      • Custom script: call RemoveLocation(udg_LC_Point[udg_LC_Index2])
      • Custom script: call DestroyGroup(udg_LC_Group[udg_LC_Index2])
  • LC Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer LC_IndexLoop) from 1 to LC_Index2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LC_StartTimer[LC_IndexLoop] Greater than or equal to LC_ExpiredTimer[LC_IndexLoop]
            • Then - Actions
              • Set LC_ExpiredTimer[LC_IndexLoop] = (LC_ExpiredTimer[LC_IndexLoop] + 1.00)
              • Set LC_Group[LC_IndexLoop] = (Units within 500.00 of (Position of LC_Dummy[LC_IndexLoop]) matching (((Matching unit) belongs to an enemy of (Owner of LC_Dummy[LC_IndexLoop])) Equal to True))
              • Set LC_Point[LC_IndexLoop] = (Position of LC_Dummy[LC_IndexLoop])
              • Destructible - Pick every destructible within 500.00 of (Position of LC_Dummy[LC_IndexLoop]) and do (Actions)
                • Loop - Actions
                  • Destructible - Kill (Picked destructible)
              • Custom script: set bj_wantDestroyGroup=true
              • Unit Group - Pick every unit in LC_Group[LC_IndexLoop] 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 False
                      • ((Picked unit) is alive) Equal to True
                    • Then - Actions
                      • Set LC_DummyPoint[LC_IndexLoop] = (Position of LC_Dummy[LC_IndexLoop])
                      • Set LC_UnitPoint[LC_IndexLoop] = (Position of (Picked unit))
                      • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 0.25 towards (Facing of (Picked unit)) degrees), facing LC_Point[LC_IndexLoop]
                      • Unit - Cause LC_Dummy[LC_IndexLoop] to damage (Picked unit), dealing LC_Damage[LC_IndexLoop] damage of attack type Spells and damage type Normal
                      • Special Effect - Create a special effect at (Position of (Picked unit)) using war3mapImported\Lightnings Long.mdx
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_LC_DummyPoint[udg_LC_IndexLoop])
                      • Custom script: call RemoveLocation(udg_LC_UnitPoint[udg_LC_IndexLoop])
                    • Else - Actions
              • Custom script: call DestroyGroup(udg_LC_Group[udg_LC_IndexLoop])
              • Custom script: call RemoveLocation(udg_LC_Point[udg_LC_IndexLoop])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LC_Boolean[LC_IndexLoop] Equal to True
                • Then - Actions
                  • For each (Integer A) from 1 to 18, do (Actions)
                    • Loop - Actions
                      • Lightning - Destroy LC_LightningEffect[(Integer A)]
                  • Lightning - Destroy LC_LightningEffect[LC_IndexLoop]
                  • Set LC_Index1 = (LC_Index1 - 1)
                  • Set LC_Boolean[LC_IndexLoop] = False
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LC_Index1 Equal to 0
        • Then - Actions
          • Set LC_Index2 = 0
          • Trigger - Turn off (This trigger)
        • Else - Actions
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
You use loop from 1 to 18 and still refer just to one index (LC_Index2) which crushes your MUI spell.

In this case I'd recommend hashtables, creating dummies and saving lightning handles via dummy's id or using String keys with numbers from 1-18, and later refering to them with help of integer variable.
 
Indexing systems can still support dimensional saving.
  • For each (Integer A) from 1 to 18, do (Actions)
    • Loop - Actions
      • Set LC_OffPoint = (LC_TargetPoint offset by 500.00 towards ((Real((IntegerA))) x (360.00 / 18.00)) degrees)
      • Unit - Create 1 Lightning_Dummy for (Owner of LC_Caster[LC_Index2]) at LC_OffPoint facing LC_TargetPoint[LC_Index2]
      • Set LC_Dummy2[((LC_Index2 x 18) - (IntegerA))] = (Last created unit)
      • Custom script: call RemoveLocation (udg_LC_OffPoint)
same goes for the lightning.
In the loop trigger, retrieve it as:
  • For each (Integer B) from 1 to 18, do (Actions)
    • Loop - Actions
      • Lightning - Destroy LC_LightningEffect[((LC_IndexLoop] x 18) - (IntegerB))]
Watch out for your leaks.


When you use indexed unit groups, make sure you use this before the
  • Set LC_Group[LC_IndexLoop] = (Units within 500.00 of (Position of LC_Dummy[LC_IndexLoop]) matching
->
  • Custom script: if udg_LC_Group[udg_LC_IndexLoop] == null then
  • Custom script: set udg_LC_Group[udg_LC_IndexLoop] = CreateGroup()
  • Custom script: endif
  • Set LC_Group[LC_IndexLoop] = (Units within 500.00 of (Position of LC_Dummy[LC_IndexLoop]) matching
 
Last edited:
Level 13
Joined
Oct 25, 2009
Messages
995
It error
  • Then - Actions
    • Set LC_ExpiredTimer[LC_IndexLoop] = (LC_ExpiredTimer[LC_IndexLoop] + 1.00)
    • Custom script: if LC_Group[udg_LC_IndexLoop] == null then
    • Custom script: set udg_LC_Group[udg_LC_IndexLoop] = CreateGroup()
    • Custom script: endif
    • Set LC_Group[LC_IndexLoop] = (Units within 500.00 of (Position of LC_Dummy[LC_IndexLoop]) matching (((Matching unit) belongs to an enemy of (Owner of LC_Dummy[LC_IndexLoop])) Equal to True))
    • Set LC_Point[LC_IndexLoop] = (Position of LC_Dummy[LC_IndexLoop])
    • Destructible - Pick every destructible within 500.00 of (Position of LC_Dummy[LC_IndexLoop]) and do (Actions)
      • Loop - Actions
        • Destructible - Kill (Picked destructible)
    • Custom script: set bj_wantDestroyGroup=true
    • Unit Group - Pick every unit in LC_Group[LC_IndexLoop] 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 False
            • ((Picked unit) is alive) Equal to True
          • Then - Actions
            • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 0.25 towards (Facing of (Picked unit)) degrees), facing LC_Point[LC_IndexLoop]
            • Unit - Cause LC_Dummy[LC_IndexLoop] to damage (Picked unit), dealing LC_Damage[LC_IndexLoop] damage of attack type Spells and damage type Normal
            • Special Effect - Create a special effect at (Position of (Picked unit)) using war3mapImported\Lightnings Long.mdx
            • Special Effect - Destroy (Last created special effect)
          • Else - Actions
    • Custom script: call DestroyGroup(udg_LC_Group[udg_LC_IndexLoop])
    • Custom script: call RemoveLocation(udg_LC_Point[udg_LC_IndexLoop])

and,why suddenly my war3 will fatal error when i casted the spell?
  • For each (Integer A) from 1 to 18, do (Actions)
    • Loop - Actions
      • Set LC_OffPoint = (LB_TargetPoint[LB_Index2] offset by 500.00 towards ((Real((Integer A))) x (360.00 / 18.00)) degrees)
      • Unit - Create 1 Lightning_Dummy for (Owner of LC_Caster[LC_Index2]) at LC_OffPoint facing LC_TargetPoint[LC_Index2]
      • Set LC_Dummy2[((LB_Index2 x 18) - (Integer A))] = (Last created unit)
      • Set LC_DummyPoint[LB_Index2] = (Position of LC_Dummy[LB_Index2])
      • Set LC_DummyPoint2[LB_Index2] = (Position of LC_Dummy2[LB_Index2])
      • Lightning - Create a Chain Lightning - Primary lightning effect from source LC_DummyPoint[LB_Index2] to target LC_DummyPoint2[LB_Index2]
      • Set LC_LightningEffect[LB_Index2] = (Last created lightning effect)
      • Unit - Add a 10.00 second Generic expiration timer to LC_Dummy2[LC_Index2]
      • Custom script: call RemoveLocation(udg_LC_OffPoint[udg_LC_Index2])
      • Custom script: call RemoveLocation(udg_LC_DummyPoint[udg_LC_Index2])
      • Custom script: call RemoveLocation(udg_LC_DummyPoint2[udg_LC_Index2])
 
Status
Not open for further replies.
Top