a "H" is indeed a nice problem, but isn't it a problem with your way to?
It's getting constructive, going to think about. There shoudl be a way to combine both ways.
Maybe just create the 56 units and have a trigger create the uservalues. In the choosen maps. All triggers should only do something after the maps have been selected, mine too. I'd like to reduce the amount the map creator hast to do himself after creating the lane.
For my way you have to initialise only these paths you will need in this games. So only the amount of players you have.
no you have to initialize all 400 values at least once. it doesn't matter which maps are selected or how much players are playing. by initialize I mean store the values in any kind of trigger.
Maybe you write them all down, but you don't have to save em all. Just divide the set uservalue into functions, one for each map. And the call them when a player chooses a map.
a "H" is indeed a nice problem, but isn't it a problem with your way to?
Nope since I would randomize the path in one single time. So I could always check: Next unit != current unit. With rects you would have to save that somehow.
Just an example how I would do it (wip).
////Custom Value index 0 says how many possible paths there are. -1 means is an end unit.////Missing: Back Walk , More Reach TriggersconstintMAX_PLAYERS=12;constfixedREACH_RANGE=0.5;structPathSystem{unitgroupstarters;intplayer;triggerreached;};PathSystem[MAX_PLAYERS]Paths;voidPSUnitReachedTargetOfPlayer1(){//Create for all players ( makros would be cool :D )}voidInitPathSystem(){inti=1;Paths[i].starters=UnitGroupEmpty();Paths[i].player=i;Paths[i].reached=TriggerCreate("PSUnitReachedTargetOfPlayer"+IntToString(i));}voidPSCreateStarter(intplayer,intid){UnitGroupAdd(Paths[player].starters,UnitFromId(id));UnitSetCustomValue(UnitFromId(id),0,0.00);}voidPSCreateEnd(intplayer,intid){TriggerAddEventUnitRange(Paths[player].reached,null,UnitFromId(id),REACH_RANGE,true);UnitSetCustomValue(UnitFromId(id),-1,0.00);}voidPSAddNewDirection(intplayer,intcasterID,inttargetID){unitu=UnitFromId(casterID);UnitSetCustomValue(u,0,UnitGetCustomValue(u,0)+1);UnitSetCustomValue(u,UnitGetCustomValue(u,0),IntToFixed(targetID));}boolPSApplyOnUnit(intplayer,unitcreep){intcount=UnitGroupCount(Paths[player].starters,c_unitCountAll);fixedr;inti;intrandom;intnext;unitu;if(count<=0){returnfalse;//No starting point}u=UnitGroupRandomUnit(Paths[player].starters,c_unitCountAll);UnitSetPosition(creep,UnitGetPosition(u),false);while(1==0){r=UnitGetCustomValue(u,0);i=FixedToInt(r);if(i=0){returnfalse;//Path not finished.}random=RandomInt(1,i);next=UnitGetCustomValue(u,random);u=UnitFromId(next);UnitIssueOrder(creep,"move",c_orderQueueAddToEnd);if(i=-1){//exitreturntrue;}}}
Yea try and stick to the gui, reason for this is. I want people new to the editor and no programming understand to be able to follow what your doing. Makes it hard if you do it in galaxy.
I may need to clarify, but from each starting point there will be however number of routes to the finish but they will be SET. they can't get halfway through the track and randomly choose which direction to take. cause like the H problem, this could be bad.
If someone starts at starting point a and has a choice of getting to finish b or c. there will be a set path for them to take to that destination. Does that clear it up, I may get an image for you.
this terrain for example, has 5 starting points but 1 finish, so it has 5 routes. all the maps will have planned routes, and not ones that can be randomized during the creeps movement towards the exit
it is an easy option, but i don't like the idea of creating 5 arrays with 30 fields each for every map. the are some maps, which do need only on point per path
So will the path be always the same for every time you play this game? ( on the picture start 2 will always take the green path? )
Galaxy pwns GUI. ( was the same for wc3 ).
Btw. if there around 30 "maps" with 2 paths each. And every path has around 12 nodes you get 30 * 2 * 12 = 720 values you have to write in there, with GUI. HF clicking.
Btw. if there around 30 "maps" with 2 paths each. And every path has around 12 nodes you get 30 * 2 * 12 = 720 values you have to write in there, with GUI. HF clicking.
yes, feel free to test it, it should work with every possible track. you just have to init all the values. just ask if you have question how to do this, i think it should be clear
one thing left is a proper despawn system, espacially if the spawn and despawn points are at the same point.
edit: add a fresh spawned behavior to every unit. duration 3 sec nad have the despawn trigger check for it
a "H" is indeed a nice problem, but isn't it a problem with your way to?
It's getting constructive, going to think about. There shoudl be a way to combine both ways.
Maybe just create the 56 units and have a trigger create the uservalues. In the choosen maps. All triggers should only do something after the maps have been selected, mine too. I'd like to reduce the amount the map creator hast to do himself after creating the lane.
no you have to initialize all 400 values at least once. it doesn't matter which maps are selected or how much players are playing. by initialize I mean store the values in any kind of trigger.
Maybe you write them all down, but you don't have to save em all. Just divide the set uservalue into functions, one for each map. And the call them when a player chooses a map.
a "H" is indeed a nice problem, but isn't it a problem with your way to? Nope since I would randomize the path in one single time. So I could always check: Next unit != current unit. With rects you would have to save that somehow.
Just an example how I would do it (wip).
do an working example for the existing maps I used :)
I don't get that galaxy code. like to see it in action
@EndlessDreamer: Go
Yea try and stick to the gui, reason for this is. I want people new to the editor and no programming understand to be able to follow what your doing. Makes it hard if you do it in galaxy.
@b0ne123: Go
I may need to clarify, but from each starting point there will be however number of routes to the finish but they will be SET. they can't get halfway through the track and randomly choose which direction to take. cause like the H problem, this could be bad.
If someone starts at starting point a and has a choice of getting to finish b or c. there will be a set path for them to take to that destination. Does that clear it up, I may get an image for you.
this terrain for example, has 5 starting points but 1 finish, so it has 5 routes. all the maps will have planned routes, and not ones that can be randomized during the creeps movement towards the exit
ah okay. these are new requirements, going to think about a way to realize this
@b0ne123: Go
Would storing the paths in an array not be an option? yes it may involve multiple points?
it is an easy option, but i don't like the idea of creating 5 arrays with 30 fields each for every map. the are some maps, which do need only on point per path
@b0ne123: Go
One array?
first array (may number)
second array (number of paths)
third array (points for that path)
if there is a more technical solution I'm interested :)
I would love to do some kind of automatic pathing.
but yeah, a separate path array would be better, have to wait until I'm back home
So will the path be always the same for every time you play this game? ( on the picture start 2 will always take the green path? )
Galaxy pwns GUI. ( was the same for wc3 ).
Btw. if there around 30 "maps" with 2 paths each. And every path has around 12 nodes you get 30 * 2 * 12 = 720 values you have to write in there, with GUI. HF clicking.
this is why I would like something self-creating
@EndlessDreamer: Go
with GUI, hot keys and copy pasting is extremely efficient once you get used to it :)
I don't mind doing setting up the array in a trigger, if you want to just worry about the spawning and sending
one path per spawn point and random spawn points?
edit: if you want 5 paths with one starting point, initialize the start point 5 times in the init map trigger
So this spawning system will work you reckon? :) has everything in it to work?
yes, feel free to test it, it should work with every possible track. you just have to init all the values. just ask if you have question how to do this, i think it should be clear
one thing left is a proper despawn system, espacially if the spawn and despawn points are at the same point.
edit: add a fresh spawned behavior to every unit. duration 3 sec nad have the despawn trigger check for it