HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Turn Based Movement

10-08-2006, 11:38 PM#1
Argo
I was wondering if this would be possible to make in WC3:

A turn based system for moving characters. I hate using the circles of power and having the user select them so I was wondering if you could use an ability on the unit that will have the AoE effect at mouse point thing with a line attached to it and the unit. Every so often (like 1 CM on the screen) it will set a variable to -1 and if the mouse is moved farther away it will be -2 on the variable till it’s maxed at -10. (The variable that is being subtracted from is a turn counter that gives you a max of 10 moves (moving a character, training units, upgrades etc. are all one move)). So how would this be done?


Zoom (requires log in)
10-09-2006, 09:59 AM#2
martix
From how I understand it I guess you'd have to make a grid system, which would be region madness. Or use coordinates. Or calculate moved distance. Or something! :)
10-09-2006, 10:39 AM#3
blu_da_noob
I guess you'd be looking at a pathing system to count the number of squares to move (and get the shortest path). Depth First Search (or A* variation) would be fastest, but wouldn't absolutely guanrantee shortest path (pretty likely though, unless you have lots of obstacles in random places), Breadth First Search would get you guanranteed shortest path, but would be more process-intensive.
10-09-2006, 04:05 PM#4
Vexorian
I fail to see how a grid system would be region madness, you could create the rects dynamically with a trigger and leave them in a matrix, the hard thing is making a matrix, blizz forgot to let us do that...
10-09-2006, 04:20 PM#5
martix
Well, erm you said it :) Hard to make the matrix, easier is placing the region, but enter and leave regions don't happen in the exact same place/time they are supposed to and you are bound to make some mistake in placing all of them on the map.
It would also need a makeshift coordinate system for referencing them.
10-09-2006, 04:44 PM#6
Vexorian
Quote:
easier is placing the region
You'd still need a matrix of regions
10-09-2006, 06:32 PM#7
Argo
is there a way to get the X and y coordinates of the selected unit and the mouse?
10-09-2006, 07:30 PM#8
Fireeye
Uhm, my idea would be a unit (very slow one) get the order to move, then you set the x and y of the triggering unit and another x and y value to the target point, check if it's in reach and when it is you move it to that point else you move the unit to it's original position back.
10-09-2006, 08:39 PM#9
Alevice
Quote:
Originally Posted by Argo
is there a way to get the X and y coordinates of the selected unit


Yep. IIRC, its in the real-type functions.

Quote:
Originally Posted by Argo
and the mouse?

Using trackables.
10-10-2006, 02:02 AM#10
Argo
Quote:
Originally Posted by Alevice
Yep. IIRC, its in the real-type functions.



Using trackables.

Ok i read about the trackables and in the link you gave me i seen nothing about getting the X and Y location of the mouse. (I'm not looking for the location of an object when mouse over).
10-10-2006, 02:07 AM#11
Naakaloh
The only way you can know the location of the mouse is to cover the field with trackables and have the fire mouse-over events.
10-10-2006, 02:21 AM#12
Argo
ok so say i get the mouse XY locations to work, how would i then find out how to avoid objects.
10-10-2006, 04:14 AM#13
Naakaloh
Then you'd need something to figure out a path like what blu said.
10-10-2006, 09:33 AM#14
martix
I don't think trackables will work for you, they cannot be destroyed or moved or changed, just created.
10-10-2006, 10:45 AM#15
Naakaloh
Why would they not work? Essentially he would have a grid of trackables, much like a grid of regions. Determining where the cursor is would be based on determining which trackable fired the event or which trigger fired, which is rather simple to do.

He has no need to ever change the trackable, just the way he deals with the event firing.

The only problem is it would be impractical to use in multiplayer since you cannot determine which cursor fires the event, unless of course, there's a method I'm unaware of.