• 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.

Make unit stay in region.

Status
Not open for further replies.
Make units stay in region.

I have always had this problem in defence maps. The enemy AI is spawning and attacking the castle's walls and while they are going up ramps and such they are lured by the allied computer's units. I need them to stay within the castle wall regions. I tried making triggers that if they leave they would automatically move back but they just keep trying to attack the enemy and end up blocking each other and can't move anywhere.

So I just need some system that will make the units stay within their regions.

Thank you.
 
Last edited:
Level 20
Joined
Jul 6, 2009
Messages
1,885
Priority for units can be found in object editor,under Stats section.
You can experiment with it,the more priority a unit has,the more will enemy focus on attacking that unit.
If you don't want AI attackers to attack particular units,give those units low priority,or 0.
 
I still want them to attack each other. But no matter the priority wont they still go after each other? If I set it so low I don't want the allies to just let the enemies pass through easily.

Edit: Unfortunately priority doesn't help at all. They still just get lured and attack each other. The enemy is attack moving into the castle by the way.
 
Level 11
Joined
May 31, 2008
Messages
698
you could just make them stop if they try to attack a unit that isnt in their region. Do something like this:

Unit - A unit acquires a target
if acquired target is in region x = false
then order triggering unit to stop
or, order triggering unit to move to wherever it is supposed to be
 

sentrywiz

S

sentrywiz

Idea 1

You can set their view range to like 300? Try it yourself with different units, test on an empty warcraft project.

It would work like, they approach the region where you have problems and they are blind as bat :D they can't see the enemy. Also set Aquisition range to the same or lower value.


cons
-they might miss the enemy they'r supposed to attack xD which would be FAIL
-they might be attacked by other units and have no clue from where they are being attacked
-this is just a temp solution, you need to find a better one
pros
-they could attack only targets around them at short range (melee)
-works fine with melee/ranged attackers and defenders that walk a path
-you dont need triggers

Play with the aquisition range and view sight. Also for ranged units, their weapon range is important. Consider at night, cuz most units see less at night than at day.


Idea 2

Let's say your making ghouls. Ghouls that are supposed to eat walls, because they like the taste of cement :D
You make the wall a hero, with set amount of health. In the ghouls's targets for attack 1 you only set that they can attack heroes. So you just click Enemy, Hero


cons
-if you want them to attack other units after destroying the walls, they wouldnt
-u'd have to make multiple units that attack different targets
-if heroes attack them (that are not wall xD) they might fight back
pros
-they ignore everything but the wall
-they can be attacked by units and not fight back
 
The wall is just a cliff. Ok lets say I have an invisible platform in the shape of a ladder and a ladder model on top of it. It is connected to the wall so enemy units can attack move onto the walls. The problem is that the enemy would get blocked while they are trying to get onto the wall since the allies would just go at them and end up blocking them from coming up and after they kill them and the second wave approaches they would just go down the ladder and attack the next enemies. So being able to let the enemy spread out onto the wall without the allies going for them right away is what I need.

Sorry I didn't tell you this before. Probably would have been simpler. :grin:

What if I made a trigger that whenever one unit from the incoming wave steps into the region on the wall all the allies in that region will be forced to hold position or pasue or something for about 2-3 seconds so the enemy can spread out a bit.
 
Level 11
Joined
May 31, 2008
Messages
698
why dont you just use my idea i said before, it seems like it would work

you could just make them stop if they try to attack a unit that isnt in their region. Do something like this:

Unit - A unit acquires a target
if acquired target is in region x = false
then order triggering unit to stop
or, order triggering unit to move to wherever it is supposed to be

you might also have to make unit groups for allied units that are in each region and add a condition to the trigger if they are in that group
 
Level 11
Joined
May 31, 2008
Messages
698
Yeah, just add the melee units to the group that you would use for the condition.
And for the ranged units, make their acquisition range = to their attack range. That way they wouldnt try to go down the wall if they see enemies that they cant reach
 
Yeah, just add the melee units to the group that you would use for the condition.
And for the ranged units, make their acquisition range = to their attack range. That way they wouldnt try to go down the wall if they see enemies that they cant reach
I'll experiment with it sometime. I hope it works.

Though I would have to filter it so it doesn't effect the ranged units.
Yes that's what I said.


This is just an extra question but still has to do with my map. Remember how I mention in a previous post that I have a custom invisible platform in the shape of a ladder and a custom ladder model that matches it? I need help making a system that when a unit gets close to the castle wall it would create the invisible platform and ladder in his place. But the facing on the ladders is messed up. Even when I place the invisible platform in the editor it' really hard to see if it's perfect.
 

sentrywiz

S

sentrywiz

The wall is just a cliff. Ok lets say I have an invisible platform in the shape of a ladder and a ladder model on top of it. It is connected to the wall so enemy units can attack move onto the walls. The problem is that the enemy would get blocked while they are trying to get onto the wall since the allies would just go at them and end up blocking them from coming up and after they kill them and the second wave approaches they would just go down the ladder and attack the next enemies. So being able to let the enemy spread out onto the wall without the allies going for them right away is what I need.

Sorry I didn't tell you this before. Probably would have been simpler. :grin:

What if I made a trigger that whenever one unit from the incoming wave steps into the region on the wall all the allies in that region will be forced to hold position or pasue or something for about 2-3 seconds so the enemy can spread out a bit.


Idea 3

Now I got what you need. You got a wall and a thin ladder that serves as stairs and you don't want crowding, one ally could easily counter 100 enemy units by standing on the ladder and fighting.

Why not then, make them stay at the wall - not go down the ladder. I'll fail draw a blueprint of the map how I imagine it:

(ladder) -> ||||||| | wall |>

When allies come to the wall, issue an order for them to hold position. This would be great for melee & ranged. Melee would wait for enemies to come from the ladder and melee them, while ranged will just sit and snipe. No ally gets to move and no enemy gets stuck. Win-win!

(enemy) -> ||||||| | (ally) |>
 
Level 5
Joined
Jan 13, 2008
Messages
96
Event - Units leaves units in areea
Condition - (Owner of (Triggering units)) Equal to Player 3(Teal)
Action - Unit - Order (Leaving units) to Attack-Move to (Center of where you want to attack)
Maybe trigger like this?
 
So I just need some system that will make the units stay within their regions.

  • Spawns
    • Events
      • Time - Every 10.00 seconds of game time <<< CUSTOMIZE THIS EVENT
    • Conditions
      • (Number of units in GroupPaused) Greater than or equal to 10 <<< CUSTOMIZE THIS CONDITION
    • Actions
      • Unit Group - Pick every unit in GroupPaused and do (Actions)
        • Loop - Actions
          • Unit Group - Remove (Picked unit) from GroupPaused
          • Unit Group - Add (Picked unit) to GroupUnpaused
 
Status
Not open for further replies.
Top