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#6948 on Discord.
Riney on Steam (Steam)
@RineyCat on Twitter

-- Updated as of December 2021 --

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:29 pm]
Oh_Man -- homeworld 3 = massive disappointment
[10:05 am]
Moose -- ya
[05:23 am]
zsnakezz -- yes
[2024-5-12. : 8:51 pm]
l)ark_ssj9kevin -- Are you excited for Homeworld 3?
[2024-5-12. : 8:44 pm]
l)ark_ssj9kevin -- Hi Brusilov
[2024-5-12. : 4:35 pm]
O)FaRTy1billion[MM] -- Brusilov
Brusilov shouted: Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
my server that was hosting it died
[2024-5-10. : 8:46 pm]
NudeRaider -- Brusilov
Brusilov shouted: Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
https://armoha.github.io/eud-book/
[2024-5-10. : 8:36 am]
Brusilov -- Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
[2024-5-09. : 11:31 pm]
Vrael -- :wob:
[2024-5-09. : 8:42 pm]
Ultraviolet -- :wob:
Please log in to shout.


Members Online: Roy, newageofpower