Clear Pathing when Building blocks.

xAnaMorphine

Active Member
Reaction score
43
Hello guys,

My friend and I are trying to create a Tower Defense. Now a Problem occured since when you build a straight line of towers, the creeps can't walk through, thus resulting in winning the game since not a single creep can pass. My Idea now was to create a trigger which checks wether a creep is able to pass or not.
For example:

------------------------------------------x

x stands for the empty spot, creeps are able to pass

-------------------------------------------

Player build a Building on x, the building will be killed and the gold will be refund.

Is it possible to create something like this?
 

Bloodydood

New Member
Reaction score
14
Would the creeps simply stop? If so, run a repetitive check, (Every 0.1 seconds event). Then pick every unit in Region <gen>, (Or playable map area), owned by neutral hostile. If picked unit current order is equal to stop, then order picked unit to attack-move to Destination Point.

Once the path is made by force, have another trigger with event Unit - A unit Dies. In conditions just specify that it's a tower from a player. If the conditions are true, then pick every unit in same region as triggering unit and order picked unit to move to Destination Point. This should stop the creeps from inflicting further damage.

If the towers made a wall that's more than 1 tower thick, the process should repeat itself.

I hope you can read that.
 

xAnaMorphine

Active Member
Reaction score
43
Well, I see your point but I was thinking about something diffrent. Imagine the Creeps don't have an attack, what now?
 

Rushhour

New Member
Reaction score
46
I have a suggestion: Might not work for your mazing TD but maybe you can change the basic idea for your needs.
This works for a "straight" TD like in Line tower wars or something like that.
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
-->when you have a wall at the left and right side. Then you simply need to check the x-values of the towers in a "chain" and if this chain reaches both walls.
JASS:
scope Antiblock initializer AntiblockBase
globals
private group MazeChain=CreateGroup()
private boolean bool
private real min
private real max
private group LoopG=CreateGroup()
endglobals

private function DistanceTest takes nothing returns boolean
local unit f=GetFilterUnit()
local real x1=GetUnitX(GetEnumUnit())
local real y1=GetUnitY(GetEnumUnit())
local real x2=GetUnitX(f)
local real y2=GetUnitY(f)
local real r=SquareRoot((x2 - x1) * (x2 - x1) +  (y2 - y1) *  (y2 - y1))
 if GetOwningPlayer(f)==GetOwningPlayer(GetTriggerUnit()) and IsUnitInGroup(f, MazeChain) == false and (r &lt;255 or r ==271.534) then
    call GroupAddUnit(  MazeChain,f)
    if ( x2 &lt; min ) then
        set min = x2
    endif
    if ( x2 &gt; max ) then
        set max = x2
    endif
    set bool = true
 endif
set f=null

    return false
endfunction

private function EnumNeighbours takes nothing returns nothing
    call GroupEnumUnitsOfType(LoopG,UnitId2String(&#039;o00A&#039;),Condition(function DistanceTest))
endfunction

private function TestMazeChain takes nothing returns nothing
    call GroupClear(MazeChain)
    call GroupAddUnit( MazeChain,GetTriggerUnit() )
    set min = GetUnitX(GetTriggerUnit())
    set max = min
    loop
            set bool = false
            call ForGroup( MazeChain, function EnumNeighbours )
        exitwhen bool==false
    endloop
        if (max - min ) &gt;= 860.00 then
            call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl&quot;,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit())))
            call RemoveUnit( GetTriggerUnit() )
        endif
endfunction

private function IsMazingTower takes nothing returns boolean
   return GetUnitTypeId(GetConstructingStructure()) == &#039;o00A&#039;
endfunction

private function AntiblockBase takes nothing returns nothing
local trigger t=CreateTrigger()
    call TriggerRegisterPlayerUnitEvent(t, Player(6), EVENT_PLAYER_UNIT_CONSTRUCT_START, null)
    call TriggerRegisterPlayerUnitEvent(t, Player(7), EVENT_PLAYER_UNIT_CONSTRUCT_START, null)
    call TriggerAddCondition( t, Condition( function IsMazingTower ) )
    call TriggerAddAction( t, function TestMazeChain )
