Lightning Flare v1.0b

This bundle is marked as approved. It works and satisfies the submission rules.
  • Like
Reactions: Wrda
Places a flare on the targeted location that shoots lightnings at random enemy every 1.5 seconds (6 is the shooting limit(9 seconds)) or until is destroyed.

This Spell Is MUI


TRIGGERS(UPDATED)


  • LF Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Setting the units --------
      • Set LF_CastingDummy = Casting Dummy
      • Set LF_FlareType[1] = Flare (Level 1)
      • Set LF_FlareType[2] = Flare (Level 2)
      • Set LF_FlareType[3] = Flare (Level 3)
      • Set LF_FlareType[4] = Flare (Level 4)
      • -------- Setting the units --------
      • -------- ---==========--- --------
      • -------- Setting Values --------
      • Set LF_MaxNumberofStrikes = 6
      • Set LF_StrikeTime = 1.50
      • Set LF_GroupAoE = 550.00
      • Set LF_NumberOfRandomUnits = 1
      • Set LF_GroupInteger = 0
      • -------- Setting Values --------
      • -------- ---==========--- --------
      • -------- Setting Abilities --------
      • Set LF_MainAbility = Lightning Flare
      • Set LF_DummyAbility = Chain Lightning (LF)
      • -------- Setting Abilities --------
      • -------- ---==========--- --------
      • -------- Adding Event --------
      • Trigger - Add to LF Loop <gen> the event (Time - Every 0.05 seconds of game time)



  • LF Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to LF_MainAbility
    • Actions
      • Set LF_Index = (LF_Index + 1)
      • Set LF_Caster[LF_Index] = (Triggering unit)
      • Set LF_OwnerOfCaster[LF_Index] = (Owner of LF_Caster[LF_Index])
      • Set LF_Level[LF_Index] = (Level of LF_MainAbility for LF_Caster[LF_Index])
      • Set tempPoint = (Target point of ability being cast)
      • Set LF_NumberOfStrikes[LF_Index] = 0
      • Set LF_Interval[LF_Index] = 0.00
      • Unit - Create 1 LF_FlareType[LF_Level[LF_Index]] for LF_OwnerOfCaster[LF_Index] at tempPoint facing Default building facing degrees
      • Set LF_Flare[LF_Index] = (Last created unit)
      • Animation - Play LF_Flare[LF_Index]'s birth animation
      • Animation - Queue LF_Flare[LF_Index]'s stand animation
      • Custom script: call RemoveLocation (udg_tempPoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LF_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on LF Loop <gen>
        • Else - Actions



  • LF Loop
    • Events
    • Conditions
    • Actions
      • For each (Integer tempInt) from 1 to LF_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (LF_Flare[tempInt] is alive) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LF_NumberOfStrikes[tempInt] Equal to LF_MaxNumberofStrikes
                • Then - Actions
                  • Unit - Kill LF_Flare[tempInt]
                  • Set LF_Caster[tempInt] = LF_Caster[LF_Index]
                  • Set LF_Flare[tempInt] = LF_Flare[LF_Index]
                  • Set LF_Interval[tempInt] = LF_Interval[LF_Index]
                  • Set LF_Level[tempInt] = LF_Level[LF_Index]
                  • Set LF_OwnerOfCaster[tempInt] = LF_OwnerOfCaster[LF_Index]
                  • Set LF_NumberOfStrikes[tempInt] = LF_NumberOfStrikes[LF_Index]
                  • Set LF_Caster[LF_Index] = No unit
                  • Set LF_Flare[LF_Index] = No unit
                  • Set LF_Index = (LF_Index - 1)
                  • Set tempInt = (tempInt - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LF_Index Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LF_Interval[tempInt] Equal to LF_StrikeTime
                    • Then - Actions
                      • Set tempPoint = (Position of LF_Flare[tempInt])
                      • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of LF_OwnerOfCaster[tempInt]) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) i
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempGroup) Greater than LF_GroupInteger
                        • Then - Actions
                          • Set tempGroup2 = (Random LF_NumberOfRandomUnits units from tempGroup)
                          • Unit Group - Pick every unit in tempGroup2 and do (Actions)
                            • Loop - Actions
                              • Set tempUnit = (Picked unit)
                              • Unit - Create 1 LF_CastingDummy for LF_OwnerOfCaster[tempInt] at tempPoint facing Default building facing degrees
                              • Set tempUnit2 = (Last created unit)
                              • Unit - Add a 1.00 second Generic expiration timer to tempUnit2
                              • Unit - Add LF_DummyAbility to tempUnit2
                              • Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]
                              • Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit
                              • Set tempUnit = No unit
                              • Set tempUnit2 = No unit
                              • Custom script: call DestroyGroup(udg_tempGroup2)
                        • Else - Actions
                      • Custom script: call DestroyGroup(udg_tempGroup)
                      • Custom script: call RemoveLocation (udg_tempPoint)
                      • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
                      • Set LF_Interval[tempInt] = 0.00
                    • Else - Actions
                      • Set LF_Interval[tempInt] = (LF_Interval[tempInt] + 0.05)
            • Else - Actions
              • Unit - Kill LF_Flare[tempInt]
              • Set LF_Caster[tempInt] = LF_Caster[LF_Index]
              • Set LF_Flare[tempInt] = LF_Flare[LF_Index]
              • Set LF_Interval[tempInt] = LF_Interval[LF_Index]
              • Set LF_Level[tempInt] = LF_Level[LF_Index]
              • Set LF_OwnerOfCaster[tempInt] = LF_OwnerOfCaster[LF_Index]
              • Set LF_NumberOfStrikes[tempInt] = LF_NumberOfStrikes[LF_Index]
              • Set LF_Caster[LF_Index] = No unit
              • Set LF_Flare[LF_Index] = No unit
              • Set LF_Index = (LF_Index - 1)
              • Set tempInt = (tempInt - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LF_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions


Keywords:
Flare, Lightning.
Contents

Just another Warcraft III map (Map)

Reviews
16:27, 20th Sep 2014 TriggerHappy: I don't understand why you're using a different dummy unit for each level. For the dummy caster it would probably be best to create one at initialization and reuse it as Dalvengyr said. Doing this at map...

Moderator

M

Moderator

16:27, 20th Sep 2014
TriggerHappy:

I don't understand why you're using a different dummy unit for each level.

For the dummy caster it would probably be best to create one at initialization and reuse it as Dalvengyr said. Doing this at map initialization will also allow people to specify their own dummy caster if they already have one. Paused units apparently use up less resources so you'll want to do that, then un-pause the dummy caster when you need to.

LF_ is also a kind of generic prefix and might collide with some maps. For example LF_Index.
 
Level 29
Joined
Oct 24, 2012
Messages
6,545
Never use casting unit. Use triggering unit instead.
Anything you have in the same then and else blocks should be placed before or after depending on the code.
Example:
  • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
  • Set LF_Interval[tempInt] = 0.00
Same with your de-indexing. You have that in the then and else blocks.

Instead of such a huge unitgroup creation use an ITE and filter out these units when running the code.
  • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of LF_Flare[tempInt])) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit
