Staredit Network > Forums > SC2 Assistance > Topic: Help with Attacking A.I.
Help with Attacking A.I.
Oct 26 2011, 11:17 pm
By: Striker  

Oct 26 2011, 11:17 pm Striker Post #1



Quote
Attack P1
Events
Timer - Every 0.2 seconds of Game Time
Local Variables
Conditions
Actions
Unit Group - Pick each unit in (Hydralisk units in Region 001 owned by player 7 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Ability command for ((Picked unit) order at index 0)) == Move
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
((Picked unit) ((Triggering unit) behavior 1) is enabled) == False
Then
Unit - Order (Picked unit) to ( Move targeting (Position of Barracks [26.50, 85.50])) (Replace Existing Orders)
Else
Unit - Order (Picked unit) to ( Attack targeting (Position of Barracks [26.50, 85.50])) (Replace Existing Orders)
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
((Picked unit) ((Triggering unit) behavior 1) is enabled) == True
Then
Unit - Order (Picked unit) to ( Move targeting (Position of Barracks [26.50, 85.50])) (Replace Existing Orders)
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Ability command for ((Picked unit) order at index 0)) != Attack
Then
Unit - Order (Picked unit) to ( Attack targeting (Position of Barracks [26.50, 85.50])) (Replace Existing Orders)
Else

So this is the trigger I am currently using, but not all the units attack. They all move to the target but when not all of them can attack it they just go idle.



None.

Oct 28 2011, 9:22 pm Riney Post #2

Thigh high affectionado

Now I know this is a more indirect approach to fixing your problem, but it might help you figure something out.

I too had a problem where units refused to attack, or just stand still when given orders. I then discovered this.
Code
               Unit - Create 1 Zombie for player 9 at Random Point using default facing (No Options)
               Unit Group - Add (Last created unit) to Zombies Group

First you have to create your units and add them to a unit group (Simply a luxary). I then issue this:
Code
               Unit Group - Pick each unit in Zombies Group and do (Actions)
                   Actions
                       Unit - Order all units in (Unit group((Picked unit))) to ( Attack targeting (Position of (Closest unit to (Position of (Picked unit)) in (Any units in (Entire map) owned by player Any Player matching Required: Heroic, with at most Any Amount)))) (Replace Existing Orders)

Change Any Player with the required player, and the Heroic flag to say a new flag that could be called Factory or Barracks, and you should be done :D


Of course to do all this, youll need a Unit Group Variable, and you'll have to assign the flag Heroic (Or which ever you decide on) to every unit you want to be instantly assaulted by the mass known as the computer. In its current state, these triggers I have laid before you automatically force units to attack the nearest hostile target.

Post has been edited 1 time(s), last time on Oct 28 2011, 9:29 pm by Riney.



.riney on Discord.
Riney on Steam (Steam)
@RineyCat on Twitter

Sure I didn't pop off on SCBW like I wanted to, but I won VRChat. Map maker for life.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2026-6-04. : 3:42 am]
RIVE -- Hellooooo, Nurse
[2026-6-03. : 4:19 pm]
NudeRaider -- Hello World!
[2026-6-01. : 4:03 pm]
IskatuMesk -- no Hello World? No Hello . jpeg? Not even ddosing some government website? smh my head
[2026-5-31. : 10:02 pm]
Symmetry -- I was really just figuring out how to compile
[2026-5-31. : 10:02 pm]
Symmetry -- I didn't make it do anything
[2026-5-31. : 9:17 pm]
Ultraviolet -- hell yeah. did you have trouble making the button functional, or just haven't gotten there yet?
[2026-5-31. : 8:29 pm]
Symmetry -- I made the marine shoot lasers and gave the medic a nonfunctional button
[2026-5-31. : 8:07 pm]
Ultraviolet -- Symmetry
Symmetry shouted: I did my first EUD thing today. Feels like me finding arsenal at age 8 again
haha for sure. in some ways it's even more exciting because you can play EUD maps on regular battle.net, don't need to convince someone to download your mod to play with you. what did you do?
[2026-5-31. : 6:47 pm]
Symmetry -- I did my first EUD thing today. Feels like me finding arsenal at age 8 again
[2026-5-31. : 3:20 pm]
l)ark_ssj9kevin -- le reddit
Please log in to shout.


Members Online: Dem0n