I have 12 Regions in a "room wars" type map that I want to populate with 1 turret each. There are only 5 players max, so there can and will be neutral (player 0) turrets at the start of the game. I was thinking the most efficient way to do this was to loop through each region, placing a turret for player 0, and then if that region is a starting point - and the player who uses that starting point is an User - then to give control of that turret to them.
Trying to work this out has proven really difficult for me. Perhaps I'm missing an easier approach? Any ideas or suggestions would be great!
You would need to save each region in the data table for a loop to work, and by the time that's done I'm not sure if that is really efficient. Since there is no Region Group, you can't really loop through it unless you save the data table values as Region 1, Region 2, etc... and recall then using "Region " + "Picked Integer" Then you would need to set up a nested loop so you need to set a for each integer loop inside of a player group loop where you use an if, then, else to check whether or not the player's starting location is in the region.
I just set an array with 12 regions and then assign another array 1-12 so I can match territory number with a specific region on the map.
globalRegionID[localRegionCounter] and then to loop through and do something in each region I just do a for each globalRegionID... create 1 unit at center of globalRegionID[localRegionCounter]... I dont have it right in front of me, i'll make sure that's the jist of it when I get back, but I can loop through the regions just fine... it's just figuring out how to check if the region it's on is a starting area and if so, is that player associated with it actually in the game right now? that's the problem.
Okay so the "starting points" for the players aren't really Starcraft starting points - just so I can handle and change their values easier... but here's what I have so far. It does NOT work... Right now, it's not spawning a marine on regions that are "starting points" but have no human player in them - for player 0.
There needs to be some way to squeeze a loop to check all of the players status' in there somewhere too so I don't have to hard-code in the same action for each player case. All the values can come from variables so I don't see why not. It's just getting so complicated that I can't seem to picture the whole thing at once. :(
Then you need a way to associate the points with a player then (so save the point to Point[1] would be player 1), unless the points (player positions) are fixed then it should be just a single loop
Just use For each Player (variable that is an integer) in (Active Players) and use a nested loop For each integer (another variable that is an integer) from 1 to 12 use an if then else with the function "Point is in region". globalStartPoint HAS to match the player number so you cant have globalStartPoint[1] be for player 5 it has to be for player 1. If you have another way to check which player is using that start point that is fine.
Okay I guess it's still a little difficult to understand what you're saying, for me. Here's my second attempt at getting it to do what I want, and it looks like it worked - at least on a local test it does.
you might need to use an And condition, I am not sure if it will check both conditions or just one or the other. Also how are you checking if the point is in the region?
ignore this if you still dont want to use it but here is another picture
In post six of this thread, I state that I'm not actually using "Starting Points" for my map, just referencing Regions as almost a "starting region". Also, by looking at last trigger pic that I attached, you would see that there are no actual points involved as it wouldn't let me reference a point with "center of region((".
I'm using the regions because it lends itself useful to other aspects of my map. I will look again at using actual points - to see if what you're saying will be useful. Sorry if I wasn't clear.
Also, thanks for pointing out the AND issue - I'll check that as well.
Okay after looking at it some more, I believe the problem is in how i'm grabbing the players from their lobby slots right away in setPlayerVariables. I made some changes and it seems to work now - i'll know for sure tonight when i can test it on bnet/not locally.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I have 12 Regions in a "room wars" type map that I want to populate with 1 turret each. There are only 5 players max, so there can and will be neutral (player 0) turrets at the start of the game. I was thinking the most efficient way to do this was to loop through each region, placing a turret for player 0, and then if that region is a starting point - and the player who uses that starting point is an User - then to give control of that turret to them.
Trying to work this out has proven really difficult for me. Perhaps I'm missing an easier approach? Any ideas or suggestions would be great!
@playpong: Go
You would need to save each region in the data table for a loop to work, and by the time that's done I'm not sure if that is really efficient. Since there is no Region Group, you can't really loop through it unless you save the data table values as Region 1, Region 2, etc... and recall then using "Region " + "Picked Integer" Then you would need to set up a nested loop so you need to set a for each integer loop inside of a player group loop where you use an if, then, else to check whether or not the player's starting location is in the region.
@Usernameisntworkingright: Go
I just set an array with 12 regions and then assign another array 1-12 so I can match territory number with a specific region on the map.
globalRegionID[localRegionCounter] and then to loop through and do something in each region I just do a for each globalRegionID... create 1 unit at center of globalRegionID[localRegionCounter]... I dont have it right in front of me, i'll make sure that's the jist of it when I get back, but I can loop through the regions just fine... it's just figuring out how to check if the region it's on is a starting area and if so, is that player associated with it actually in the game right now? that's the problem.
@playpong:
Is there any chance that I can take a look at the map? It's much easier to solve problems if i can see what the problem is first-hand.
@playpong: Go Lol, oops im dumb, try this, I couldn't find a Player variable so im not sure if you can use For each player.
EDIT: use Untitled Variable 001 2 for player # and i think region # should work fine if not use Untitled Variable 001
EDIT2: im dumb again, player variables are integers, use For each Player and use picked player
@Usernameisntworkingright: Go
Okay so the "starting points" for the players aren't really Starcraft starting points - just so I can handle and change their values easier... but here's what I have so far. It does NOT work... Right now, it's not spawning a marine on regions that are "starting points" but have no human player in them - for player 0.
There needs to be some way to squeeze a loop to check all of the players status' in there somewhere too so I don't have to hard-code in the same action for each player case. All the values can come from variables so I don't see why not. It's just getting so complicated that I can't seem to picture the whole thing at once. :(
@playpong: Go
Then you need a way to associate the points with a player then (so save the point to Point[1] would be player 1), unless the points (player positions) are fixed then it should be just a single loop
@Usernameisntworkingright: Go
Sorry, I don't follow.
This is what I kind of had in mind:
Loop through localRegions
Loop through localPlayers
if localPlayer = user then if globalStartingPoint = localRegions then create turret for localPlayer create startingUnits for localPlayer break
else else create turret for Player 0 create startingUnits for Player 0
But the problem with that is it's going to produce units for Player 0 for every player that isn't in the game.
@playpong: Go
Just use For each Player (variable that is an integer) in (Active Players) and use a nested loop For each integer (another variable that is an integer) from 1 to 12 use an if then else with the function "Point is in region". globalStartPoint HAS to match the player number so you cant have globalStartPoint[1] be for player 5 it has to be for player 1. If you have another way to check which player is using that start point that is fine.
@Usernameisntworkingright: Go
Okay I guess it's still a little difficult to understand what you're saying, for me. Here's my second attempt at getting it to do what I want, and it looks like it worked - at least on a local test it does.
@playpong: Go
you might need to use an And condition, I am not sure if it will check both conditions or just one or the other. Also how are you checking if the point is in the region?
ignore this if you still dont want to use it but here is another picture
I can still set this up for you, if you didn't figure it out. Just PM me the map.
@Usernameisntworkingright: Go
In post six of this thread, I state that I'm not actually using "Starting Points" for my map, just referencing Regions as almost a "starting region". Also, by looking at last trigger pic that I attached, you would see that there are no actual points involved as it wouldn't let me reference a point with "center of region((".
I'm using the regions because it lends itself useful to other aspects of my map. I will look again at using actual points - to see if what you're saying will be useful. Sorry if I wasn't clear.
Also, thanks for pointing out the AND issue - I'll check that as well.
@deathtorn: Go
Yes, I'll be testing these changes tonight at some point, and if it doesn't work, I'll shoot you a copy.
@playpong:
Sounds good
@deathtorn: Go
Any luck?
@playpong:
Sorry, slow going here, I've been busy, I'll get that done tonight.
@deathtorn: Go
Okay after looking at it some more, I believe the problem is in how i'm grabbing the players from their lobby slots right away in setPlayerVariables. I made some changes and it seems to work now - i'll know for sure tonight when i can test it on bnet/not locally.