Also using random unit from unit group action leaks a unit group so that needs to be cleaned up.
I believe number of units in unit group also leaks a unit group.
You should instead create a custom integer to count the units in the unit group as it is more efficient.
 
Level 8
Joined
Nov 9, 2011
Messages
322
Never use casting unit. Use triggering unit instead.
Anything you have in the same then and else blocks should be placed before or after depending on the code.
Example:
  • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
  • Set LF_Interval[tempInt] = 0.00
Same with your de-indexing. You have that in the then and else blocks.

Instead of such a huge unitgroup creation use an ITE and filter out these units when running the code.
  • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of LF_Flare[tempInt])) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit
Also using random unit from unit group action leaks a unit group so that needs to be cleaned up.
I believe number of units in unit group also leaks a unit group.
You should instead create a custom integer to count the units in the unit group as it is more efficient.

Im new to mui rly new could u like write that trigger for me with what u said when u have free time. Anywho thanks for the reply
 
Level 8
Joined
Nov 9, 2011
Messages
322
These 2 actions create 2 more unit groups.

  • (Number of units in tempGroup) Greater than 0
  • and this.
    • Unit Group - Pick every unit in (Random 1 units from tempGroup) and do (Actions)

So how should i do it correctly should i like create another variable and to set that group to (random SOMEINTERGER units from tempGroup) and when i need to pick it to be
  • Unit Group - Pick every unit in (Newly CREATED GROUP) and do (Actions)
 