endfunction
endscope

If you know some jass then you will understand this, if not feel free to ask. I will add some comments later on (sorry no time atm^^) and set some more globals to make editing easier.
This fits for my map and the pathing map of my mazing tower. It checks only for one tower at the moment, you will probably have different towers. Could edit this if you told me what you need in detail (if pathing map= arcane tower pathing map, ...)
 

xAnaMorphine

Active Member
Reaction score
43
Yes it is exactly what I need, can't test at the moment because I dont have JNGP because of Kaspersky :(

Off-Topic: Schreib es mir per private message oder so ^.^, so viel versteh ich auch nicht von jass ^^
 

Azlier

Old World Ghost
Reaction score
461
That X check thing won't exactly work. What if my wall looks like this?

Code:
X           X
 X         X
  X       X
   X     X
    X   X
     XXX
 

Rushhour

New Member
Reaction score
46
yes I know Azlier, but since most TDs have a symmetrical build with straight walls this could be used. Easiest would be ofc to add an attack to the creeps but sometimes you can't because of your map style.
 

xAnaMorphine

Active Member
Reaction score
43
rush, take a look at this example:

24o9d3b.jpg
 

xAnaMorphine

Active Member
Reaction score
43
I have a suggestion: Might not work for your mazing TD but maybe you can change the basic idea for your needs.
This works for a "straight" TD like in Line tower wars or something like that.
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
-->when you have a wall at the left and right side. Then you simply need to check the x-values of the towers in a "chain" and if this chain reaches both walls.
JASS:

scope Antiblock initializer AntiblockBase
globals
private group MazeChain=CreateGroup()
private boolean bool
private real min
private real max
private group LoopG=CreateGroup()
endglobals

private function DistanceTest takes nothing returns boolean
local unit f=GetFilterUnit()
local real x1=GetUnitX(GetEnumUnit())
local real y1=GetUnitY(GetEnumUnit())
local real x2=GetUnitX(f)
local real y2=GetUnitY(f)
local real r=SquareRoot((x2 - x1) * (x2 - x1) +  (y2 - y1) *  (y2 - y1))
 if GetOwningPlayer(f)==GetOwningPlayer(GetTriggerUnit()) and IsUnitInGroup(f, MazeChain) == false and (r &lt;255 or r ==271.534) then
    call GroupAddUnit(  MazeChain,f)
    if ( x2 &lt; min ) then
        set min = x2
    endif
    if ( x2 &gt; max ) then
        set max = x2
    endif
    set bool = true
 endif
set f=null

    return false
endfunction

private function EnumNeighbours takes nothing returns nothing
    call GroupEnumUnitsOfType(LoopG,UnitId2String(&#039;o00A&#039;),Condition(function DistanceTest))
endfunction

private function TestMazeChain takes nothing returns nothing
    call GroupClear(MazeChain)
    call GroupAddUnit( MazeChain,GetTriggerUnit() )
    set min = GetUnitX(GetTriggerUnit())
    set max = min
    loop
            set bool = false
            call ForGroup( MazeChain, function EnumNeighbours )
        exitwhen bool==false
    endloop
        if (max - min ) &gt;= 860.00 then
            call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl&quot;,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit())))
            call RemoveUnit( GetTriggerUnit() )
        endif
endfunction

private function IsMazingTower takes nothing returns boolean
   return GetUnitTypeId(GetConstructingStructure()) == &#039;o00A&#039;
endfunction

private function AntiblockBase takes nothing returns nothing
local trigger t=CreateTrigger()
    call TriggerRegisterPlayerUnitEvent(t, Player(6), EVENT_PLAYER_UNIT_CONSTRUCT_START, null)
    call TriggerRegisterPlayerUnitEvent(t, Player(7), EVENT_PLAYER_UNIT_CONSTRUCT_START, null)
    call TriggerAddCondition( t, Condition( function IsMazingTower ) )
    call TriggerAddAction( t, function TestMazeChain )
endfunction
endscope

