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.
[11:30 pm]
Ultraviolet -- That's strange, it looks like you targeted the base image file (sometimes people make the mistake of just using the imgur page link which doesn't work for embedding) but it still didn't work it sounds like.
[03:34 pm]
ManCubuS -- Used : " [img=https://i.imgur.com/gpOjTuD.jpeg] "
[03:28 pm]
ManCubuS -- Even tried with imgur, doesn't attach.
[03:14 pm]
ManCubuS -- I should try a workaround, thanks! Sadly imgur is blocked in my country for some unknown reason.
[03:05 pm]
NudeRaider -- I think SEN has trouble with https or hotlinking is forbidden. It certainly is nothing about the size, it just fails to get any size. You can get it working if you use imgur and include the actual image link for the img tag. Like this: [img=https://i.imgur.com/ddYqXZa.jpeg]
[11:15 am]
ManCubuS -- Hey fellas! Anyone knows why when I try to upload an image it says "failed to get image size"? I even tried making it so small. Imgur isn't working here and I tried postimg no luck.
[2026-7-23. : 6:40 am]
Oh_Man -- true
[2026-7-23. : 3:16 am]
RIVE -- Still annoyed there was never a trigger to stop or pause wavs.
[2026-7-23. : 1:40 am]
Oh_Man -- tthen u come to SCBW and it's like - upload WAV, play WAV.... sigh why cant it be that easy
[2026-7-23. : 1:40 am]
Oh_Man -- and no consistent easy to use way to then play the audio either
Please log in to shout.


Members Online: Heinermann