- Joined
- Feb 28, 2013
- Messages
- 1,898
Hello, I made this trigger for my map, I just want to consult to you guys if it is actually good or it can be optimized abit more.
I saved the points of the destructibles at the array so that the destructible will not spawn at the same spot.
Edit: Actually it still doesn't work, destructible/s still spawn/s on top of another destructible (see attachment). I'll try to fix it, brb
I saved the points of the destructibles at the array so that the destructible will not spawn at the same spot.
-
Dev Arena Detect
-
Events
-
Player - Player 1 (Red) skips a cinematic sequence
-
Unit - A unit enters Arena Detect Player <gen>
-
-
Conditions
-
Actions
-
-------- --------
-
-------- Debug --------
-
Game - Display to (All players) the text: Randomized
-
-------- --------
-
-------- Setup --------
-
Set Arena_DesCountMax = 20
-
Set Arena_DesCountCurrent = 0
-
Set Arena_SimilarPointCheck = False
-
-------- --------
-
-------- Clear the area --------
-
Destructible - Pick every destructible in Arena Detect Player <gen> and do (Actions)
-
Loop - Actions
-
Destructible - Remove (Picked destructible)
-
-
-
-------- --------
-
-------- Clear the points --------
-
For each (Integer A) from 1 to Arena_DesCountMax, do (Actions)
-
Loop - Actions
-
Set Arena_DesPointArraySaved[(Integer A)] = (Point(0.00, 0.00))
-
-
-
-------- --------
-
-------- Generate Objects --------
-
Trigger - Run Dev Arena Generate <gen> (ignoring conditions)
-
-
-
Dev Arena Generate
-
Events
-
Conditions
-
Actions
-
-------- --------
-
-------- Check if objects is below or equal the max --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Arena_DesCountCurrent Less than or equal to Arena_DesCountMax
-
-
Then - Actions
-
-------- --------
-
-------- Check if the point is already taken --------
-
Set Arena_DesPoint = (Random point in Arena Spawn Doods <gen>)
-
For each (Integer A) from 1 to Arena_DesCountMax, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
-
(X of Arena_DesPointArraySaved[(Integer A)]) Equal to (X of Arena_DesPoint)
-
(Y of Arena_DesPointArraySaved[(Integer A)]) Equal to (Y of Arena_DesPoint)
-
-
-
-
Then - Actions
-
Set Arena_SimilarPointCheck = True
-
-
Else - Actions
-
Do nothing
-
-
-
-
-
-------- --------
-
-------- Rerun trigger without increment if point already exists, otherwise generate objects --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Arena_SimilarPointCheck Equal to True
-
-
Then - Actions
-
-------- --------
-
-------- Debug --------
-
Game - Display to (All players) the text: Same Point
-
-------- --------
-
-------- Run again --------
-
Trigger - Run (This trigger) (ignoring conditions)
-
-
Else - Actions
-
-------- --------
-
-------- Debug --------
-
Game - Display to (All players) the text: Generated
-
-------- --------
-
-------- Randomize object models --------
-
Set Arena_DesRandomDes = (Random integer number between 1 and 2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Arena_DesRandomDes Equal to 1
-
-
Then - Actions
-
Destructible - Create a #B02_ArenaBarrel at Arena_DesPoint facing (Random angle) with scale 3.00 and variation 0
-
-
Else - Actions
-
Destructible - Create a #B02_ArenaBarrel2 at Arena_DesPoint facing (Random angle) with scale 3.00 and variation 0
-
-
-
-------- --------
-
-------- Save the point as taken --------
-
Set Arena_DesPointArraySaved[Arena_DesCountCurrent] = (Point((X of (Position of (Last created destructible))), (Y of (Position of (Last created destructible)))))
-
-------- --------
-
-------- Increment --------
-
Set Arena_DesCountCurrent = (Arena_DesCountCurrent + 1)
-
-------- --------
-
-------- Run again --------
-
Trigger - Run (This trigger) (ignoring conditions)
-
-
-
-
Else - Actions
-
Custom script: call RemoveLocation(udg_Arena_DesPoint)
-
Set Arena_DesCountCurrent = 0
-
For each (Integer A) from 1 to Arena_DesCountMax, do (Actions)
-
Loop - Actions
-
Custom script: call RemoveLocation(udg_Arena_DesPointArraySaved[udg_Arena_DesCountCurrent])
-
-
-
Set Arena_DesCountCurrent = 0
-
-
-
-
Edit: Actually it still doesn't work, destructible/s still spawn/s on top of another destructible (see attachment). I'll try to fix it, brb
Attachments
Last edited: