• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Tower Defense Pathing System

Status
Not open for further replies.
Level 12
Joined
Feb 11, 2008
Messages
809
Okay i am working on a better pathing system for tower defense maps such as green td.

with this actual system i needed some ideas of the best possible way to do the system using points or rects or even how man rects will be needed for the system.

on this post ill upload an overview of a green td map and an overview of what the current pathing system looks like and it is truely horrible.

what i want to do is setup the regions into a variable array at the game init. then add "unit enters rect[integer a]" as the event for the system which would be a great improvement already.

but when it comes to the actual system i dont want lots of if/then/elses i want a smooth system that can send the units to their next rect in order.

Sadly i cannot get my trigger to function correctly which is why i was forced to make this post.

please and thank you for anyone that can post an example trigger and explain!
 

Attachments

  • suckage.png
    suckage.png
    121 KB · Views: 173
  • Warcraft-3-Map-Green-TD-Wipeout_1.jpg
    Warcraft-3-Map-Green-TD-Wipeout_1.jpg
    9.4 KB · Views: 2,553
Level 19
Joined
Aug 8, 2007
Messages
2,765
  • Map Init
  • Set rectLeft[0] = TopleftRect
  • Trigger - Add (Unit enters rectLeft[0]) to EnterRegionTrigger
  • Set rectRight[0] =TopRightRect
  • Trigger - Add (Unit enters rectRight[0]) to EnterRegionTrigger
  • Set rectFork[1] = topMidRect
  • Trigger - Add (Unit enters rectFork[1]) to EnterRegionTrigger
  • Set rectLeft[2] = TopleftRect
  • Trigger - Add (Unit enters rectLeft[2]) to EnterRegionTrigger
  • Set rectRight[2] =TopRightRect
  • Trigger - Add (Unit enters rectRight[2]) to EnterRegionTrigger
  • . . .
  • EnterRegionTrigger
  • Loop from 1 to whatever
    • if Unit is in rectLeft[loop] then
      • Custom Script : if udg_rectLeft[udg_loop] != null then
      • Unit : order triggering unit to move to rectLeft[loop + 1]
      • Custom Script : else
      • Unit : order triggering unit to move to rectFork[loop+1]
      • Custom Script : endif
    • (do above for rectRight)
    • if Unit is in rectFork[loop] then
      • if WhateverInt == 0 then
        • set WhateverInt == 1
        • Unit - order triggering unit to move to rectLeft[loop + 1]
      • else
        • set WhateverInt == 0
        • Unit - order triggering unti to mive to rectRIght[loop + 1]
      • endif
could get this 10000x more optimized via structs :\
 
Level 12
Joined
Feb 11, 2008
Messages
809
  • Map Init
  • Set rectLeft[0] = TopleftRect
  • Trigger - Add (Unit enters rectLeft[0]) to EnterRegionTrigger
  • Set rectRight[0] =TopRightRect
  • Trigger - Add (Unit enters rectRight[0]) to EnterRegionTrigger
  • Set rectFork[1] = topMidRect
  • Trigger - Add (Unit enters rectFork[1]) to EnterRegionTrigger
  • Set rectLeft[2] = TopleftRect
  • Trigger - Add (Unit enters rectLeft[2]) to EnterRegionTrigger
  • Set rectRight[2] =TopRightRect
  • Trigger - Add (Unit enters rectRight[2]) to EnterRegionTrigger
  • . . .
  • EnterRegionTrigger
  • Loop from 1 to whatever
    • if Unit is in rectLeft[loop] then
      • Custom Script : if udg_rectLeft[udg_loop] != null then
      • Unit : order triggering unit to move to rectLeft[loop + 1]
      • Custom Script : else
      • Unit : order triggering unit to move to rectFork[loop+1]
      • Custom Script : endif
    • (do above for rectRight)
    • if Unit is in rectFork[loop] then
      • if WhateverInt == 0 then
        • set WhateverInt == 1
        • Unit - order triggering unit to move to rectLeft[loop + 1]
      • else
        • set WhateverInt == 0
        • Unit - order triggering unti to mive to rectRIght[loop + 1]
      • endif
could get this 10000x more optimized via structs :\

thanks im working on doing with rects the way you showed now ill post on here whether i get it working correctly or not.
 
Level 12
Joined
Feb 11, 2008
Messages
809
This is still not working

  • Main Setup
    • -------- ---------------- --------
    • Set TD_NumberofPathingRegions = 14
    • -------- ---------------- --------
    • Set TD_PathingRegion[1] = Red Spawn <gen>
    • Set TD_PathingRegion[2] = 1e <gen>
    • Set TD_PathingRegion[3] = 1f <gen>
    • Set TD_PathingRegion[4] = 1g <gen>
    • Set TD_PathingRegion[5] = 1h <gen>
    • Set TD_PathingRegion[6] = 1i <gen>
    • Set TD_PathingRegion[7] = 1j <gen>
    • Set TD_PathingRegion[8] = 1k <gen>
    • Set TD_PathingRegion[9] = 1l <gen>
    • Set TD_PathingRegion[10] = 1m <gen>
    • Set TD_PathingRegion[11] = 1n <gen>
    • Set TD_PathingRegion[12] = 1o <gen>
    • Set TD_PathingRegion[13] = 1p <gen>
    • Set TD_PathingRegion[14] = END <gen>
    • -------- ---------------- --------
      • Do Multiple ActionsFor each (Integer A) from 1 to TD_NumberofPathingRegions, do (Actions)
        • Loop - Actions
          • Trigger - Add to Pathing System <gen> the event (Unit - A unit enters TD_PathingRegion[(Integer A)])
  • Pathing System
    • Events
    • Conditions
      • (Owner of (Entering unit)) Equal to (==) TD_CreepController
    • Actions
      • Set TD_TempUnit = (Entering unit)
        • Do Multiple ActionsFor each (Integer A) from 1 to TD_NumberofPathingRegions, do (Actions)
          • Loop - Actions
            • Set TD_TempPlayerNumber = (Integer A)
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TD_PathingRegion[TD_TempPlayerNumber] contains TD_TempUnit) Equal to (==) True
                • Then - Actions
                  • Set TD_TempPoint = (Center of TD_PathingRegion[(TD_TempPlayerNumber + 1)])
                  • Unit - Order TD_TempUnit to Move To TD_TempPoint
                  • Custom script: call RemoveLocation(udg_TD_TempPoint)
                • Else - Actions
any ideas why this doesnt work?
 
Status
Not open for further replies.
Top