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.
[02:53 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: I'll check it out this weekend!
Thanks
[02:47 am]
Symmetry -- I'll check it out this weekend!
[02:40 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: Another map maker? Damn we really ARE back
I invite you to try out the map I modified. I don't have the creativity to create maps from scratch, but I do have the know-how to modify existing ones; my project is to tweak community campaigns (specifically those with errors—to make them playable.
[02:27 am]
Symmetry -- Another map maker? Damn we really ARE back
[01:51 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Now that I wanted to change my avatar, the error image is showing up, haha.
[01:34 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
I invite you to try out a mission I'm modifying from *StarCraft Reversed*; I'm trying to make it more playable and challenging.
[01:33 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
[01:31 am]
Ultraviolet -- Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Is it forbidden to have a large avatar?
actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
[12:20 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: https://staredit.net/profile/133367/ dude's avatar is massive
Is it forbidden to have a large avatar?
[12:04 am]
Ultraviolet -- https://staredit.net/profile/133367/ dude's avatar is massive
Please log in to shout.


Members Online: City, sarahtaylor