- Joined
- Apr 7, 2008
- Messages
- 1,618
Due a request, I made a spell, where you can shoot.
Now, if I cast this spell 4/5 times, it begins to lag, and after the dummies were cleaned up, it stops lagging.
All leaks should be cleaned up.
(Dummy has locust ability, is visible)
I also made a trigger, where dead dummies were removed after they die.
Hope someone can find the problem source.
Now, if I cast this spell 4/5 times, it begins to lag, and after the dummies were cleaned up, it stops lagging.
-
SS Cast shoot
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Shoot
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- S_OnOff Equal to False
-
Then - Actions
- Set S_OnOff = True
- Trigger - Turn on SS Missile Move <gen>
- Else - Actions
-
If - Conditions
- -------- This trigger runs, if you cast the ability 'Shoot' --------
- -------- This saves the caster in a variable --------
- Set S_Caster = (Casting unit)
- -------- This is an Integer, so other triggers can query the bullets. --------
- Set S_Integer = (S_Integer + 1)
- -------- This is the radius of the dummy unit. --------
- Set S_DummyRadius[S_Integer] = 45.00
- -------- This sets the damage. --------
- -------- For more hero levels, just copy the if/then/else, and paste it in the else, and change level + damage --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Shoot for S_Caster) Equal to 1
-
Then - Actions
- Set S_Damage[S_Integer] = 50.00
- Set S_DummySpeed[S_Integer] = 15.00
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Shoot for S_Caster) Equal to 2
-
Then - Actions
- Set S_Damage[S_Integer] = 100.00
- Set S_DummySpeed[S_Integer] = 25.00
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of Shoot for S_Caster) Equal to 3
-
Then - Actions
- Set S_Damage[S_Integer] = 150.00
- Set S_DummySpeed[S_Integer] = 35.00
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- -------- This sets the facing angle of the caster, so the bullet flies with that degrees. --------
- Set S_Real = (Facing of S_Caster)
- -------- This sets the point, where the bullet will be created. --------
- Set S_Point = (Position of S_Caster)
- -------- The offset. Only, that it doesn't look like the bullet comes out of his body. --------
- Set S_Point_Offset = (S_Point offset by 50.00 towards S_Real degrees)
- -------- This creates the bullet at the point. --------
- Unit - Create 1 Dummy - Shoot for (Owner of S_Caster) at S_Point_Offset facing S_Real degrees
- -------- This is the 'lifetimer' of the bullet. Now it's on 1.5, that means, the bullet 'dies', if this is equal to 0 (1,5 seconds) --------
- Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
- -------- This sets the dummy in a variable. --------
- Set S_Dummy[S_Integer] = (Last created unit)
- -------- This increases the flying height of the bullet, so it doesn't fly on the ground. --------
- Unit - Add Ravenform to S_Dummy[S_Integer]
- Unit - Remove Ravenform from S_Dummy[S_Integer]
- Animation - Change S_Dummy[S_Integer] flying height to 70.00 at 0.00
- Custom script: call RemoveLocation(udg_S_Point)
- Custom script: call RemoveLocation(udg_S_Point_Offset)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
-
SS Missile Move
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
For each (Integer S_IntegerA) from 1 to S_Integer, do (Actions)
-
Loop - Actions
- -------- This picks all enemy units in a range of 30. --------
- Set S_Point = (Position of S_Dummy[S_IntegerA])
- Set S_Group = (Units within S_DummyRadius[S_IntegerA] of S_Point matching ((((Matching unit) is Dead) Equal to False) and (((Owner of (Matching unit)) is an enemy of (Owner of S_Dummy[S_IntegerA])) Equal to True)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in S_Group) Greater than or equal to 1
-
Then - Actions
-
Unit Group - Pick every unit in S_Group and do (Actions)
-
Loop - Actions
- -------- This action deals the damage. --------
- Unit - Cause S_Dummy[S_IntegerA] to damage (Picked unit), dealing S_Damage[S_IntegerA] damage of attack type Pierce and damage type Universal
- -------- This removes the dummy bullet from the game --------
- Unit - Remove S_Dummy[S_IntegerA] from the game
-
Loop - Actions
-
Unit Group - Pick every unit in S_Group and do (Actions)
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation(udg_S_Point)
- Custom script: call DestroyGroup(udg_S_Group)
- -------- For a faster and better movement --------
- -------- This picks all bullets on the map. --------
- -------- The facing, where the bullet has to fly. --------
- Set S_Real = (Facing of S_Dummy[S_IntegerA])
- Set S_Point = (Position of S_Dummy[S_IntegerA])
- -------- The offset. This is the 'movement speed'. --------
- Set S_Point_Offset = (S_Point offset by 35.00 towards S_Real degrees)
- -------- Moves the bullet. --------
- Unit - Move S_Dummy[S_IntegerA] instantly to S_Point_Offset, facing S_Real degrees
- Custom script: call RemoveLocation(udg_S_Point)
- Custom script: call RemoveLocation(udg_S_Point_Offset)
- Set S_Group = (Units of type Dummy - Shoot)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in S_Group) Equal to 0
-
Then - Actions
- Set S_OnOff = False
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
- Custom script: call DestroyGroup(udg_S_Group)
-
Loop - Actions
-
For each (Integer S_IntegerA) from 1 to S_Integer, do (Actions)
-
Events
(Dummy has locust ability, is visible)
I also made a trigger, where dead dummies were removed after they die.
Hope someone can find the problem source.