Hi there!
i have 40 regions on the map
I have trigger where unit will spawn at random choosen region on the map. Everything works fine but sometimes there is trigger error. It say "cannot found random point in region list value 0" and unit wont spawn.
This is globla varible
Type:region regionList 2 = No Region <Region[40]>
First trigger
Start
Events
Game - Map initialization
Local Variables
Untitled Variable 001 = (Random integer between 1 and (Number of players in (Active Players))) <Integer>
Untitled Variable 001 = (Player 1 from marine) <Integer[11]>
Conditions
Actions
Timer - Start Ënd game as a One Shot timer that will expire in 850.0 Game Time seconds
Timer - Create a timer window for Ënd game, with the title "End Game", using Remaining time (initially Visible)
Variable - Set regionList 2[1] = Region 002
Variable - Set regionList 2[2] = Region 003
Variable - Set regionList 2[3] = Region 004
Variable - Set regionList 2[4] = Region 005
Variable - Set regionList 2[5] = Region 006
Variable - Set regionList 2[6] = Region 007
Variable - Set regionList 2[7] = Region 008
Variable - Set regionList 2[8] = Region 009
Variable - Set regionList 2[9] = Region 010
Variable - Set regionList 2[10] = Region 011
Variable - Set regionList 2[11] = Region 012
Variable - Set regionList 2[12] = Region 013
Variable - Set regionList 2[13] = Region 014
Variable - Set regionList 2[14] = Region 015
Variable - Set regionList 2[15] = Region 016
Variable - Set regionList 2[16] = Region 017
Variable - Set regionList 2[17] = Region 018
Variable - Set regionList 2[18] = Region 019
Variable - Set regionList 2[19] = Region 020
Variable - Set regionList 2[20] = Region 021
Variable - Set regionList 2[21] = Region 022
Variable - Set regionList 2[22] = Region 023
Variable - Set regionList 2[23] = Region 024
Variable - Set regionList 2[24] = Region 025
Variable - Set regionList 2[25] = Region 026
Variable - Set regionList 2[26] = Region 027
Variable - Set regionList 2[27] = Region 028
Variable - Set regionList 2[28] = Region 029
Variable - Set regionList 2[29] = Region 030
Variable - Set regionList 2[30] = Region 031
Variable - Set regionList 2[31] = Region 032
Variable - Set regionList 2[32] = Region 033
Variable - Set regionList 2[33] = Region 034
Variable - Set regionList 2[34] = Region 035
Variable - Set regionList 2[35] = Region 036
Variable - Set regionList 2[36] = Region 037
Variable - Set regionList 2[37] = Region 038
Variable - Set regionList 2[38] = Region 039
Variable - Set regionList 2[39] = Region 040
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
Player Group - Add player (Picked player) to marine
Timer - Start Choose alien as a One Shot timer that will expire in 5.0 Game Time seconds
Timer - Create a timer window for Choose alien, with the title "Choosing an Alien", using Remaining time (initially Visible)
Variable - Set Choose alien windows = (Last created timer window)
General - Wait 5.0 Game Time seconds
Trigger - Run Alien choose (Check Conditions, Don't Wait until it finishes)
Player - Make all players in marine treat each other as Ally
Cinematics - Fade In over 2.0 seconds using color (0%, 0%, 0%) and 0.0% transparency (Normal style, Wait until it finishes)
Cinematics - Turn cinematic mode Off for (All players) over Immediate seconds
Second trigger
Alien choose
Events
Local Variables
Untitled Variable 001 2 = (Player 1 from marine) <Integer[10]>
random player = (Random integer between 1 and (Number of players in (Active Players))) <Integer>
Conditions
Actions
Timer - Destroy Choose alien windows
Timer - Hide Choose alien windows for (All players)
Player Group - Pick each player in marine and do (Actions)
Actions
Player - Make player (Picked player) treat player random player as Enemy With Shared Vision
General - If (Conditions) then do (Actions) else do (Actions)
If
Then
Player Group - Remove player random player from marine
Player Group - Add player random player to alien
Player - Make all players in alien treat each other as Ally With Shared Vision
Player Group - Pick each player in marine and do (Actions)
Actions
Unit - Create 1 Marine for player (Picked player) at (Random point in regionList 2[(Random integer between 1 and 40)]) using default facing (No Options)
Player Group - Pick each player in alien and do (Actions)
Actions
Unit - Create 1 Alien for player (Picked player) at (Random point in regionList 2[(Random integer between 1 and 40)]) using default facing (No Options)
Else
Player Group - Remove player random player from alien
Player Group - Add player random player to marine
Player - Make all players in marine treat each other as Ally With Shared Vision
Player - Make player random player treat player (Number of players in marine) as Enemy With Shared Vision
Unit - Create 1 Marine for player (Picked player) at (Random point in regionList 2[(Random integer between 1 and 40)]) using default facing (No Options)
you used Random integer between 1 - 40
but your list ends with Variable - Set regionList 2[39]
so if the integer reach 40 he cannot find any region because your last varialbe is 39
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi there! i have 40 regions on the map I have trigger where unit will spawn at random choosen region on the map. Everything works fine but sometimes there is trigger error. It say "cannot found random point in region list value 0" and unit wont spawn.
Please help how to fix this
Please show us, how you made it first ;)
cant you just merge all the regions and spawn a unit randomly in that single region?
This is globla varible
Type:region regionList 2 = No Region <Region[40]>
First trigger
Start
Events
Game - Map initialization
Local Variables
Untitled Variable 001 = (Random integer between 1 and (Number of players in (Active Players))) <Integer>
Untitled Variable 001 = (Player 1 from marine) <Integer[11]>
Conditions
Actions
Timer - Start Ënd game as a One Shot timer that will expire in 850.0 Game Time seconds
Timer - Create a timer window for Ënd game, with the title "End Game", using Remaining time (initially Visible)
Variable - Set regionList 2[1] = Region 002
Variable - Set regionList 2[2] = Region 003
Variable - Set regionList 2[3] = Region 004
Variable - Set regionList 2[4] = Region 005
Variable - Set regionList 2[5] = Region 006
Variable - Set regionList 2[6] = Region 007
Variable - Set regionList 2[7] = Region 008
Variable - Set regionList 2[8] = Region 009
Variable - Set regionList 2[9] = Region 010
Variable - Set regionList 2[10] = Region 011
Variable - Set regionList 2[11] = Region 012
Variable - Set regionList 2[12] = Region 013
Variable - Set regionList 2[13] = Region 014
Variable - Set regionList 2[14] = Region 015
Variable - Set regionList 2[15] = Region 016
Variable - Set regionList 2[16] = Region 017
Variable - Set regionList 2[17] = Region 018
Variable - Set regionList 2[18] = Region 019
Variable - Set regionList 2[19] = Region 020
Variable - Set regionList 2[20] = Region 021
Variable - Set regionList 2[21] = Region 022
Variable - Set regionList 2[22] = Region 023
Variable - Set regionList 2[23] = Region 024
Variable - Set regionList 2[24] = Region 025
Variable - Set regionList 2[25] = Region 026
Variable - Set regionList 2[26] = Region 027
Variable - Set regionList 2[27] = Region 028
Variable - Set regionList 2[28] = Region 029
Variable - Set regionList 2[29] = Region 030
Variable - Set regionList 2[30] = Region 031
Variable - Set regionList 2[31] = Region 032
Variable - Set regionList 2[32] = Region 033
Variable - Set regionList 2[33] = Region 034
Variable - Set regionList 2[34] = Region 035
Variable - Set regionList 2[35] = Region 036
Variable - Set regionList 2[36] = Region 037
Variable - Set regionList 2[37] = Region 038
Variable - Set regionList 2[38] = Region 039
Variable - Set regionList 2[39] = Region 040
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
Player Group - Add player (Picked player) to marine
Timer - Start Choose alien as a One Shot timer that will expire in 5.0 Game Time seconds
Timer - Create a timer window for Choose alien, with the title "Choosing an Alien", using Remaining time (initially Visible)
Variable - Set Choose alien windows = (Last created timer window)
General - Wait 5.0 Game Time seconds
Trigger - Run Alien choose (Check Conditions, Don't Wait until it finishes)
Player - Make all players in marine treat each other as Ally
Cinematics - Fade In over 2.0 seconds using color (0%, 0%, 0%) and 0.0% transparency (Normal style, Wait until it finishes)
Cinematics - Turn cinematic mode Off for (All players) over Immediate seconds
Second trigger
Alien choose
Events
Local Variables
Untitled Variable 001 2 = (Player 1 from marine) <Integer[10]>
random player = (Random integer between 1 and (Number of players in (Active Players))) <Integer>
Conditions
Actions
Timer - Destroy Choose alien windows
Timer - Hide Choose alien windows for (All players)
Player Group - Pick each player in marine and do (Actions)
Actions
Player - Make player (Picked player) treat player random player as Enemy With Shared Vision
General - If (Conditions) then do (Actions) else do (Actions)
If
Then
Player Group - Remove player random player from marine
Player Group - Add player random player to alien
Player - Make all players in alien treat each other as Ally With Shared Vision
Player Group - Pick each player in marine and do (Actions)
Actions
Unit - Create 1 Marine for player (Picked player) at (Random point in regionList 2[(Random integer between 1 and 40)]) using default facing (No Options)
Player Group - Pick each player in alien and do (Actions)
Actions
Unit - Create 1 Alien for player (Picked player) at (Random point in regionList 2[(Random integer between 1 and 40)]) using default facing (No Options)
Else
Player Group - Remove player random player from alien
Player Group - Add player random player to marine
Player - Make all players in marine treat each other as Ally With Shared Vision
Player - Make player random player treat player (Number of players in marine) as Enemy With Shared Vision
Unit - Create 1 Marine for player (Picked player) at (Random point in regionList 2[(Random integer between 1 and 40)]) using default facing (No Options)
you used Random integer between 1 - 40
but your list ends with Variable - Set regionList 2[39]
so if the integer reach 40 he cannot find any region because your last varialbe is 39