So my trigger works well and as intended but one of the important parts makes the trigger take a while to finish, the trigger creates and randomizes the bases for all players in risk.
I also have one more question, is there a better way to do this in GUI?
This is the whole trigger
One of these functions are what i believe is increasing the time it takes (its like the game freezes) it only started oncei added this.
I also have one more question, is there a better way to do this in GUI?
This is the whole trigger
-
Set Countries
-
Events
-
Time - Elapsed game time is 1.00 seconds
-
-
Conditions
-
Actions
-
-------- Count Players --------
-
Set tempForce1 = (All players matching (((Matching player) slot status) Equal to Is playing))
-
Set numOfPlayers = (Number of players in tempForce1)
-
-------- ------------------------- --------
-
Set activeCityCount = (Number of units in (Units owned by Neutral Hostile matching (((Matching unit) is A structure) Equal to True)))
-
Set numOfBasesPerPlayer = (activeCityCount / numOfPlayers)
-
Game - Display to (All players) for 10.00 seconds the text: (number of players + (String((Number of players in (All players matching (((Matching player) slot status) Equal to Is playing))))))
-
Game - Display to (All players) for 10.00 seconds the text: (bases per player + (String(numOfBasesPerPlayer)))
-
-------- ------------------------- --------
-
-------- Set Bases --------
-
-------- ------------------------- --------
-
Set B = 1
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 001 <gen>
-
Set countryName[B] = Morocco
-
Set countrySpawn[B] = 1 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 003 <gen>
-
Set countryName[B] = Algeria
-
Set countrySpawn[B] = 2 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = 23 <gen>
-
Set countryName[B] = Malta
-
Set countrySpawn[B] = 3 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 010 <gen>
-
Set countryName[B] = Sardinia
-
Set countrySpawn[B] = 11 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 007 <gen>
-
Set countryArea2[B] = Region 008 <gen>
-
Set countryName[B] = Italy
-
Set countrySpawn[B] = 10 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 012 <gen>
-
Set countryName[B] = Spain
-
Set countrySpawn[B] = 12 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 014 <gen>
-
Set countryName[B] = Portugal
-
Set countrySpawn[B] = 13 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 016 <gen>
-
Set countryArea2[B] = Region 017 <gen>
-
Set countryName[B] = France
-
Set countrySpawn[B] = 14 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 034 <gen>
-
Set countryName[B] = Switzerland
-
Set countrySpawn[B] = 20 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 032 <gen>
-
Set countryName[B] = Austria
-
Set countrySpawn[B] = 21 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 036 <gen>
-
Set countryName[B] = Slovenia
-
Set countrySpawn[B] = 22 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 038 <gen>
-
Set countryName[B] = Bosnia
-
Set countrySpawn[B] = 25 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 040 <gen>
-
Set countryName[B] = Greece
-
Set countrySpawn[B] = 24 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 058 <gen>
-
Set countryName[B] = Turkey
-
Set countrySpawn[B] = 7 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 056 <gen>
-
Set countryName[B] = Isreal
-
Set countrySpawn[B] = 6 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 054 <gen>
-
Set countryName[B] = Egypt
-
Set countrySpawn[B] = 5 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 052 <gen>
-
Set countryName[B] = Libya
-
Set countrySpawn[B] = 4 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 060 <gen>
-
Set countryName[B] = Georgia
-
Set countrySpawn[B] = 8 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 062 <gen>
-
Set countryName[B] = Armenia
-
Set countrySpawn[B] = 9 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 019 <gen>
-
Set countryName[B] = Belguim
-
Set countrySpawn[B] = 15 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 021 <gen>
-
Set countryName[B] = Netherlands
-
Set countrySpawn[B] = 16 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 023 <gen>
-
Set countryName[B] = Denmark
-
Set countrySpawn[B] = 17 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 025 <gen>
-
Set countryArea2[B] = 18 <gen>
-
Set countryName[B] = Germany
-
Set countrySpawn[B] = Region 024 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 044 <gen>
-
Set countryName[B] = Hungary
-
Set countrySpawn[B] = 26 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 030 <gen>
-
Set countryName[B] = Czechoslovakia
-
Set countrySpawn[B] = 30 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 028 <gen>
-
Set countryName[B] = Poland
-
Set countrySpawn[B] = 19 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 048 <gen>
-
Set countryName[B] = Belarus
-
Set countrySpawn[B] = 31 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 046 <gen>
-
Set countryName[B] = Ukraine
-
Set countrySpawn[B] = 29 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 064 <gen>
-
Set countryName[B] = Moldova
-
Set countrySpawn[B] = 28 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 042 <gen>
-
Set countryName[B] = Romania
-
Set countrySpawn[B] = 27 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 050 <gen>
-
Set countryName[B] = Lithuania
-
Set countrySpawn[B] = 32 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 065 <gen>
-
Set countryArea2[B] = Region 066 <gen>
-
Set countryName[B] = Russia
-
Set countrySpawn[B] = 33 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 069 <gen>
-
Set countryName[B] = Finland
-
Set countrySpawn[B] = 34 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 071 <gen>
-
Set countryArea2[B] = Region 072 <gen>
-
Set countryName[B] = Sweden
-
Set countrySpawn[B] = 35 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 073 <gen>
-
Set countryArea2[B] = Region 074 <gen>
-
Set countryName[B] = Norway
-
Set countrySpawn[B] = 36 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 077 <gen>
-
Set countryName[B] = Svalbard
-
Set countrySpawn[B] = 37 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 081 <gen>
-
Set countryName[B] = Ireland
-
Set countrySpawn[B] = 40 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 082 <gen>
-
Set countryName[B] = Wales
-
Set countrySpawn[B] = 39 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = Region 083 <gen>
-
Set countryArea2[B] = Region 084 <gen>
-
Set countryName[B] = England
-
Set countrySpawn[B] = 38 <gen>
-
-------- ------------------------- --------
-
Set B = (B + 1)
-
-------- ------------------------- --------
-
Set countryArea1[B] = 3 <gen>
-
Set countryName[B] = Malta
-
Set countrySpawn[B] = 23 <gen>
-
-------- ------------------------- --------
-
-------- ------------------------- --------
-
-------- ------------------------- --------
-
Set countryCount = B
-
Game - Display to (All players) for 10.00 seconds the text: (countries + (String(countryCount)))
-
-------- ------------------------- --------
-
-------- ------------------------- --------
-
-------- ------------------------- --------
-
For each (Integer B) from 1 to countryCount, do (Actions)
-
Loop - Actions
-
Set countryRegions[B] = (Units in countryArea1[B] owned by Neutral Hostile)
-
Unit Group - Add all units of (Units in countryArea2[B] owned by Neutral Hostile) to countryRegions[B]
-
Set countryCityCount[B] = ((Number of units in (Units in countryArea1[B] owned by Neutral Hostile)) + (Number of units in (Units in countryArea2[B] owned by Neutral Hostile)))
-
Set tempPointArray1[B] = (Center of countrySpawn[B])
-
Set tempPointArray2[B] = (tempPointArray1[B] offset by (-85.00, -125.00))
-
Floating Text - Create floating text that reads (|cFFFF0303 + (countryName[B] + ((( + () + ((String(countryCityCount[B])) + ))) + |r))) at tempPointArray2[B] with Z offset 0.00, using font size 13.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
-
-------- ------------------------- --------
-
-------- ------------------------- --------
-
-------- ------------------------- --------
-
Unit Group - Pick every unit in (Random numOfPlayers units from (Units owned by Neutral Hostile matching (((Matching unit) is in countryRegions[B]) Equal to True))) and do (Actions)
-
Loop - Actions
-
Set tempUnit1 = (Picked unit)
-
Set tempPoint1 = (Position of tempUnit1)
-
Set tempPoint2 = (tempPoint1 offset by (0.00, -220.00))
-
Set tempPlayer1 = (Random player from tempForce1)
-
Set G_TempGroup = (Units within 150.00 of tempPoint2 matching ((((((Matching unit) is alive) Equal to True) and (((Matching unit) is in G_Group) Not equal to True)) and (((Matching unit) is A structure) Not equal to True)) and ((Owner of (Matching unit)) Equal to tempPlayer1))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(G_TempGroup is empty) Equal to False
-
-
Then - Actions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
tempInt[(Player number of tempPlayer1)] Less than numOfBasesPerPlayer
-
tempInt[(Player number of tempPlayer1)] Less than 40
-
-
Then - Actions
-
Unit - Create 1 defaultUnitType for tempPlayer1 at tempPoint2 facing Default building facing degrees
-
Set tempUnit2 = (Last created unit)
-
Unit - Change ownership of tempUnit1 to tempPlayer1 and Change color
-
Unit - Order tempUnit1 to Undead Necromancer - Unholy Frenzy tempUnit2
-
Set tempInt[(Player number of tempPlayer1)] = (tempInt[(Player number of tempPlayer1)] + 1)
-
Player Group - Remove tempPlayer1 from tempForce1
-
Player Group - Add tempPlayer1 to tempForce2
-
-
Else - Actions
-
-
-
-
Custom script: call RemoveLocation( udg_tempPoint1 )
-
Custom script: call RemoveLocation( udg_tempPoint2 )
-
Custom script: call DestroyGroup( udg_G_TempGroup )
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of players in tempForce1) Equal to 0
-
-
Then - Actions
-
Player Group - Pick every player in tempForce2 and do (Actions)
-
Loop - Actions
-
Player Group - Add (Picked player) to tempForce1
-
Player Group - Remove (Picked player) from tempForce2
-
-
-
-
Else - Actions
-
-
-
-
Unit Group - Pick every unit in (Units owned by Neutral Hostile matching (((Matching unit) is in countryRegions[B]) Equal to True)) and do (Actions)
-
Loop - Actions
-
Set tempUnit1 = (Picked unit)
-
Set tempPoint1 = (Position of tempUnit1)
-
Set tempPoint2 = (tempPoint1 offset by (0.00, -220.00))
-
Unit - Create 1 defaultUnitType for Neutral Hostile at tempPoint2 facing Default building facing degrees
-
Set tempUnit2 = (Last created unit)
-
Unit - Order tempUnit1 to Undead Necromancer - Unholy Frenzy tempUnit2
-
-
-
-
-
-
-
Player Group - Remove tempPlayer1 from tempForce1
-
Player Group - Add tempPlayer1 to tempForce2
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of players in tempForce1) Equal to 0
-
-
Then - Actions
-
Player Group - Pick every player in tempForce2 and do (Actions)
-
Loop - Actions
-
Player Group - Add (Picked player) to tempForce1
-
Player Group - Remove (Picked player) from tempForce2
-
-
-
-
Else - Actions
-
Last edited: