- Joined
- Mar 1, 2020
- Messages
- 7
So basically I have a trigger that spawns a circle of power in a circle around the casting unit (in this case a town hall). Before it spawns the circle of power, I check the Z value of the terrain and check for structures that are too close. Its working real well, except after casting the ability between 5 - 15 times the game crashes. Can anyone point me in the right direction?
-
Village Initialization
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set VariableSet Village_SpawnRangeMin = 2500.00
-
Set VariableSet Village_SpawnRangeMax = 4500.00
-
Set VariableSet Village_FSPV_Range = 1250.00
-
-
-
Village FindSpawnPointValidator
-
Events
-
Conditions
-
Actions
-
-------- CHECK Z --------
-
Custom script: set udg_Village_ZReal = GetLocationZ(udg_Village_FSPV_SpawnPoint)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
Village_ZReal Greater than or equal to 550.00
-
Village_ZReal Equal to 0.00
-
-
-
-
Then - Actions
-
Set VariableSet Village_FSPV_IsValidSpawnPoint = False
-
-
Else - Actions
-
-------- Get all units within a range of the spawn point to check that this spawn point is valid --------
-
Set VariableSet Village_temp_UnitGroup1 = (Units within Village_FSPV_Range of Village_FSPV_SpawnPoint.)
-
-------- Assume the spawn point is valid by default --------
-
Set VariableSet Village_FSPV_IsValidSpawnPoint = True
-
-------- Enumerate the units with range of the spawn point and set FSPV_IsSpawnPointValid to false if any units would invalidate the spawn point --------
-
Unit Group - Pick every unit in Village_temp_UnitGroup1 and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is A town-hall-type unit) Equal to True
-
-
Then - Actions
-
Set VariableSet Village_FSPV_IsValidSpawnPoint = False
-
-
Else - Actions
-
-
-
-
-
-
-------- Clean up the temp unit group reference --------
-
Custom script: call DestroyGroup(udg_Village_temp_UnitGroup1)
-
-
-
Village FindSpawnPoint
-
Events
-
Conditions
-
Actions
-
Set VariableSet Village_FSP_FoundSpawnPoint = False
-
-------- Try 10 times, if its consistently hard to find a point you may need to increase this number --------
-
For each (Integer A) from 1 to 10, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Village_FSP_FoundSpawnPoint Equal to False
-
-
Then - Actions
-
-------- Find a random point within a min/max radius around the given target point --------
-
Set VariableSet Village_temp_Point1 = (Village_FSP_TargetPoint offset by (Random real number between Village_FSP_RangeMin and Village_FSP_RangeMax) towards (Random angle) degrees.)
-
-------- Run the validation trigger which will set FSP_IsValidSpawnPoint --------
-
Set VariableSet Village_FSPV_SpawnPoint = Village_temp_Point1
-
Trigger - Run Village FindSpawnPointValidator <gen> (ignoring conditions)
-
-------- If FSPV_IsValidSpawnPoint is true we can stop looking --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Village_FSPV_IsValidSpawnPoint Equal to True
-
-
Then - Actions
-
Set VariableSet Village_FSP_FoundSpawnPoint = True
-
Set VariableSet Village_FSP_SpawnPoint = Village_temp_Point1
-
-
Else - Actions
-
-------- Clean up the temp location to avoid memory leaks --------
-
Custom script: call RemoveLocation(udg_Village_temp_Point1)
-
-
-
-
Else - Actions
-
-
-
-
-------- If we couldn't find a spawn point after N tries then we need to increase the range and try again --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Village_FSPV_IsValidSpawnPoint Not equal to True
-
-
Then - Actions
-
-------- Increase the range by some amount greater than 1.0 --------
-
Set VariableSet Village_FSP_RangeMin = (Village_FSP_RangeMin x 1.50)
-
Set VariableSet Village_FSP_RangeMax = (Village_FSP_RangeMax x 1.50)
-
-------- And try again --------
-
Trigger - Run (This trigger) (ignoring conditions)
-
-
Else - Actions
-
-
-
-
Village FindSpawnPointValidator
-
Events
-
Conditions
-
Actions
-
-------- CHECK Z --------
-
Custom script: set udg_Village_ZReal = GetLocationZ(udg_Village_FSPV_SpawnPoint)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
Village_ZReal Greater than or equal to 550.00
-
Village_ZReal Equal to 0.00
-
-
-
-
Then - Actions
-
Set VariableSet Village_FSPV_IsValidSpawnPoint = False
-
-
Else - Actions
-
-------- Get all units within a range of the spawn point to check that this spawn point is valid --------
-
Set VariableSet Village_temp_UnitGroup1 = (Units within Village_FSPV_Range of Village_FSPV_SpawnPoint.)
-
-------- Assume the spawn point is valid by default --------
-
Set VariableSet Village_FSPV_IsValidSpawnPoint = True
-
-------- Enumerate the units with range of the spawn point and set FSPV_IsSpawnPointValid to false if any units would invalidate the spawn point --------
-
Unit Group - Pick every unit in Village_temp_UnitGroup1 and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is A town-hall-type unit) Equal to True
-
-
Then - Actions
-
Set VariableSet Village_FSPV_IsValidSpawnPoint = False
-
-
Else - Actions
-
-
-
-
-
-
-------- Clean up the temp unit group reference --------
-
Custom script: call DestroyGroup(udg_Village_temp_UnitGroup1)
-
-
Attachments
Last edited: