• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

TD trigger: make creeps stop 'move' and attack builder?

Status
Not open for further replies.
Level 1
Joined
Mar 29, 2009
Messages
1
Ok, I'm trying to make a TD and part of it is that there will be mazers in a valley. I want the builders of the mazes to be attacked if they are in the path region [if they 'hide' in a cave they wont be attacked.]

I'm using the GUI, trying not to use JASS with my first map so I can get a handle on things.

My major issue is the conditional. I want the creeps to NOT attack the maze buildings, only the builders, but I cant make the buildings invulnerable or players will be able to block. I also have neutral passive units that will be in the region area too, and i don't want them to be attacked.

My original trigger was:

  • R01 to R02
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • (Number of units in (Units in R01 to R02 <gen> matching ((((Matching unit) is Mechanical) Equal to False) and (((Owner of (Matching unit)) Equal to Player 1 (Red)) or ((Owner of (Matching unit)) Equal to Player 6 (Orange)))))) Greater than 0
    • Actions
      • Unit Group - Pick every unit in (Units in R01 to R02 <gen> matching ((((Matching unit) is Mechanical) Equal to False) and (((Owner of (Matching unit)) Equal to Player 1 (Red)) or ((Owner of (Matching unit)) Equal to Player 6 (Orange))))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit Group - Order (Units within 512.00 of (Position of (Picked unit)) matching ((Owner of (Matching unit)) Equal to hostileCreeps)) to Attack Once (Picked unit)
            • Else - Actions
R01 to R02 being a region between the red spawn point (R01) and end point (R02) There are multiple spawn / end points so I'm trying to optimize this more so it will work for other spawn points, and it will detect players from all player colors, not just red and orange.

Also I'm aware that those conditionals are immensely large and in charge and I'm sorry they are stretching the page lol.

I'm also open to ditching this idea if there is a better way to control blocking and issue an 'attack to' command instead of 'move to'

Thanks!
 
Level 4
Joined
Oct 29, 2008
Messages
65
This is how I would do it.

First of all, make the trigger go off every .5 seconds and base it entirely on the worker. I am assuming there will only be one worker. Isolate him and set him as Worker upon Map Initialization or when it is picked. Whenever a spawn is aggro, give it an ability with a buff (perhaps for a visual indicator, have a ! buff above the aggro spawn). When a unit runs into a cave, it removes the aggro buff from all spawns and orders them back onto the path.

Oh, and use Multiple Conditions to make things easier to edit.

And learn to remove memory leaks. Your game is going to lag horribly.

So...

Event
Every .5 seconds.

Conditions
Boolean: Mechanical is False
OR
-Player Comparison: Owner is 1
-Player Comparison: Owner is 6

Actions
Set Worker = "This is a Unit variable for your worker" (IF YOU HAVE NOT DONE SO ALREADY)

If
-Worker is Alive
Then
-Set UnitGroup = Units within 512 of Worker
Unit Group - Pick Every...
-Order Picked Unit to attack Worker.
-Add Ability to Picked Unit.
Else
-Do Nothing
Custom Script: call DestroyGroup(udg_UnitGroup)


Obviously, these are not the exact commands. I am just giving you an idea of what it looks like. Oh, but the "call DestroyGroup(udg_UnitGroup)" is real.
 
Status
Not open for further replies.
Top