| 01-27-2004, 02:57 AM | #1 |
I have an area of my map that I would like to set up bases. The game is going to be FFA though so I have them spaced pretty well apart. What I wanted to do was to assign the bases to random reigons. (Can't use start locations because this happens after map init) Now the trigger is working well, but the problem is it is working too well. Some areas end up with 2 bases in them and the trigger will not stop running. I tried to put controls in to prevent that from happening, but it will not stop still. Here are the two related triggers. Any idea how I can fix it? Code:
Set up players
Set Temp_2 = (Temp_2 + 1)
If (Temp_2 Less than or equal to NumberofPlayers) then do (Trigger - Run Set Up players 2 <gen> (checking conditions)) else do (Do nothing)
Set up players 2
Set Random = (Random integer number between 1 and 11)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Random Equal to 1
Then - Actions
If (Spot_Taken[1] Equal to True) then do (Do nothing) else do (Unit - Create 1 Choose your units wisely (units) for (Player(Temp_2)) at (Center of Control the mountain random spawn 1 <gen>) facing Default building facing degrees)
If (Spot_Taken[1] Equal to True) then do (Do nothing) else do (Unit - Create 1 Choose your units wisely (2 extras) for (Player(Temp_2)) at (Center of Control the mountain random spawn 1 <gen>) facing Default building facing degrees)
Wait 0.50 game-time seconds
If (Spot_Taken[1] Equal to True) then do (Trigger - Run (This trigger) (checking conditions)) else do (Trigger - Run Set Up players <gen> (checking conditions))
Set Spot_Taken[1] = True
Else - ActionsI am open to any suggestions, but I really need to solve this soon! |
| 01-27-2004, 03:06 AM | #2 |
I would do it completly differently to help myself out. The way you are doing it you are going to end up doing a lot of extra work, and that extra work allows for more errors. What I would do is make a rect array, and store the starting rects of where the players are going to start in the array depending on which player will start there. So the start location for Player 1 would be stored in StartingRects[1], etc... I would then in my second trigger do a loop from 1 to however many players are in the game. Then I would create whatever units needed to be created for the player whose index is = the loop, at the StartingRect[for the loop]. This way you would do everything in one swift motion. This way would also help reduce errors, because if there was one problem, it would happen for all the bases instead of just a couple. |
| 01-27-2004, 03:23 AM | #3 |
I don't think I understand because what you are saying does not sound to me like it would give you randomly placed bases. Can you explain? |
| 01-27-2004, 06:59 AM | #4 |
Hmm... 2 triggers... 3 variable...... All random start locatiions... no 2 people in the same start spot... heres how: Put a region at each posible start location. Variables: StartLoc = Region Array StartLocCount = Integer RandomInt = Integer Triggers: Code:
Set Variables
Event
Map Init
Conditions
Actions
Set StartLoc[1] = Region1
Set StartLoc[2] = Region2
Set StartLoc[3] = Region3
Set StartLoc[4] = Region4
.... ect ect, for each posible start location..
Set StartLocCount = # [color=green]Where # is how many start locations you have[/color]
RandomStarts
Event
What ever
Conditions
Actions
Pick all players
Do Loop
If
Conditions
Picked Player slot status is equal to "Is playing"
Picked Player control is equal to "User"
Then
Set RandomInt = Random number between 1 and StartLocCount
Unit - Create 1 Choose your units wisely (units) for (Player(Picked Player)) at (Center of StartLoc[RandomInt]) facing Default building facing degrees
Unit - Create 1 Choose your units wisely (2 extras) for (Player(Picked Player)) at (Center of StartLoc[RandomInt] ) facing Default building facing degrees
Set StartLoc[RandomInt] = StartLoc[StartLocCount]
Set StartLocCount = StartLocCount - 1
Else
Do NothingThere. No more 2 people starting in one location. If you need any info on HOW my trigger works, just let me know and I will explain it. |
