| 09-26-2006, 08:02 PM | #1 |
Like the topic. I'm building a racing map and have no idea how to check the position of the racers in the map. I have looked in the Blizzard's Grandprix map and found all triggers used on checking positions were done by JASS It will be really hard for me to do it in JASS coz I know NOTHING about it. So please give me an instruction in GUI if possible... if you tell me how to do it in JASS, I will get upset and come up again with the same question = =. And one more thing, my map is not a sqaure-look minimap racing game, so I can't use X and Y to check the position. Right now what I'm using is " A damn lot of regions " put rapidly on the map to check for the 1st racer who passed the region first to be in the 1st position, but I can't really check all the other positions because I need to turn off the trigger once the 1st racer has passed it to prevent the running-back. So right now I have no idea how to check all the other positions. Is there anyway out better than using tons of regions? ( I have 61 regions + 61 triggers currently just for checking position ) becoz it's making my map very slow to load it. |
| 09-26-2006, 10:07 PM | #2 |
I personally think that learning JASS then using it is easier than trying to do it iin GUI and will take less time. But well the basics are: Have a lot of checkpoints, checkpoints are ordered among the track. You can easily abstract a checkpoint as a unit. You should detect when a car gets in range of a checkpoint, that's easy using the range event although in GUI you would need a trigger per checkpoint, you can also do the slower alternative which is constantly picking units around each checkpoint. Now you have the checkpoints in an ascending order, cars must simply get close to checkpoint 1 then get close to checkpoint, etc until the final checkpoint, if your track is going to be acycle simply make it so that the next checkpoint to checkpoint #N is 1 and the previous checkpoint to checkpoint #1 is N. For example to get a player's position you just take the checkpoint which has a minimum distance to the unit. The comparission between positions of 2 cars would be if car A's closest checkpoint is higher than B then A is winning, if both are closest to the same question then the one with the smallest distance is winning. By this it is also easy to detect when a car is going backwards. |
| 09-26-2006, 11:16 PM | #3 |
This isn't a simple question even in JASS. you have to parameterize the path one way or another and with any complex path that's going to be pure pain if you don't have a good abstraction. but using a lot of regions will work fine. You just need an oriented measure for the ordering. A natural choice for that is distance from the line that bisects the angle formed as you go from the current checkpoint to the next one and the previous one. you can find formulas for distance of a point to a line on mathworld or wc3jass. This is only useful for sorting people who are between the same two checkpoints. You'll have to first sort them by which checkpoints they've passed. Hm, I guess you don't need to bisect the angle if you already sort them out into groups between checkpoints. just use the line that is perpendicular to the line that goes from the checkpoint we are arriving at to the checkpoint behind us, that goes through the checkpoint we are arriving at. |
| 09-27-2006, 01:58 PM | #4 |
Yes. What I have done is using GUI to create 1 trigger for each 1 region, and that made me sick... Using distance is a really interesting way to do this since I have already created the regions. I will try it out and come back again to tell if it works. Thank you very much! |
| 09-27-2006, 04:02 PM | #5 |
SRY for double posting but... How do I check " what unit is in the closest distance to unit. " I spent 1 hour looking for comparison to check this problem out and found nothing... Anybody can give me a clue? Thank you. |
| 09-27-2006, 04:51 PM | #6 |
You pick all units in a unit-group and then you check the distance between the picked unit and the center of the rect. Btw. you find it under "Real". |
