TD Unit path & blocking

Jokker

Member
Reaction score
16
Hello!

I am a fellow Starcraft 2 gamer. I've worked on maps in Warcraft III editor. Recently started trying out Starcraft 2 map editor, as I can't keep my hands off such tools, if I'm provided with one.. : D Starcraft 2 Editor is surely more complex, but I enjoy the possibilities it offers.

I've started making a TD with a fun twist. I'm pretty far in with the basic logic behind my custom map, the unit-making and balancing will be the last of my problems.

I cannot wrap my head around one thing though:

When my creep wave starts, how can I detect, that the creeps don't have a blocked pathway? (It is possible to maze in this TD...)
Also, how can I make it so that the builder won't be able to block the path with buildings (towers, walls, etc.)?



Many thanks & all the best,
Jokker
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
you could go the tower line wars route, create a unit that is invulnerable with an exploding skill... when it stops kaboom (if its not in the ending region)
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
There's a pathing function that returns the pathing cost between two points. If it returns -1, it means there's no path. Use this in some smart way to find out when the path is blocked. Maybe a trigger that triggers when a building is started that checks if the pathing in that lane from start to finish is -1 and in that case destroy the building.
 

Jokker

Member
Reaction score
16
Thank you both for your answers! GFreak45, that's a funny way to do it : D Would work, but would also be a little annoying for the players I guess : D I like your alternative thinking though!

And Siretu, this solves my problem. Thanks!
 

Jokker

Member
Reaction score
16
For the information of others, this pathing cost returns 65536 for me, not -1 .. I tested it many times, it seems to show this exact number any time the way is blocked.

I also tried to maze a little with distance replies from the map. It grows as I maze, and as i block it - BOOM - 65536. It's okay though, coz you would never get a distance like that on a map : D

So I made a trigger that activates if any unit creates a unit. It then checks the distance, and if it is higher than 65000, it kills the created unit. I will update it though, that it would cancel the build with a full refund and a hint that the road is blocked.

Thanks again, Siretu!
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Ah, as I was looking around for a solution I found people reporting that it would return 65536 and some that said it returned -1. I guess Blizzard might've changed it somewhere along the line.

Good thing it works for you. I think an anti-blocking system as the one you're about to do will be much better. I dislike having a kobold(Line tower wars) running through my maze killing half of it if I accidentally blocked the maze.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i thought it was hillarious lol... i would watch people lose from that and go HA! U Lost! :thup:
funny thing is, it has never ever happened to me, even in my first games playing it, i just dont try to block or allow blocking mistakes when i maze :/
 

Jokker

Member
Reaction score
16
Just posting this to help anyone using the same method as me Stop reading, if you are not interested in this trigger and it's addons : )

It checks path blocking for "Unit - create unit" trigger as well!
I want to point out, that this trigger of mine (look above) will actually check the path if any unit is created. This means allso when a trigger creates a unit. In my map i use the ability that drops down MULEs, but it drops blocking walls (2x2 doodad with supply depot skin). It still checks each drop for bath plocking and will cancel the drop if path blocking occurs. I hope it helps anyone, that wants to use the same trigger in any way : )

Refunding made easy
Now I use the same trigger to check who that created unit belonged to, it will then take and set a variable for that unit cost and will give it to the owning (of created unit) player. Kills the unit, then displays "path blocked" for 2 seconds in red. Now, again, if it checks trigger created units (for neutral player), then make sure, that it gives the money to owning player, unless you want any path blocking to be refunded to player one : D
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
I think this is something more people might need in the future so thank you for posting the solution. If you have the time, I would appreciate if you showed the trigger as well. Go into the trigger editor and select the entire trigger(right click > select all) and then copy it as text(ctrl+shift+c) and copy it into a post here. Put WC3 tags around them like this:

[WC3 ]
...
triggers
...
[/WC3 ]

(but without the spaces)
 

Jokker

Member
Reaction score
16
Be reminded that this has to be done to each checkpoint (this one is Start to 1, next one would be 1 to 2.. etc)

Trigger:
  • Blocktest East Start-1
    • Events
      • Unit - Any Unit creates a unit with ability Any or behavior No Game Link
    • Local Variables
      • Created Unit = Any <Game Link - Unit>
      • Distance = 0 <Integer>
    • Conditions
    • Actions
      • Variable - Set Created Unit = (Unit type of (Created unit))
      • Variable - Set Distance = (Pathing cost between StartEast and E1)
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • Distance > 65000
        • Then
          • Text Tag - Create a text tag with the text "Path blocked!" for (All players), using a font size of 24, at (Position of (Created unit)) and height offset 1.0, initially Visible, and fog of war enforcement set to False
          • Text Tag - Set Text color(s) for (Last created text tag) to Red
          • Player - Modify player (Owner of (Created unit)) Minerals: Add (Minerals cost of Created Unit)
          • Unit - Kill (Created unit)
          • General - Wait 2.0 Game Time seconds
          • Text Tag - Destroy (Last created text tag)
        • Else
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top