Hi, I'm trying to make a spell where the user launches a massive blade that moves in a target direction. The blade then launches other mini-blades either side of it at a right angle (+/- 90 degrees). However what seems to happen is the main blade moves perfectly fine but the mini-blades just randomly stop and I don't know what's causing it to happen.
Below are the 2 triggers that I have at the minute, the caster does not need to be in an array as there is only 1 person who can cast the ability.
EDIT: I realised I hadn't actually killed any of the mini-blades die apon reaching their full distance but now that's sorted. However now I seem to get loads of lag after casting the ability. Any ideas?
EDIT 2: Managed to make it stop the looping trigger after all dummies are gone. Still got some lag after casting though, seems to be every 0.5 seconds or something that it lags.
Here's the updated one! (Messages are there for testing purposes)
Below are the 2 triggers that I have at the minute, the caster does not need to be in an array as there is only 1 person who can cast the ability.
-
Conference Call Cast
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to The Conference Call
-
Actions
- Set CC_CasterUnit = (Casting unit)
- Set CC_Point = (Position of CC_CasterUnit)
- Set CC_MainDistance = 1200.00
- Unit - Create 1 Dummy (Conference Main) for (Owner of CC_CasterUnit) at CC_Point facing Default building facing degrees
- Set CC_MainDummy = (Last created unit)
- Custom script: call RemoveLocation(udg_CC_Point)
- Set CC_Point = (Target point of ability being cast)
- Unit - Make CC_MainDummy face CC_Point over 0.00 seconds
- Trigger - Turn on CC Loop <gen>
- Custom script: call RemoveLocation(udg_CC_Point)
-
Events
-
CC Loop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
- Set CC_Point = (Position of CC_MainDummy)
- Set TempPoint = (CC_Point offset by 15.00 towards (Facing of CC_MainDummy) degrees)
- Unit - Move CC_MainDummy instantly to TempPoint
- Set CC_MainDistance = (CC_MainDistance - 15.00)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CC_MainDistance Less than 15.00
-
Then - Actions
- Unit - Kill CC_MainDummy
- Set CC_MainDummy = No unit
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Random integer number between 1 and 15) Equal to 1
-
Then - Actions
- Set CC_LoopMax = (CC_LoopMax + 1)
- Unit - Create 1 Dummy (Conference Sub) for (Owner of CC_CasterUnit) at TempPoint facing ((Facing of CC_CasterUnit) + 90.00) degrees
- Set CC_SubDummy[CC_LoopMax] = (Last created unit)
- Set CC_SubDistance[CC_LoopMax] = 800.00
- Set CC_LoopMax = (CC_LoopMax + 1)
- Unit - Create 1 Dummy (Conference Sub) for (Owner of CC_CasterUnit) at TempPoint facing ((Facing of CC_CasterUnit) - 90.00) degrees
- Set CC_SubDummy[CC_LoopMax] = (Last created unit)
- Set CC_SubDistance[CC_LoopMax] = 800.00
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call RemoveLocation(udg_CC_Point)
- Custom script: call RemoveLocation(udg_TempPoint)
-
For each (Integer CC_LoopInt) from 1 to CC_LoopMax, do (Actions)
-
Loop - Actions
- Set CC_Point = (Position of CC_SubDummy[CC_LoopInt])
- Set TempPoint = (CC_Point offset by 30.00 towards (Facing of CC_SubDummy[CC_LoopInt]) degrees)
- Unit - Move CC_SubDummy[CC_LoopInt] instantly to TempPoint
- Set CC_SubDistance[CC_LoopInt] = (CC_SubDistance[CC_LoopInt] - 30.00)
- Set CC_Group = (Units within 50.00 of TempPoint matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an enemy of (Owner of CC_CasterUnit)) Equal to True)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in CC_Group) Greater than or equal to 1
-
Then - Actions
- Set CC_TargetUnit = (Random unit from CC_Group)
- Set CC_Dmg = (((Real((Intelligence of CC_CasterUnit (Exclude bonuses)))) x 0.10) x ((800.00 - CC_SubDistance[CC_LoopInt]) / 800.00))
- Unit - Cause CC_CasterUnit to damage CC_TargetUnit, dealing CC_Dmg damage of attack type Spells and damage type Universal
- Set CC_TargetUnit = No unit
- Set CC_SubDistance[CC_LoopMax] = CC_SubDistance[CC_LoopInt]
- Set CC_SubDummy[CC_LoopMax] = CC_SubDummy[CC_LoopInt]
- Set CC_LoopMax = (CC_LoopMax - 1)
- Set CC_LoopInt = (CC_LoopInt - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CC_LoopMax Equal to 0
- CC_MainDummy Equal to No unit
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CC_SubDistance[CC_LoopInt] Less than 30.00
-
Then - Actions
- Unit - Cause CC_CasterUnit to damage CC_TargetUnit, dealing CC_Dmg damage of attack type Spells and damage type Universal
- Set CC_TargetUnit = No unit
- Set CC_SubDistance[CC_LoopMax] = CC_SubDistance[CC_LoopInt]
- Set CC_SubDummy[CC_LoopMax] = CC_SubDummy[CC_LoopInt]
- Set CC_LoopMax = (CC_LoopMax - 1)
- Set CC_LoopInt = (CC_LoopInt - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CC_LoopMax Equal to 0
- CC_MainDummy Equal to No unit
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call RemoveLocation(udg_CC_Point)
- Custom script: call RemoveLocation(udg_TempPoint)
-
Loop - Actions
-
Events
EDIT 2: Managed to make it stop the looping trigger after all dummies are gone. Still got some lag after casting though, seems to be every 0.5 seconds or something that it lags.
Here's the updated one! (Messages are there for testing purposes)
-
CC Loop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CC_MainDummy Not equal to No unit
-
Then - Actions
- Set CC_Point = (Position of CC_MainDummy)
- Set TempPoint = (CC_Point offset by 4.00 towards (Facing of CC_MainDummy) degrees)
- Unit - Move CC_MainDummy instantly to TempPoint
- Set CC_MainDistance = (CC_MainDistance - 4.00)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CC_MainDistance Less than 4.00
-
Then - Actions
- Unit - Kill CC_MainDummy
- Set CC_MainDummy = No unit
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Random integer number between 1 and 4) Equal to 1
-
Then - Actions
- Set CC_LoopMax = (CC_LoopMax + 1)
- Set CC_SubAngle[CC_LoopMax] = (CC_MainAngle + 90.00)
- Unit - Create 1 Dummy (Conference Sub) for (Owner of CC_CasterUnit) at TempPoint facing CC_SubAngle[CC_LoopMax] degrees
- Set CC_SubDummy[CC_LoopMax] = (Last created unit)
- Set CC_SubDistance[CC_LoopMax] = 800.00
- Set CC_LoopMax = (CC_LoopMax + 1)
- Set CC_SubAngle[CC_LoopMax] = (CC_MainAngle - 90.00)
- Unit - Create 1 Dummy (Conference Sub) for (Owner of CC_CasterUnit) at TempPoint facing CC_SubAngle[CC_LoopMax] degrees
- Set CC_SubDummy[CC_LoopMax] = (Last created unit)
- Set CC_SubDistance[CC_LoopMax] = 800.00
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call RemoveLocation(udg_CC_Point)
- Custom script: call RemoveLocation(udg_TempPoint)
- Else - Actions
-
If - Conditions
-
For each (Integer CC_LoopInt) from 1 to CC_LoopMax, do (Actions)
-
Loop - Actions
- Set CC_Point = (Position of CC_SubDummy[CC_LoopInt])
- Set TempPoint = (CC_Point offset by 15.00 towards CC_SubAngle[CC_LoopInt] degrees)
- Unit - Move CC_SubDummy[CC_LoopInt] instantly to TempPoint
- Set CC_SubDistance[CC_LoopInt] = (CC_SubDistance[CC_LoopInt] - 15.00)
- Set CC_Group = (Units within 50.00 of TempPoint matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an enemy of (Owner of CC_CasterUnit)) Equal to True)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in CC_Group) Greater than or equal to 1
-
Then - Actions
- Set CC_TargetUnit = (Random unit from CC_Group)
- Set CC_Dmg = (((Real((Intelligence of CC_CasterUnit (Exclude bonuses)))) x 0.10) x (1.00 - ((800.00 - CC_SubDistance[CC_LoopInt]) / 800.00)))
- Game - Display to (All players) the text: (String(CC_Dmg))
- Unit - Cause CC_CasterUnit to damage CC_TargetUnit, dealing CC_Dmg damage of attack type Spells and damage type Universal
- Set CC_TargetUnit = No unit
- Unit - Kill CC_SubDummy[CC_LoopInt]
- Set CC_SubDistance[CC_LoopInt] = CC_SubDistance[CC_LoopMax]
- Set CC_SubDummy[CC_LoopInt] = CC_SubDummy[CC_LoopMax]
- Set CC_LoopMax = (CC_LoopMax - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CC_LoopMax Equal to 0
- CC_MainDummy Equal to No unit
-
Then - Actions
- Trigger - Turn off (This trigger)
- Game - Display to (All players) the text: 2
-
Else - Actions
- Set CC_LoopInt = (CC_LoopInt - 1)
-
If - Conditions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CC_SubDistance[CC_LoopInt] Less than 15.00
-
Then - Actions
- Unit - Kill CC_SubDummy[CC_LoopInt]
- Set CC_SubDistance[CC_LoopInt] = CC_SubDistance[CC_LoopMax]
- Set CC_SubDummy[CC_LoopInt] = CC_SubDummy[CC_LoopMax]
- Set CC_LoopMax = (CC_LoopMax - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- CC_LoopMax Equal to 0
- CC_MainDummy Equal to No unit
-
Then - Actions
- Trigger - Turn off (This trigger)
- Game - Display to (All players) the text: 1
-
Else - Actions
- Set CC_LoopInt = (CC_LoopInt - 1)
-
If - Conditions
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call RemoveLocation(udg_CC_Point)
- Custom script: call RemoveLocation(udg_TempPoint)
- Custom script: call DestroyGroup(udg_CC_Group)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
Last edited: