Hi guys, i've been searching the forum for the solution of following problem:
I have a map with 4 control points (captureable) and teleporting areas in each base. so if a player owns the control point he can send a unit into the specific teleporting area to get to the distant point immediately. But therefore you have to send every single unit into the areas. and after teleporting they just stand there (removed commands after teleport). Here is my question:
is there a way to let the units automatically use the triggered teleport areas to move around the map more quickly without ordering them explicitly? every time you have to "pick up" those teleported units and give new movement orders. did i make myself clear or does my english confuse someone? ;)
Hmm... If someone could make a mover for something like this it would be awsome, but in the meantime it's doable with triggers. In theroy at least. Why theory? Because it will require to catch every "Unit receives Order Event".
Here's the idea.
Whenever a unit receives an order to move somewhere you compare the distance of the targeted point to the sum of the distance to the clostest teleporter and the distance from the teleporter to the target point. If the second is smaller you order the unit to move to the teleporter and after that to the target point. You can add orders to the unit, it will carry them out one after another.
how do i add a + or - in the if-structure? currently i am just able to use a comparison of 2 distances. do i have to use variables or how does it work? i'm not familiar with custom scripting at all :(
yes, thats what i need. but how can i use it? because the trigger is working quite fine for one area without the +, but i got 4 areas and withot a further definition of the distances, the triger doesnt work with all 4 areas active :(
i am sad to tell, that it is more tricky than i thought. since i got 4 teleporters in every base (4 destinations) the units run into one teleporter, then whe arrived they run back into base and want to use all other teleporters as well. so i have to compare a lot more than (a > b + c) but all of the possible teleporting routes :/ but i don't know if i am able to do so since you can only fill in one arithmetic function as far as i now. anyone has an idea?
Yeah, you are right. but that was not my problem. needed further dependencies and so on. finally the whole system works for player 1! :D it's so great! now i just need to copy and change some lines and get it into my 2on2 map, too.
Thank you all guys! My mod is really really close to beta release now. i love this site and all the people who really care for other mods and maps!
How long does your comparison have to go on for. Like you i need to compare multiple different portals (8 for me). Is there anyway to have the conditions look for like the shortest distance through a min function or somethings because otherwise i can only thing of comparing every possible route just to find the shortest. Its for a very large map 8 spawn map so it must be lag free. I get everything for the event and action and already have a working verison for just 1 gate, but 8 definitly complicates things.
save the type of order in custom value 0 on the unit
0 = attack order
1 = move order
save the x cord of the order in custom value 1
save the y cord of the order in custom value 2
have a trigger calculate the distance of the unit to the position of the point the order was issued at
then calculate the distance of the unit to all the portal and if the other end of those portals to the position the unit was issued a order to
if the portal distance is shorts order the units to the portal
once reaching the portal destination have the trigger issue the order that is stored in the custom values
this is is very do able but it could be rather complicated trying to figure out what portals are available then keeping track of the distance of all of them and then determining which is the shortest path.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
Sorry but thats not the issue here, having a trigger recognizing a move or attack command and then comparing two distances, 1 via normally movement and 1 via the portal movement, is easy.The issue is that even with a min function in conditons to find the shortest distance you can only enter two routes. Now you can use if/than/ else for actions but you then compare 36 possible routes in comparion with the original movement.
Sorry but thats not the issue here, having a trigger recognizing a move or attack command and then comparing two distances, 1 via normally movement and 1 via the portal movement, is easy.The issue is that even with a min function in conditons to find the shortest distance you can only enter two routes. Now you can use if/than/ else for actions but you then compare 36 possible routes in comparion with the original movement.
Its called you store the values of all the routes possible in an array ......
one array has a bool value for all portals each player would have thier own values so
playerPortalsActive[0-15][0-9]
so 0-15 is the players 0-9 is each portal this is assuming theres 10 possible portals for each player ....
then you have another array PathingDistCalc[0-10] where the default value is "9999" or what ever max pathing cost value is This is a temporary array that you calc every time a unit is issued an order....
index 10 would be the value of the distance with out using a portal
loop throug this array and assing it the distance of the unit to portal i and then get the distance of the end portal to the ordered point and add them together store the value in the array
after calculating all the distance and placing them into the array .... then you need to sort the array to find the minimum value .... then use that as the path the units are too take...
if you gonna shoot down my first post .... maybe you should have a better understanding of programming logic before doing so......
if you guys need
I can make an example for you but that would take some time.
Hi guys, i've been searching the forum for the solution of following problem: I have a map with 4 control points (captureable) and teleporting areas in each base. so if a player owns the control point he can send a unit into the specific teleporting area to get to the distant point immediately. But therefore you have to send every single unit into the areas. and after teleporting they just stand there (removed commands after teleport). Here is my question: is there a way to let the units automatically use the triggered teleport areas to move around the map more quickly without ordering them explicitly? every time you have to "pick up" those teleported units and give new movement orders. did i make myself clear or does my english confuse someone? ;)
Hmm... If someone could make a mover for something like this it would be awsome, but in the meantime it's doable with triggers. In theroy at least. Why theory? Because it will require to catch every "Unit receives Order Event".
Here's the idea. Whenever a unit receives an order to move somewhere you compare the distance of the targeted point to the sum of the distance to the clostest teleporter and the distance from the teleporter to the target point. If the second is smaller you order the unit to move to the teleporter and after that to the target point. You can add orders to the unit, it will carry them out one after another.
Pseudo Code.
And thats all. The unit will carry out the normal order after the teleport.
wow! very nice. i will try this one :) but i am afraid it will cause the game to lag a lot, won't it?
how do i add a + or - in the if-structure? currently i am just able to use a comparison of 2 distances. do i have to use variables or how does it work? i'm not familiar with custom scripting at all :(
I believe you are looking for something called Arithmetic. It will then allow you to do math inside the condition.
yes, thats what i need. but how can i use it? because the trigger is working quite fine for one area without the +, but i got 4 areas and withot a further definition of the distances, the triger doesnt work with all 4 areas active :(
if ( Distance to (Move Ability Target) > (Distance to (Teleporter Owned by Player) + Distance from (Teleporter Target) to (Move Ability Target))
Your going to want to click on the part after the > sign, and in the functions find "Arithmetic (Real)".
I can screenshot if you need a better guide.
would be very nice, i really don't get it :/
Edit: THX a lot! finally found it XD i must have been blind!
i am sad to tell, that it is more tricky than i thought. since i got 4 teleporters in every base (4 destinations) the units run into one teleporter, then whe arrived they run back into base and want to use all other teleporters as well. so i have to compare a lot more than (a > b + c) but all of the possible teleporting routes :/ but i don't know if i am able to do so since you can only fill in one arithmetic function as far as i now. anyone has an idea?
Actually you can use as many arithmetic functions as you want, in the same line.
Yeah, you are right. but that was not my problem. needed further dependencies and so on. finally the whole system works for player 1! :D it's so great! now i just need to copy and change some lines and get it into my 2on2 map, too. Thank you all guys! My mod is really really close to beta release now. i love this site and all the people who really care for other mods and maps!
Cheers!
Out of curiosity: Did you notice any more lag than usually?
i haven't tried it online yet. offline there was no lag against AI. Will report as soon as i have tested it with a friend online:)
works! no additional lag! :)
How long does your comparison have to go on for. Like you i need to compare multiple different portals (8 for me). Is there anyway to have the conditions look for like the shortest distance through a min function or somethings because otherwise i can only thing of comparing every possible route just to find the shortest. Its for a very large map 8 spawn map so it must be lag free. I get everything for the event and action and already have a working verison for just 1 gate, but 8 definitly complicates things.
Ok you can do something like this......
when a unit is issued an order ......
save the type of order in custom value 0 on the unit 0 = attack order 1 = move order
save the x cord of the order in custom value 1
save the y cord of the order in custom value 2
have a trigger calculate the distance of the unit to the position of the point the order was issued at
then calculate the distance of the unit to all the portal and if the other end of those portals to the position the unit was issued a order to
if the portal distance is shorts order the units to the portal
once reaching the portal destination have the trigger issue the order that is stored in the custom values
this is is very do able but it could be rather complicated trying to figure out what portals are available then keeping track of the distance of all of them and then determining which is the shortest path.
Sorry but thats not the issue here, having a trigger recognizing a move or attack command and then comparing two distances, 1 via normally movement and 1 via the portal movement, is easy.The issue is that even with a min function in conditons to find the shortest distance you can only enter two routes. Now you can use if/than/ else for actions but you then compare 36 possible routes in comparion with the original movement.
Its called you store the values of all the routes possible in an array ......
one array has a bool value for all portals each player would have thier own values so
playerPortalsActive[0-15][0-9]
so 0-15 is the players 0-9 is each portal this is assuming theres 10 possible portals for each player ....
then you have another array PathingDistCalc[0-10] where the default value is "9999" or what ever max pathing cost value is This is a temporary array that you calc every time a unit is issued an order....
index 10 would be the value of the distance with out using a portal
loop throug this array and assing it the distance of the unit to portal i and then get the distance of the end portal to the ordered point and add them together store the value in the array
after calculating all the distance and placing them into the array .... then you need to sort the array to find the minimum value .... then use that as the path the units are too take...
if you gonna shoot down my first post .... maybe you should have a better understanding of programming logic before doing so......
if you guys need
I can make an example for you but that would take some time.