I'm fairly new to the Map editor and I'm really struggling in creating something iv'e only seen in one game, Cruiser Command.
In this game the map is an outer space map and two battlecruisers fight against each other with players running the ship. My question is related to the map.
When your moving your battlecruiser and you reach the end of the map, it doesn't stop..... it wrap-around to the opposite side of the map and continues moving forward. similar to pac-man when you pop from one side to the other.
I would really like some help in figuring this out.
If I had to emulate this behavior, I'd use pre-place regions on the game map:
The basic idea is when a unit enters RIGHT, TOP, BOTTOM, or LEFT, simply move that unit to the opposite region (RIGHT goes to LEFT). With the added depth that you need an extra inside layer cuz moving it directly into a triggering region would move it back and forth forever (RIGHT->LEFT->RIGHT->LEFT...), so you need to move it just before the opposite region instead. So, for example, if a unit enters RIGHT, move it to "from right", which is just outside the left bounds.
If you want to be even more accurate it would be better just to use one region at each edge and then use the units custom value as a boolean to check if it just came from another region.
I would be more impressive if you wrote a trigger to reroute units to take the shortest path including if its going to the edge of the map. I had to do something similar when i recreated the warpgates from warcraft.
So I have the map set up and the regions are working but now I want to make it more accurate like you were insisting, so I was think about how to store the data from one region to another. I'm assuming it would be based on height and width. for example, making a variable for the Left-region height from 1-10 or 1-20 depending on the size of the map, and then reading at what position/height of the region did the unit enter and move that unit to the opposite region with the similar height.
I don't know if that's how it would work, and if it is how would I approach making it read what value the unit is on in the region?
It depends on exactly how accurate you want to be and how exactly you move the units from one end to another. What i was talking about is soulzek example has two region on each edge to prevent an endless loop as one unit enters one region it moves it to another but that in turn activates it again and just sends it back and so on. The issue is you need to distinquish units that are entering on their own or by trigger control. You actually only need half the regions as before to do it properly.
Now for movement i would just run a switch to check which region was activated and then move the unit to the max or min of the x or y coordinate. ex if the units moves to the top just change the y value of the units position to equal the max map size or just under.
Back to the accuracy part you'll want to use the interger value of the units custom value (if you know what that is) as a boolean. Just have it put to 1 as it enters any region, have the regions check and only work is that same custom value is 0, and put the value back to 0 when it leaves a region (run a while loop instead of another trigger if you want).
Hello,
I'm fairly new to the Map editor and I'm really struggling in creating something iv'e only seen in one game, Cruiser Command. In this game the map is an outer space map and two battlecruisers fight against each other with players running the ship. My question is related to the map. When your moving your battlecruiser and you reach the end of the map, it doesn't stop..... it wrap-around to the opposite side of the map and continues moving forward. similar to pac-man when you pop from one side to the other.
I would really like some help in figuring this out.
Thanks,
If I had to emulate this behavior, I'd use pre-place regions on the game map:
The basic idea is when a unit enters RIGHT, TOP, BOTTOM, or LEFT, simply move that unit to the opposite region (RIGHT goes to LEFT). With the added depth that you need an extra inside layer cuz moving it directly into a triggering region would move it back and forth forever (RIGHT->LEFT->RIGHT->LEFT...), so you need to move it just before the opposite region instead. So, for example, if a unit enters RIGHT, move it to "from right", which is just outside the left bounds.
Your Awesome, and Quick with the response. I really appreciate it.
Thanks a-lot!
I just became a member this site is awesome.
@soulzek: Go
If you want to be even more accurate it would be better just to use one region at each edge and then use the units custom value as a boolean to check if it just came from another region.
I would be more impressive if you wrote a trigger to reroute units to take the shortest path including if its going to the edge of the map. I had to do something similar when i recreated the warpgates from warcraft.
Thanks, i'll make sure to try both and see which give's better results. If i face any problems i'll make sure to post here thanks allot.
@hobbidude: Go
So I have the map set up and the regions are working but now I want to make it more accurate like you were insisting, so I was think about how to store the data from one region to another. I'm assuming it would be based on height and width. for example, making a variable for the Left-region height from 1-10 or 1-20 depending on the size of the map, and then reading at what position/height of the region did the unit enter and move that unit to the opposite region with the similar height.
I don't know if that's how it would work, and if it is how would I approach making it read what value the unit is on in the region?
Thanks for all the help.
It depends on exactly how accurate you want to be and how exactly you move the units from one end to another. What i was talking about is soulzek example has two region on each edge to prevent an endless loop as one unit enters one region it moves it to another but that in turn activates it again and just sends it back and so on. The issue is you need to distinquish units that are entering on their own or by trigger control. You actually only need half the regions as before to do it properly.
Now for movement i would just run a switch to check which region was activated and then move the unit to the max or min of the x or y coordinate. ex if the units moves to the top just change the y value of the units position to equal the max map size or just under.
Back to the accuracy part you'll want to use the interger value of the units custom value (if you know what that is) as a boolean. Just have it put to 1 as it enters any region, have the regions check and only work is that same custom value is 0, and put the value back to 0 when it leaves a region (run a while loop instead of another trigger if you want).