Level 8
Joined
Nov 9, 2011
Messages
322
Yes then after that you destroy the group.
Can it be done like this watch where i destroy groups also did i do that the right way?

  • test
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Greater than LF_GroupInteger
        • Then - Actions
          • Set tempGroup2 = (Random LF_NumberOfRandomUnits units from tempGroup)
          • Custom script: call DestroyGroup(udg_tempGroup)
          • Unit Group - Pick every unit in tempGroup2 and do (Actions)
            • Loop - Actions
              • Set tempUnit = (Picked unit)
              • Unit - Create 1 LF_CastingDummy for (Owner of LF_Flare[tempInt]) at tempPoint facing Default building facing degrees
              • Set tempUnit2 = (Last created unit)
              • Unit - Add a 1.00 second Generic expiration timer to tempUnit2
              • Unit - Add LF_DummyAbility to tempUnit2
              • Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]
              • Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit
              • Set tempUnit = No unit
              • Set tempUnit2 = No unit
              • Custom script: call DestroyGroup(udg_tempGroup2)
          • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
          • Set LF_Interval[tempInt] = 0.00
        • Else - Actions
          • Custom script: call DestroyGroup(udg_tempGroup)
          • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
          • Set LF_Interval[tempInt] = 0.00
 
Level 8
Joined
Nov 9, 2011
Messages
322
No it can't. In the above you first create the group and add units to it. Then you destroy the group. Then you use the group. So there are no units in the group and there is no group so it will bug the trigger since you are trying to get units out of nothing.

but the spell works i tested it u know i set units above i didnt copy it and if there is more than 0 units in it it will first set ''tempGroup2'' and after that will destroy ''tempGroup'' so now the main is tempgroup2 and it picks unit from that
 
