I'm making a a spawning trigger.
I have a unit and a region attached to that unit. And then I have some points placed on the map. (Named Point 001 - 002.....)
Now the trigger: whenever i press Space (in my case) the trigger will run and will spawn a unit. But the unit needs to spawn at one point that is inside my attached region.
So is it possible to like scan the region for points and maybe get the coordinates? Or is there any other way to "find" an existing point??
well you can create a unit at region (random point in region, center of region) etc.... that seems like what you are talking about.
but you may also be talking about to create a unit a a point in the region attached to antoher unit, but what if the end point youre wanting isnt insite that region, then to find the closest point????
Well, the region and the points is placed in a way that there will always be a point in the region.
But even if there isn't a point then if there were a function of some sort it should tell me that there isn't any point there?
I want this because the created unit needs to be placed in a middle of a square (the position of the point).
well under 'conditions' there is under 'points' if 'point is in specified region' that sounds like that would work for what youre talking about. but you would have to make either a bunch of 'if' 'then' 'else' 'if' 'then' else' etc.... for each point to make it work, but this seems sloppy, though it would check if a point is in a region then... (create xunit at ypoint)
so in short the condition under 'points' 'if point is in region' (return boolean or 'true' or not) would work....
You could store all the points into an array and then do a foreach over the array until a point in the region is found, still a bit messy but would eliminate the need of a switch or a lot of If/Else statements(Just 1 would be needed).
You could store all the points into an array and then do a foreach over the array until a point in the region is found, still a bit messy but would eliminate the need of a switch or a lot of If/Else statements(Just 1 would be needed).
Ty, thought i would need to do this. My problem is that I've got nearly 150 points :S
You could even get all available regions of your map using "region RegionFromId(int lp_id)" and count the parameter from 0 to whatever.
To determine whether a point is in a region you could use school trigonometry and "fixed DistanceBetweenPoints(point p1, point p2)" with your point and the center of the region, depending on the shape of your regions. :)
Hello.
I'm making a a spawning trigger. I have a unit and a region attached to that unit. And then I have some points placed on the map. (Named Point 001 - 002.....)
Now the trigger: whenever i press Space (in my case) the trigger will run and will spawn a unit. But the unit needs to spawn at one point that is inside my attached region.
So is it possible to like scan the region for points and maybe get the coordinates? Or is there any other way to "find" an existing point??
Ty for help.
well you can create a unit at region (random point in region, center of region) etc.... that seems like what you are talking about.
but you may also be talking about to create a unit a a point in the region attached to antoher unit, but what if the end point youre wanting isnt insite that region, then to find the closest point????
Well, the region and the points is placed in a way that there will always be a point in the region.
But even if there isn't a point then if there were a function of some sort it should tell me that there isn't any point there? I want this because the created unit needs to be placed in a middle of a square (the position of the point).
Hope you understand.
well under 'conditions' there is under 'points' if 'point is in specified region' that sounds like that would work for what youre talking about. but you would have to make either a bunch of 'if' 'then' 'else' 'if' 'then' else' etc.... for each point to make it work, but this seems sloppy, though it would check if a point is in a region then... (create xunit at ypoint)
so in short the condition under 'points' 'if point is in region' (return boolean or 'true' or not) would work....
or use a switch function-
You could store all the points into an array and then do a foreach over the array until a point in the region is found, still a bit messy but would eliminate the need of a switch or a lot of If/Else statements(Just 1 would be needed).
@ezbeats: Go
Thanks, will try it.
Ty, thought i would need to do this. My problem is that I've got nearly 150 points :S
150 points? wtf??? thats a lot of points!! is this a risk style map or something????
@ezbeats: Go Im going to make a Bomberman game.
Edit: and in every "brick" I have a point
@ralme360: Go
You could even get all available regions of your map using "region RegionFromId(int lp_id)" and count the parameter from 0 to whatever. To determine whether a point is in a region you could use school trigonometry and "fixed DistanceBetweenPoints(point p1, point p2)" with your point and the center of the region, depending on the shape of your regions. :)
If you make your points into invisible units instead i guess you could just "check for units" in your attached region all the time.