If you know some jass then you will understand this, if not feel free to ask. I will add some comments later on (sorry no time atm^^) and set some more globals to make editing easier.
This fits for my map and the pathing map of my mazing tower. It checks only for one tower at the moment, you will probably have different towers. Could edit this if you told me what you need in detail (if pathing map= arcane tower pathing map, ...)

Okay so I downloaded JNGP and tried to install the Script. Since my Jass Knowledge is so small I would like you to aid me a bit.

What I have done: Nothing.

I am thinking about changing these lines;

JASS:
call GroupEnumUnitsOfType(LoopG,UnitId2String(&#039;o00A&#039;),Condition(function DistanceTest))


and

JASS:
return GetUnitTypeId(GetConstructingStructure()) == &#039;o00A&#039;


the 'o00A', is it my Tower that should be affected by the Script?
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
Well, it's a bit of a silly answer really but give em an ability based of storm bolt that they can cast instead of attacking, call it DestroyBlockTower and do what BloodyDood said? ^^ I know it's not the best of ideas but it's a quick fix xD
 

xAnaMorphine

Active Member
Reaction score
43
Well, it's a bit of a silly answer really but give em an ability based of storm bolt that they can cast instead of attacking, call it DestroyBlockTower and do what BloodyDood said? ^^ I know it's not the best of ideas but it's a quick fix xD

Thanks for the help, I really appreciate it.

But I don't want to do this, I know I am really selective :O
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
How about this, make a dummy that will run your course and time the time it takes via a trigger. Then use that time as a wait and run the dummy before each wave. If the dummy does not pass in the wait time, destroy the last built...but it wouldn't work if the player builds more then one tower now would it? >.<

How bout you just give IT the ability to destroy towers, and if it cannot pass it uses it's towerdestroyability, and a message pops up saying you can't block with towers, maze instead! x)

Heh, i'm really keen on solving this without JASS or extensive triggering xP
 

avalya

New Member
Reaction score
37
Can't you use a trigger that checks if the creeps' current order is Stop, if it is, then turn off their collision and order them to move through the towers?
 

Rushhour

New Member
Reaction score
46
I already told you, just describe what you want, or send me the map, I won't steal anything :D

JASS:
call GroupEnumUnitsOfType(LoopG,UnitId2String(&#039;o00A&#039;),Condition(function DistanceTest))


Yeah 'o00A' is my tower, but this would only work on my map since I have one tower doing the pathing.
You will probably need: call GroupEnumUnitsInRange(LoopG,500.,GetUnitX(u),GetUnitY(u),Condition(function DistanceTest))
but I'm not sure about the order of the arguments^^ and the range could probably be decreased, depending on the maximum distance a neighbor-tower can have.

GIMME INFO :D
 

N(O.O)B

New Member
Reaction score
27
Can't you just check whether the unit has moved and if it didn't, you make it collision free? Might not be perfect but it'll work and it doesn't even require extensive jass :p

Edit: here's an example map I quickly made, it's not perfect yet but it kinda works :p
 

Rushhour

New Member
Reaction score
46
Yeah I changed this native anyway, since it's much more efficient to enum units in range. But stupid bug, not sure if I used OrderId2String somewhere :/
 

xAnaMorphine

Active Member
Reaction score
43
How about I just give you the map? :O
 

Attachments

  • Nightmare of Alliance TD v0.01 #0001.w3x
    104.8 KB · Views: 179

Rushhour

New Member
Reaction score
46
here it is, handed back magically completed :rolleyes:
:D
Didn't you do any changes in units/triggers/whatever or was this just a testmap ? I made a builder/starting gold/testrigger (can be removed) /some towers.
You have to set the pointvalue of the tower to its goldcost because it will restore the unit point value as gold when the tower is misplaced.#
It works for all of your players as long as the ways have the same widths.
The special effect can be changed too ofc.
Edit: Ah I forgot: you need JassHelper (comes with Jass NewGen Pack) to compile this. Look at the sticky thread.
View attachment Nightmare of Alliance TD v0.01 #0001.w3x
 
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

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top