• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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
 
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