Moderator
M
Moderator
12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.
15:00, 17th Jul 2012
Magtheridon96:
IcemanBo: Too long as NeedsFix. Rejected.
15:00, 17th Jul 2012
Magtheridon96:
-
- -------- Orb Movement when no enemy is detected --------
- Set OrbTravelDistance[SB_Integer] = (OrbTravelDistance[SB_Integer] + SB_Orb_Initial_Speed)
- Set SB_Orb_Current_Point[SB_Integer] = (Position of SB_Unit[SB_Integer])
- Set SB_Orb_Next_Point[SB_Integer] = (SB_Orb_Current_Point[SB_Integer] offset by SB_Orb_Initial_Speed towards SB_Angle[SB_Integer] degrees)
- Unit - Move SB_Unit[SB_Integer] instantly to SB_Orb_Next_Point[SB_Integer]
- Set SB_Orb_Detection_Delay[SB_Integer] = (SB_Orb_Detection_Delay[SB_Integer] + 0.03)
- -------- Checks if enough time has passed for the orb to be able to detect enemy units --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SB_Orb_Detection_Delay[SB_Integer] Greater than or equal to SB_Set_Orb_Detection_Delay
-
Then - Actions
- Set SB_UnitGroup[SB_Integer] = (Units within 375.00 of SB_Orb_Next_Point[SB_Integer] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of SB_Unit[SB_Integer])) Equal to True) and (((Matching unit) is alive) Equal to True))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in SB_UnitGroup[SB_Integer]) Greater than or equal to 1
-
Then - Actions
- -------- Sets up the target unit for the next part of the loop --------
- Custom script: set udg_SB_Target_Unit[udg_SB_Integer] = FirstOfGroup(udg_SB_UnitGroup[udg_SB_Integer])
- Set SB_Enemy_Point[SB_Integer] = (Position of SB_Target_Unit[SB_Integer])
- -------- For condition --------
- Set SB_Distance_Difference[SB_Integer] = (Distance between SB_Orb_Next_Point[SB_Integer] and SB_Enemy_Point[SB_Integer])
- Else - Actions
-
If - Conditions
-
Else - Actions
- Custom script: call DestroyGroup (udg_SB_UnitGroup[udg_SB_Integer])
- Custom script: call RemoveLocation (udg_SB_Orb_Next_Point[udg_SB_Integer])
- Custom script: call RemoveLocation (udg_SB_Orb_Current_Point[udg_SB_Integer])
- Custom script: call RemoveLocation (udg_SB_Enemy_Point[udg_SB_Integer])
-
If - Conditions
do all the other points that are not being destroyed in the same level. If you create
a location, you must destroy it in the same block of code. You can't create a location
and destroy it inside the "Then" or "Else" actions of the an if statement, because if you
destroy it in the "Then" actions, the Else actions might run and the whole thing would leak.
The solution is to move the destruction code to the outside of the if statement. - When you scale a unit, only the first value matters. You can use 0 for the others
and nothing different would happen. - Don't use the elapsed game time event, use the "Map initialization" event.
- Your current method of indexing isn't the best, so it would be best if it were updated to
use Hanky's Dynamic Indexing method. Take a look at this.