Level 8
Joined
Nov 9, 2011
Messages
322
here is the whole loop trigger

  • LF Loop
    • Events
    • Conditions
    • Actions
      • For each (Integer tempInt) from 1 to LF_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (LF_Flare[tempInt] is alive) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LF_NumberOfStrikes[tempInt] Equal to LF_MaxNumberofStrikes
                • Then - Actions
                  • Unit - Kill LF_Flare[tempInt]
                  • Set LF_Caster[tempInt] = LF_Caster[LF_Index]
                  • Set LF_Flare[tempInt] = LF_Flare[LF_Index]
                  • Set LF_Interval[tempInt] = LF_Interval[LF_Index]
                  • Set LF_Level[tempInt] = LF_Level[LF_Index]
                  • Set LF_NumberOfStrikes[tempInt] = LF_NumberOfStrikes[LF_Index]
                  • Set LF_Caster[LF_Index] = No unit
                  • Set LF_Flare[LF_Index] = No unit
                  • Set LF_Index = (LF_Index - 1)
                  • Set tempInt = (tempInt - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LF_Index Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • LF_Interval[tempInt] Equal to LF_StrikeTime
                    • Then - Actions
                      • Set tempPoint = (Position of LF_Flare[tempInt])
                      • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of LF_Flare[tempInt])) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempGroup) Greater than LF_GroupInteger
                        • Then - Actions
                          • Set tempGroup2 = (Random LF_NumberOfRandomUnits units from tempGroup)
                          • Custom script: call DestroyGroup(udg_tempGroup)
                          • Unit Group - Pick every unit in tempGroup2 and do (Actions)
                            • Loop - Actions
                              • Set tempUnit = (Picked unit)
                              • Unit - Create 1 LF_CastingDummy for (Owner of LF_Flare[tempInt]) at tempPoint facing Default building facing degrees
                              • Set tempUnit2 = (Last created unit)
                              • Unit - Add a 1.00 second Generic expiration timer to tempUnit2
                              • Unit - Add LF_DummyAbility to tempUnit2
                              • Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]
                              • Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit
                              • Set tempUnit = No unit
                              • Set tempUnit2 = No unit
                              • Custom script: call DestroyGroup(udg_tempGroup2)
                          • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
                          • Set LF_Interval[tempInt] = 0.00
                        • Else - Actions
                          • Custom script: call DestroyGroup(udg_tempGroup)
                          • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
                          • Set LF_Interval[tempInt] = 0.00
                      • Custom script: call RemoveLocation (udg_tempPoint)
                    • Else - Actions
                      • Set LF_Interval[tempInt] = (LF_Interval[tempInt] + 0.05)
            • Else - Actions
              • Unit - Kill LF_Flare[tempInt]
              • Set LF_Caster[tempInt] = LF_Caster[LF_Index]
              • Set LF_Flare[tempInt] = LF_Flare[LF_Index]
              • Set LF_Interval[tempInt] = LF_Interval[LF_Index]
              • Set LF_Level[tempInt] = LF_Level[LF_Index]
              • Set LF_NumberOfStrikes[tempInt] = LF_NumberOfStrikes[LF_Index]
              • Set LF_Caster[LF_Index] = No unit
              • Set LF_Flare[LF_Index] = No unit
              • Set LF_Index = (LF_Index - 1)
              • Set tempInt = (tempInt - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LF_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 29
Joined
Oct 24, 2012
Messages
6,545
This still leaks a unit group.
  • (Number of units in tempGroup) Greater than LF_GroupInteger
Move these out of the ITE. You have them both in the Then and in the Else blocks.
  • Custom script: call DestroyGroup(udg_tempGroup)
  • Custom script: call RemoveLocation (udg_tempPoint)
  • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
  • Set LF_Interval[tempInt] = 0.00
Other than that it looks good.
 
Level 8
Joined
Nov 9, 2011
Messages
322
This still leaks a unit group.
  • (Number of units in tempGroup) Greater than LF_GroupInteger
Move these out of the ITE. You have them both in the Then and in the Else blocks.
  • Custom script: call DestroyGroup(udg_tempGroup)
  • Custom script: call RemoveLocation (udg_tempPoint)
  • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
  • Set LF_Interval[tempInt] = 0.00
Other than that it looks good.

first how it leaks a unit group

second. that jas to be there bcz if there is more than 0 units it will shoot lightning and still do the count if not if there is 0 units it will just do the count remove point and group
 
Level 29
Joined
Oct 24, 2012
Messages
6,545

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • LF_Interval[tempInt] Equal to LF_StrikeTime
    • Then - Actions
      • Set tempPoint = (Position of LF_Flare[tempInt])
      • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of LF_Flare[tempInt])) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Greater than LF_GroupInteger
        • Then - Actions
          • Set tempGroup2 = (Random LF_NumberOfRandomUnits units from tempGroup)
          • Custom script: call DestroyGroup(udg_tempGroup)
          • Unit Group - Pick every unit in tempGroup2 and do (Actions)
            • Loop - Actions
              • Set tempUnit = (Picked unit)
              • Unit - Create 1 LF_CastingDummy for (Owner of LF_Flare[tempInt]) at tempPoint facing Default building facing degrees
              • Set tempUnit2 = (Last created unit)
              • Unit - Add a 1.00 second Generic expiration timer to tempUnit2
              • Unit - Add LF_DummyAbility to tempUnit2
              • Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]
              • Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit
              • Set tempUnit = No unit
              • Set tempUnit2 = No unit
              • Custom script: call DestroyGroup(udg_tempGroup2)
          • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
          • Set LF_Interval[tempInt] = 0.00
        • Else - Actions
          • Custom script: call DestroyGroup(udg_tempGroup)
          • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
          • Set LF_Interval[tempInt] = 0.00
      • Custom script: call RemoveLocation (udg_tempPoint)
    • Else - Actions
      • Set LF_Interval[tempInt] = (LF_Interval[tempInt] + 0.05)


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • LF_Interval[tempInt] Equal to LF_StrikeTime
    • Then - Actions
      • Set tempPoint = (Position of LF_Flare[tempInt])
      • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of LF_Flare[tempInt])) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Greater than LF_GroupInteger
        • Then - Actions
          • Set tempGroup2 = (Random LF_NumberOfRandomUnits units from tempGroup)
          • Unit Group - Pick every unit in tempGroup2 and do (Actions)
            • Loop - Actions
              • Set tempUnit = (Picked unit)
              • Unit - Create 1 LF_CastingDummy for (Owner of LF_Flare[tempInt]) at tempPoint facing Default building facing degrees
              • Set tempUnit2 = (Last created unit)
              • Unit - Add a 1.00 second Generic expiration timer to tempUnit2
              • Unit - Add LF_DummyAbility to tempUnit2
              • Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]
              • Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit
              • Set tempUnit = No unit
              • Set tempUnit2 = No unit
              • Custom script: call DestroyGroup(udg_tempGroup2)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)
      • Custom script: call RemoveLocation (udg_tempPoint)
      • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
      • Set LF_Interval[tempInt] = 0.00
    • Else - Actions
      • Set LF_Interval[tempInt] = (LF_Interval[tempInt] + 0.05)


The above may also be able to be done with your de-indexing portion of code.
 
