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:09 pm]
Ultraviolet -- let's fucking go on a madmen rage bruh
[10:01 pm]
Vrael -- Alright fucks its time for cake and violence
[2024-5-07. : 7:47 pm]
Ultraviolet -- Yeah, I suppose there's something to that
[2024-5-06. : 5:02 am]
Oh_Man -- whereas just "press X to get 50 health back" is pretty mindless
[2024-5-06. : 5:02 am]
Oh_Man -- because it adds anotherr level of player decision-making where u dont wanna walk too far away from the medic or u lose healing value
[2024-5-06. : 5:01 am]
Oh_Man -- initially I thought it was weird why is he still using the basic pre-EUD medic healing system, but it's actually genius
[2024-5-06. : 3:04 am]
Ultraviolet -- Vrael
Vrael shouted: I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
With the modern EUD editors, I don't think they're calculating nearly as many offsets as you might imagine. Still some fancy ass work that I'm sure took a ton of effort
[2024-5-06. : 12:51 am]
Oh_Man -- definitely EUD
[2024-5-05. : 9:35 pm]
Vrael -- I almost had a heart attack just thinking about calculating all the offsets it would take to do that kind of stuff
[2024-5-05. : 9:35 pm]
Vrael -- that is insane
Please log in to shout.


Members Online: jun3hong, DiearAnother