I haven't seen any tutorials on how to prevent players from walling off (creating a wall of towers that ground units cant get past) in a tower defense so I thought I'd share the way I do it. Feel free to let me know if you find a better way to do it. For this to work, you will need to make sure your tower's footprint is something like "Footprint 1x1" NOT "Footprint 1x1 (Contour)," which is a mistake I originally made.
In the trigger editor I do this:
Event:
Any unit construction progress is Started
Actions:
if Pathing cost between Spawn Point and End Point == 65536
then
Unit - Kill (Triggering progress unit)
It's simple and I'll try it after school. But again I don't think its going to work :/
Also, anyone know how to disable smart pathing (so units will go as far as they can until they're blocked, not automatically know its blocked before they get there and take another way around)?
@ST4RKiLL3R:
@SouLCarveRR:
If you're interested at all in the technical side of it, 65536 is equivalent to 2^16, therefore it is the highest unsigned integer you can represent with 16 bits, or two bytes, (assuming you start counting from 1 instead of 0, which is a bit strange imo). A common programming practice is to set aside the highest possible value of a data type to represent "infinity," which is what blizzard seems to have done here.
Sorry, I'm a programmer irl, and I know this is probably way more detail than you ever wanted to know, but I thought you might be curious.
Actually I did make a remark about this a couple months ago while explaining my TD in my last TD tutorial vids. I guess, though, you can't really search video, as you can with text tutorials... I did pretty much the same thing too haha. Except because I had different paths, I had to check what region of the map the unit was in and then check it that way. That action will return 65536 if there is no path (for a unit of radius 0, keep that in mind).
As well, like he says, make sure to use the right footprint for your towers. Personally, I use 2x2 (Doodad) because it's perfectly square. Regular footprints (as he mentions too) are a bit rounded.
If you're interested at all in the technical side of it, 65536 is equivalent to 2^16, therefore it is the highest unsigned integer you can represent with 16 bits, or two bytes, (assuming you start counting from 1 instead of 0, which is a bit strange imo). A common programming practice is to set aside the highest possible value of a data type to represent "infinity," which is what blizzard seems to have done here.
Sorry, I'm a programmer irl, and I know this is probably way more detail than you ever wanted to know, but I thought you might be curious.
Actually thats exactly what I wanted to know.... Im a self taught programmer.
But I've had some addition questions regarding the returned value of the pathing cost functions.
What does the number actually represent. Cause I know it doesnt any anything to do with the actual distance value between two points.
Doesn't seem to work for me. I slightly modified it so that it's just
events
unit enters region
conditions
unit is attribute check = structure
actions
if then else
if pathing cost = 65536
then
kill triggering unit
display text message
else
<nothing>
Didn't seem to work. I used the region -> region one suggested in the op but it does not consider units so it wouldnt work would it? so I changed it to the unit -> point one and still nothing.
You guys can always just copy paste from my "onetwo's TD" which is on Bnet, and DL links are on the tutorial vids for it AND my tutorial posting here. I have an anti-block done there for a TD with several rows... just look at it and dissect :D (It actually cancels your building and refunds you if youre about to block).
You guys can always just copy paste from my "onetwo's TD" which is on Bnet, and DL links are on the tutorial vids for it AND my tutorial posting here. I have an anti-block done there for a TD with several rows... just look at it and dissect :D (It actually cancels your building and refunds you if youre about to block).
I'd love to just copy paste it brah, but the set-up of my map means your system wont work. Take a look:
X's are unit spawns
T's are transporters that teleport the units that move into them instantly to the other side.
Each red line represents the path the units will take from their spawn point to their end point, and they work both ways. The central lanes are shorter because they effectively skip most of the map by teleporting. They all follow a linear path and should never take the long way around the terrain because someone blocked. So you see why I am in need of a good anti-walling solution...
Any ideas similar to yours you can think of? This is pretty much the last un-added general feature in my defense map (of course its not done being tuned but otherwise most things, except for waves past level 10, are there.
From your description your giving I cant really tell what your problem is.....
You dont want your units to follow the maze? could you possibly put structures on your map and draw lines on it to show us where they go vs where you would perfer they go.
I have my own td with more complicated unit pathing then this. But I just cant tell what your trying to say the units are doing that you dont want them to do?
Are you spose to be able to maze or not?
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
The center spawns look like they're flying thru space. That can't be walled in anyways. xD
I'd have to say this SHOULD work for your map. If anything, the questions Soulcarver asked are very important to "how" you should go about implementing this feature. You can use "OR" to string a bunch of conditions together, so if blockage occurs in ANY lanes, it'll prevent build and refund.
From your description your giving I cant really tell what your problem is.....
You dont want your units to follow the maze? could you possibly put structures on your map and draw lines on it to show us where they go vs where you would perfer they go.
I have my own td with more complicated unit pathing then this. But I just cant tell what your trying to say the units are doing that you dont want them to do?
Are you spose to be able to maze or not?
1. You are supposed to maze
2. The lines are where they need to go, as well as where I want them to go
3. They cannot take the long way around the map to their destination, each red line is the path they must take.
To prevent them from going an alternate route I must 100% stop walling from happening. The teleporters in the center (notice how its all space there) teleport the units across to the other side. If you don't get it go to my other thread on this matter, in it there is a stripped down version of my map you can test and see why I need this so badly. It's in this section (it's called 'Difficult Antiblocking Solution Needed :(')
If you follow from my image, if you walled off on one end (use the cyan line as an example) the monsters would have to follow the yellow or purple line, depending on where they were sent to, which I think is what Star is trying to prevent. In order to activate your anti walling trigger, the player would need to make the cyan wall AND the blue wall.
Currently Implementing In my TD unfortunately Im checking so many paths that Im not sure if it will run into complications .... since each player has thier own path and its possible a different player can block another players path.
NOTES:
Dont use triggering unit to destroy the tower use ... triggering progress unit
In the trigger editor I do this:
Event:
Any unit construction progress is Started
Actions:
if Pathing cost between Spawn Point and End Point == 65536
then
Unit - Kill (Triggering progress unit)
why specifically are you useing the value 65536? to determine a unpathable path
@SouLCarveRR: Go
It's the return value if a units path to a location is blocked.
@Twinmold20: Go
It's simple and I'll try it after school. But again I don't think its going to work :/
Also, anyone know how to disable smart pathing (so units will go as far as they can until they're blocked, not automatically know its blocked before they get there and take another way around)?
Sorry, I'm a programmer irl, and I know this is probably way more detail than you ever wanted to know, but I thought you might be curious.
Actually I did make a remark about this a couple months ago while explaining my TD in my last TD tutorial vids. I guess, though, you can't really search video, as you can with text tutorials... I did pretty much the same thing too haha. Except because I had different paths, I had to check what region of the map the unit was in and then check it that way. That action will return 65536 if there is no path (for a unit of radius 0, keep that in mind).
As well, like he says, make sure to use the right footprint for your towers. Personally, I use 2x2 (Doodad) because it's perfectly square. Regular footprints (as he mentions too) are a bit rounded.
Actually thats exactly what I wanted to know.... Im a self taught programmer.
But I've had some addition questions regarding the returned value of the pathing cost functions.
@SouLCarveRR: Go
Doesn't seem to work for me. I slightly modified it so that it's just
events
unit enters region
conditions
unit is attribute check = structure
actions
if then else
if pathing cost = 65536
then
kill triggering unit
display text message
else
<nothing>
Didn't seem to work. I used the region -> region one suggested in the op but it does not consider units so it wouldnt work would it? so I changed it to the unit -> point one and still nothing.
@SouLCarveRR: Go
Based on the naming scheme, my blind guess would be the pathing distance a unit would have to take to cross between two points.
You could easily just run a test that keeps outputting "pathing cost" as you fill up a gap with towers, if you're determined to find out.
@onisagi: Go
I have tested it
@SouLCarveRR: Go Come to any conclusions from your testing?
@OneTwoSC: Go Would definitely suck without refunding resource.
I'd love to just copy paste it brah, but the set-up of my map means your system wont work. Take a look:
X's are unit spawns
T's are transporters that teleport the units that move into them instantly to the other side.
Each red line represents the path the units will take from their spawn point to their end point, and they work both ways. The central lanes are shorter because they effectively skip most of the map by teleporting. They all follow a linear path and should never take the long way around the terrain because someone blocked. So you see why I am in need of a good anti-walling solution...
Any ideas similar to yours you can think of? This is pretty much the last un-added general feature in my defense map (of course its not done being tuned but otherwise most things, except for waves past level 10, are there.
@ST4RKiLL3R: Go
From your description your giving I cant really tell what your problem is.....
You dont want your units to follow the maze? could you possibly put structures on your map and draw lines on it to show us where they go vs where you would perfer they go.
I have my own td with more complicated unit pathing then this. But I just cant tell what your trying to say the units are doing that you dont want them to do?
Are you spose to be able to maze or not?
@SouLCarveRR: Go
The center spawns look like they're flying thru space. That can't be walled in anyways. xD
I'd have to say this SHOULD work for your map. If anything, the questions Soulcarver asked are very important to "how" you should go about implementing this feature. You can use "OR" to string a bunch of conditions together, so if blockage occurs in ANY lanes, it'll prevent build and refund.
Hope you're decent at logic programming.
1. You are supposed to maze
2. The lines are where they need to go, as well as where I want them to go
3. They cannot take the long way around the map to their destination, each red line is the path they must take.
To prevent them from going an alternate route I must 100% stop walling from happening. The teleporters in the center (notice how its all space there) teleport the units across to the other side. If you don't get it go to my other thread on this matter, in it there is a stripped down version of my map you can test and see why I need this so badly. It's in this section (it's called 'Difficult Antiblocking Solution Needed :(')
@onisagi: Go
If you follow from my image, if you walled off on one end (use the cyan line as an example) the monsters would have to follow the yellow or purple line, depending on where they were sent to, which I think is what Star is trying to prevent. In order to activate your anti walling trigger, the player would need to make the cyan wall AND the blue wall.
Currently Implementing In my TD unfortunately Im checking so many paths that Im not sure if it will run into complications .... since each player has thier own path and its possible a different player can block another players path.
NOTES:
Well it works like a charm.