Level 8
Joined
Nov 9, 2011
Messages
322

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • LF_Interval[tempInt] Equal to LF_StrikeTime
    • Then - Actions
      • Set tempPoint = (Position of LF_Flare[tempInt])
      • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of LF_Flare[tempInt])) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Greater than LF_GroupInteger
        • Then - Actions
          • Set tempGroup2 = (Random LF_NumberOfRandomUnits units from tempGroup)
          • Custom script: call DestroyGroup(udg_tempGroup)
          • Unit Group - Pick every unit in tempGroup2 and do (Actions)
            • Loop - Actions
              • Set tempUnit = (Picked unit)
              • Unit - Create 1 LF_CastingDummy for (Owner of LF_Flare[tempInt]) at tempPoint facing Default building facing degrees
              • Set tempUnit2 = (Last created unit)
              • Unit - Add a 1.00 second Generic expiration timer to tempUnit2
              • Unit - Add LF_DummyAbility to tempUnit2
              • Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]
              • Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit
              • Set tempUnit = No unit
              • Set tempUnit2 = No unit
              • Custom script: call DestroyGroup(udg_tempGroup2)
          • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
          • Set LF_Interval[tempInt] = 0.00
        • Else - Actions
          • Custom script: call DestroyGroup(udg_tempGroup)
          • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
          • Set LF_Interval[tempInt] = 0.00
      • Custom script: call RemoveLocation (udg_tempPoint)
    • Else - Actions
      • Set LF_Interval[tempInt] = (LF_Interval[tempInt] + 0.05)


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • LF_Interval[tempInt] Equal to LF_StrikeTime
    • Then - Actions
      • Set tempPoint = (Position of LF_Flare[tempInt])
      • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of LF_Flare[tempInt])) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Greater than LF_GroupInteger
        • Then - Actions
          • Set tempGroup2 = (Random LF_NumberOfRandomUnits units from tempGroup)
          • Unit Group - Pick every unit in tempGroup2 and do (Actions)
            • Loop - Actions
              • Set tempUnit = (Picked unit)
              • Unit - Create 1 LF_CastingDummy for (Owner of LF_Flare[tempInt]) at tempPoint facing Default building facing degrees
              • Set tempUnit2 = (Last created unit)
              • Unit - Add a 1.00 second Generic expiration timer to tempUnit2
              • Unit - Add LF_DummyAbility to tempUnit2
              • Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]
              • Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit
              • Set tempUnit = No unit
              • Set tempUnit2 = No unit
              • Custom script: call DestroyGroup(udg_tempGroup2)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)
      • Custom script: call RemoveLocation (udg_tempPoint)
      • Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)
      • Set LF_Interval[tempInt] = 0.00
    • Else - Actions
      • Set LF_Interval[tempInt] = (LF_Interval[tempInt] + 0.05)


The above may also be able to be done with your de-indexing portion of code.
Ah i see what u've done i didnt rly get what u were saying yes i could do that i putted that 2 in if there is more units than 0 and as u did when the Interval is equal to strike time i will do that and reupload as soon as i get home
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,443
  • .
    • Unit - Create 1 LF_CastingDummy for LF_OwnerOfCaster[tempInt] at tempPoint facing Default building facing degrees
    • Set tempUnit2 = (Last created unit)
    • Unit - Add a 1.00 second Generic expiration timer to tempUnit2
    • Unit - Add LF_DummyAbility to tempUnit2
    • Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]
    • Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit
    Only use one casting unit for the whole game: means only create it once at map init (hide it somewhere, must be invisible to all players) and never remove/kill it.
    • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of LF_OwnerOfCaster[tempInt]) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) i...
    You can use If Then Else checking:
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
          • = Move those conditions here =
          • Then - Actions
          • Else - Actions
    But remember, you will use (Picked unit) if so.
 
Level 8
Joined
Nov 9, 2011
Messages
322
It is pretty much the same in that way, however it will save a few nanoseconds if Picked Unit is cached. Do not forget set bj_wantDestroyGroup = true.

i destroy group at the end of the loop (both of them)

  • .
    • Unit - Create 1 LF_CastingDummy for LF_OwnerOfCaster[tempInt] at tempPoint facing Default building facing degrees
    • Set tempUnit2 = (Last created unit)
    • Unit - Add a 1.00 second Generic expiration timer to tempUnit2
    • Unit - Add LF_DummyAbility to tempUnit2
    • Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]
    • Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit
    Only use one casting unit for the whole game: means only create it once at map init (hide it somewhere, must be invisible to all players) and never remove/kill it.
    • Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of LF_OwnerOfCaster[tempInt]) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) i...
    You can use If Then Else checking:
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
          • = Move those conditions here =
          • Then - Actions
          • Else - Actions
    But remember, you will use (Picked unit) if so.

in casting dummy ive set the casting point to 0 and backswing. now im asking if i create 1 dummy only and like at the same time the spell is cast will dummy be able to cast both at the same time?

and i have to create every time cuz its the location that matters for the lightning
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,443
and i have to create every time cuz its the location that matters for the lightning
kinda forgot about that. I might be wrong, but
now im asking if i create 1 dummy only and like at the same time the spell is cast will dummy be able to cast both at the same time?
I think it's possible. If not, you can code your own chain lightning :p

EDIT:
this is a bitter reality, but if you dont fix it. this spell will never gets approved :( (by today's standart)
 
Top