• 0

    posted a message on Issuing Order to build a building {advanced}

    No problem man. Ya it is a royal pain to get the AI to work correctly. Like, for instance, getting the computer to ONLY have 3 workers getting gas was the HARDEST thing to get to work. Ridiculous amount of bs. Glad I could help :)

    Posted in: Miscellaneous Development
  • 0

    posted a message on Need help with computer AI

    I couldn't find anything in there, so I resorted to triggers for tactical AI decisions.

    Here is what I came up with:

    Use Abilities
        Events
            Unit - Any Unit is attacked
        Local Variables
            X = 0 <Integer>
        Conditions
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Use Abilities[1] == false
                    (Owner of (Triggering unit)) == 2
                    Or
                        Conditions
                            (Unit type of (Triggering unit)) == Marine
                            (Unit type of (Triggering unit)) == Marauder
                Then
                    Region - Move Tanks to (Position of (Triggering unit))
                    General - Wait 0.01 Game Time seconds
                    Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 25.0)) owned by player Any Player matching Excluded: Structure, Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
                        Actions
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    (Owner of (Picked unit)) == 1
                                Then
                                    Unit Group - Add (Picked unit) to Player's Army[0]
                                Else
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    (Owner of (Picked unit)) == 2
                                Then
                                    Unit Group - Add (Picked unit) to Comp Units[0]
                                Else
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            Or
                                Conditions
                                    (Number of Living units in Player's Army[0]) >= ((Number of Living units in Comp Units[0]) / 2)
                                    ((Unit 1 from Player's Army[3]) is in Tanks) == true
                        Then
                            Variable - Set Use Abilities[1] = true
                            Unit - Order all units in Comp Units[0] to (Marine - Use Stimpack) (Replace Existing Orders)
                            General - Wait 15.0 Game Time seconds
                            Variable - Set Use Abilities[1] = false
                        Else
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Use Abilities[2] == false
                    (Owner of (Triggering unit)) == 2
                    Or
                        Conditions
                            ((Triggering unit) is in Infantry[1]) == true
                            ((Triggering unit) is in Attack Wave[1]) == true
                            ((Triggering unit) is in Attack Wave[2]) == true
                            ((Triggering unit) is in Attack Wave[3]) == true
                            ((Triggering unit) is in Attack Wave[4]) == true
                            ((Triggering unit) is in Attack Wave[5]) == true
                            ((Triggering unit) is in Attack Wave[6]) == true
                            ((Triggering unit) is in Attack Wave[7]) == true
                            ((Triggering unit) is in Attack Wave[8]) == true
                            ((Triggering unit) is in Attack Wave[9]) == true
                            ((Triggering unit) is in Attack Wave[10]) == true
                Then
                    Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 25.0)) owned by player 1 matching Required: Cloaked, with at most Any Amount) and do (Actions)
                        Actions
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    Or
                                        Conditions
                                            And
                                                Conditions
                                                    (Unit type of (Picked unit)) == Banshee
                                                    (Banshee - Cloaking Field is Enabled for (Picked unit)) == true
                                            And
                                                Conditions
                                                    (Unit type of (Picked unit)) == Ghost
                                                    (Ghost - Personal Cloaking is Enabled for (Picked unit)) == true
                                Then
                                    Unit Group - Add (Picked unit) to Player's Army[1]
                                    Variable - Set Use Abilities[2] = true
                                    Unit - Order Command Building[1] to (Orbital Command - Scanner Sweep targeting (Center of Player's Army[1])) (Replace Existing Orders)
                                    Unit - Order (Picked unit) to ( Attack units in Player's Army[1]) (Replace Existing Orders)
                                    General - Wait 15.0 Game Time seconds
                                    Variable - Set Use Abilities[2] = false
                                Else
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    (Owner of (Triggering unit)) == 2
                    Or
                        Conditions
                            ((Triggering unit) is in Infantry[1]) == true
                            ((Triggering unit) is in Attack Wave[1]) == true
                            ((Triggering unit) is in Attack Wave[2]) == true
                            ((Triggering unit) is in Attack Wave[3]) == true
                            ((Triggering unit) is in Attack Wave[4]) == true
                            ((Triggering unit) is in Attack Wave[5]) == true
                            ((Triggering unit) is in Attack Wave[6]) == true
                            ((Triggering unit) is in Attack Wave[7]) == true
                            ((Triggering unit) is in Attack Wave[8]) == true
                            ((Triggering unit) is in Attack Wave[9]) == true
                            ((Triggering unit) is in Attack Wave[10]) == true
                Then
                    Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 18.0)) owned by player 1 matching Required: Mechanical, with at most Any Amount) and do (Actions)
                        Actions
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    Or
                                        Conditions
                                            (Unit type of (Picked unit)) == Siege Tank (Siege Mode)
                                            (Unit type of (Picked unit)) == Siege Tank (Tank Mode)
                                Then
                                    Unit Group - Add (Picked unit) to Player's Army[3]
                                    General - For each integer X from 1 to 10 with increment 1, do (Actions)
                                        Actions
                                            Unit - Order all units in Attack Wave[X] to ( Attack units in Player's Army[3]) (Replace Existing Orders)
                                Else
                Else
    

    This works amazingly well :D

    Posted in: Miscellaneous Development
  • 0

    posted a message on Issuing Order to build a building {advanced}
    Unit Currently Building
        Events
            Unit - Any Unit uses SCV - Build (SCV) at Generic3 - Execute stage (Ignore shared abilities)
        Local Variables
        Conditions
            (Owner of (Triggering unit)) == 2
        Actions
            Unit Group - Remove (Triggering unit) from Builders[1]
            Unit Group - Add (Triggering unit) to Builder is Building
    
    Unit Finished Building
        Events
            Unit - Any Unit construction is Completed
        Local Variables
        Conditions
            (Owner of (Triggering unit)) == 2
        Actions
            Unit Group - Pick each unit in (Any units in (Region((Position of (Triggering unit)), 6.0)) owned by player 2 matching Required: Worker, with at most Any Amount) and do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            ((Picked unit) is in Builder is Building) == true
                        Then
                            Unit Group - Remove (Picked unit) from Builder is Building
                            Unit Group - Add (Picked unit) to Builders[1]
                        Else
    

    Works like a charm. Thanks for the idea :D

    Posted in: Miscellaneous Development
  • 0

    posted a message on Programming the AI to defend against nukes

    @Antimatterthunder: Go

    Awesome! Works like a charm!! Thanks man. I always forget about that condition. Good work!

    Posted in: Miscellaneous Development
  • 0

    posted a message on Programming the AI to defend against nukes
    Nuke Defense
        Events
            Unit - Any Unit is issued an order to Ghost - Tac Nuke Strike
        Local Variables
        Conditions
            (Owner of (Triggering unit)) == 1
        Actions
            Unit - Order all units in Infantry[1] to ( Attack (Triggering unit)) (Replace Existing Orders)
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    (Ghost - Personal Cloaking is Enabled for (Triggering unit)) == true
                Then
                    Unit - Order Command Building[1] to (Orbital Command - Scanner Sweep targeting (Position of (Triggering unit))) (Replace Existing Orders)
                Else
    

    So this trigger works correctly, but I want to add another condition that I can't get to work. I need a condition to check to see if the nuke is targeting a building that the player owns or a unit/group of units.

    I've tried "(Ghost - Tac Nuke Strike targeting (Position of Command Building[1])) == (Triggering order)" but this doesn't work.

    Anyone know how to make it check to see if the nuke is targeting a building that the player owns or a unit/group of units?

    Posted in: Miscellaneous Development
  • 0

    posted a message on Issuing Order to build a building {advanced}

    I'm trying to figure out how to make a trigger say:

    Pick unit from workers.
    If picked unit doesn't have mineral and not building a building/on the way to build a building
    then
    issue order to build new building X
    

    So far, the only thing I can figure out is:

            Unit Group - Pick each unit in Builders[1] and do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            ((Picked unit) has Carry Mineral Field Minerals) == false
    

    Anyone know how to add a condition that says unit is not currently building a building or on the way to build one?

    Posted in: Miscellaneous Development
  • 0

    posted a message on More Help with AI Triggers

    For a working solution, refer to:

    Click Me

    Also, I still don't know how the "AI Advanced - Enable Optimizing Gas Harvesters for player 2" actually works.

    Honestly, I can't get any of these to work:

            AI Advanced - Enable Defending with Peons for player 2
            AI Advanced - Enable Advancing Front Line of Waves for player 2
            AI Advanced - Enable Fleeing from Attackers when Low Health for player 2
            AI Advanced - Enable Optimizing Gas Harvesters for player 2
            AI Advanced - Enable Repairing Damaged Buildings Early in a Game for player 2
            AI Advanced - Enable Repairing Damaged Buildings Later in a Game for player 2
            AI Advanced - Enable Usege of Melee Game Target Priorities for player 2
    

    "AI Advanced - Enable Defending with Peons for player 2" is the only one that I've got to work. The rest.... They don't work

    Update:

    From what I can tell, "AI Advanced - Enable Optimizing Gas Harvesters for player 2" makes the computer be retarded about getting gas. Like trying to send 4+ guys on the geyser. I even watched it send 8.... Suggest to not use this and issue orders threw a trigger system.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Checking to see how many workers are mining a vespene geyser?

    Wow. Ok after spending a few hours testing and playing around, here is the completed working trigger system:

    Gas Collectors
        Events
            Unit - Any Unit is issued an order to SCV - Gather
        Local Variables
        Conditions
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    (Target unit for (Triggering order)) == Refineries[1]
                Then
                    Unit Group - Remove (Triggering unit) from Builders[1]
                    Unit Group - Add (Triggering unit) to Gas Collectors[1]
                Else
    
    Check Gas Collectors
        Events
            Timer - Every 1.0 seconds of Game Time
        Local Variables
        Conditions
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    (Number of Living units in Gas Collectors[1]) > 3
                Then
                    Unit Group - Pick each unit in Gas Collectors[1] and do (Actions)
                        Actions
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    (Unit 1 from Gas Collectors[1]) != (Picked unit)
                                    (Unit 2 from Gas Collectors[1]) != (Picked unit)
                                    (Unit 3 from Gas Collectors[1]) != (Picked unit)
                                Then
                                    Unit - Order (Picked unit) to ( Stop) (Replace Existing Orders)
                                    Unit Group - Remove (Picked unit) from Gas Collectors[1]
                                    Unit Group - Add (Picked unit) to Builders[1]
                                Else
                Else
                    Unit Group - Pick each unit in Gas Collectors[1] and do (Actions)
                        Actions
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    (SCV - Gather (Picked unit)) != ((Picked unit) order(1))
                                    ((Picked unit) has Carry Harvestable Vespene Geyser Gas) == false
                                Then
                                    Unit - Order (Picked unit) to (SCV - Gather Refineries[1]) (Replace Existing Orders)
                                Else
    
    Idle Workers
        Events
            Unit - Any Unit Becomes idle
        Local Variables
        Conditions
            (Owner of (Triggering unit)) == 2
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    ((Triggering unit) has Carry Mineral Field Minerals) == true
                Then
                    Unit - Order (Triggering unit) to (SCV - Return Cargo) (After Existing Orders)
                Else
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            Spare Boolean[2] == false
                        Then
                            Unit - Order (Triggering unit) to (SCV - Gather (Random Any unit from Minerals[0])) (After Existing Orders)
                        Else
                            Unit - Order (Triggering unit) to (SCV - Gather (Random Any unit from Minerals[1])) (After Existing Orders)
    

    Someone should seriously post this in the tutorial section under AI to help players out cause it was a serious pain in the you know what to get this to work. If needed I can write up a tutorial post.

    What's dumb is I tried to turn this into an array and it doesn't work. Gives a "array overflow" message. The array trigger I made looks like this:

    Check Gas Collectors 2
        Events
            Timer - Every 5.0 seconds of Game Time
        Local Variables
            Total Unit Groups = 0 <Integer>
        Conditions
        Actions
            General - For each integer Total Unit Groups from 1 to 6 with increment 1, do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (Number of Living units in Gas Collectors[Total Unit Groups]) > 3
                        Then
                            Unit Group - Pick each unit in Gas Collectors[Total Unit Groups] and do (Actions)
                                Actions
                                    General - If (Conditions) then do (Actions) else do (Actions)
                                        If
                                            (Unit 1 from Gas Collectors[Total Unit Groups]) != (Picked unit)
                                            (Unit 2 from Gas Collectors[Total Unit Groups]) != (Picked unit)
                                            (Unit 3 from Gas Collectors[Total Unit Groups]) != (Picked unit)
                                        Then
                                            Unit Group - Remove (Picked unit) from Gas Collectors[Total Unit Groups]
                                            Unit - Order (Picked unit) to (SCV - Gather (Random Any unit from Minerals[Total Unit Groups])) (After Existing Orders)
                                        Else
                        Else
                            Unit Group - Pick each unit in Gas Collectors[Total Unit Groups] and do (Actions)
                                Actions
                                    General - If (Conditions) then do (Actions) else do (Actions)
                                        If
                                            (SCV - Gather (Picked unit)) != ((Picked unit) order(1))
                                            ((Picked unit) has Carry Harvestable Vespene Geyser Gas) == false
                                        Then
                                            Unit - Order (Picked unit) to (SCV - Gather Refineries[Total Unit Groups]) (Replace Existing Orders)
                                        Else
                    Unit Group - Pick each unit in (Any units in (Entire map) owned by player 2 matching Required: Worker, with at most 72) and do (Actions)
                        Actions
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    ((Picked unit) is in Builders[Total Unit Groups]) == false
                                    ((Picked unit) is in Gas Collectors[Total Unit Groups]) == false
                                Then
                                    Unit Group - Add (Picked unit) to Builders[Total Unit Groups]
                                Else
    

    I don't know, maybe I did something wrong here? I honestly think you just can't use the "pick units" function insides a "pick each integer" function.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Checking to see how many workers are mining a vespene geyser?

    It's for an AI. I'm trying to figure out how to setup a trigger that checks every X amount of seconds if refinery X has 3 workers and if not, send them there.

    Or do something that makes the AI auto do this.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Checking to see how many workers are mining a vespene geyser?

    Really need to know how to do this. I can't figure it out

    Posted in: Miscellaneous Development
  • 0

    posted a message on More Help with AI Triggers

    How do you make "AI Advanced - Enable Optimizing Gas Harvesters for player 2" work?

    When the computer has just one base, it always makes sure that it has 3 workers mining gas, but when you expand and build another "town" the computer stops regulating gas. At first I thought it was a matter of how many workers we're created, but that's not the case. I had the computer produce 60 scv's and it stopped caring about gas.

    I've tried to manually issue order to the scv's telling them to gather the geyser as well as the refinery after it's built. They won't comply.

    Also, I have added:

            AI Advanced - Create a new town for player 2 at point (Center of Build Expansion).
            AI Advanced - Start a new harvest job at town 0 for player 2. 
            AI Advanced - Town set stock for player 2 using town hall type Command Center and refinery type Refinery.
            AI Advanced - Enables restocking which has the AI try to make the objects specified by AISetStock for player 2.
    

    None of these work or change anything about harvesting gas. Can someone please help me with this? AS is, it's pointless to continue with the AI script I'm making if the workers don't harvest gas.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Need help with computer AI

    @RileyStarcraft: Go

    That is good to know. I will have to play around with that. Too bad the trigger system is already created lol

    Is there any way to do like use stim packs if X amount of enemy units are present? Like how I have setup in the trigger system?

    Also, do you know how to enable the units to defend their town without have a trigger like this:

    Building Attacked
        Events
            Unit - Any Unit is attacked
        Local Variables
        Conditions
            (Owner of (Triggering unit)) == 2
            ((Triggering unit) is Required: Structure for player 2) == true
        Actions
            Unit - Order all units in Infantry[1] to ( Attack targeting (Position of (Triggering unit))) (Replace Existing Orders)
    

    ALSO, how do you set targeting priorities? Like how do you make it so the army will target siege tanks 1st over any other units?

    Posted in: Miscellaneous Development
  • 0

    posted a message on Need help with computer AI

    Ha, ok got everything working flawlessly!

    Ok so check this out:

    1st timing attack made by comp opponent. Comp has about 8 marines and 6 marauders with all tech lab upgrades and lv 1 weapons finishing by the time he hits you

    Setting up your attack wave:

    First Attack Wave
        Events
            Timer - Attack Timer[1] expires
        Local Variables
        Conditions
        Actions
            Unit Group - Pick each unit in Infantry[1] and do (Actions)
                Actions
                    Unit Group - Add (Picked unit) to Attack Wave
                    Unit Group - Remove all units in Attack Wave from Infantry[1]
            AI - Add Attack Wave to the next attack wave for player 2
            AI - Enable suicide for Attack Wave
            AI - Add an attack wave waypoint at Players Expansion for player 2 using Normal Mode
            AI - Add an attack wave waypoint at Players Ramp for player 2 using Normal Mode
            AI - Add an attack wave waypoint at Players Base for player 2 using Normal Mode
            UI - Display "First Attack Wave Setting Out" for (All players) to Subtitle area
            AI - Send the attack wave from player 2 to attack in 10 seconds and Wait
            Trigger - Turn Move Attackers On
    

    Comp Using Stim Packs:

    Use Stims
        Events
            Unit - Any Unit is attacked
        Local Variables
        Conditions
            Use Abilities[1] == false
            (Owner of (Triggering unit)) == 2
            Or
                Conditions
                    (Unit type of (Triggering unit)) == Marine
                    (Unit type of (Triggering unit)) == Marauder
        Actions
            Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 14.0)) owned by player Any Player matching Excluded: Structure, Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (Owner of (Picked unit)) == 1
                        Then
                            Unit Group - Add (Picked unit) to Player's Army
                        Else
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    (Number of Living units in Player's Army) >= ((Number of Living units in Attack Wave) / 2)
                                    ((Picked unit) is in (Region((Center of Player's Army), 14.0))) == true
                                Then
                                    Variable - Set Use Abilities[1] = true
                                    Unit - Order (Picked unit) to (Marine - Use Stimpack) (Replace Existing Orders)
                                    General - Wait 15.0 Game Time seconds
                                    Variable - Set Use Abilities[1] = false
                                Else
    

    This trig pretty much says if players army is half/equal to the size of the comp army, tell comp army units in that AREA to use stim packs, then wait for 15 seconds and re-enable the trigger

    If army is IDLE:

    Idle Army
        Events
            Unit - Any Unit Becomes idle
        Local Variables
        Conditions
            (Owner of (Triggering unit)) == 2
            ((Triggering unit) is in Attack Wave) == true
        Actions
            AI - Add Attack Wave to the next attack wave for player 2
            AI - Enable suicide for Attack Wave
            AI - Send the attack wave from player 2 to attack in 0 seconds and Don't Wait
    

    To disable the return rate/value where the army goes back to the starting location, you have to "enable suicide" for the attack wave. You can setup attack waypoints for the army to travel on, but without any, the AI automatically seeks out any opponent's unit, which is better I think. Also, you have to have "AI - Start the campaign AI for player 2" enabled before any of these triggers for this to work, I'm pretty sure, not 100% positive.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Need help with computer AI

    Ya dude the AI triggers are CONFUSING as hell. I'm playing around with them and learning a lot. It's weird how that got fixed. The only other problem I see now, is the units have a fall back point it looks like. Like if they are attacked, and you kite them, after moving a certain range they return to their original position.

    In wc3 you could disable this. In here, I have no idea where. Do you know?

    Posted in: Miscellaneous Development
  • 0

    posted a message on Need help with computer AI

    Ok, so I came up with a trigger, it says:

    Use Stims
        Events
            Unit - Any Unit is attacked
        Local Variables
        Conditions
            Use Abilities[1] == false
            (Owner of (Triggering unit)) == 2
            Or
                Conditions
                    (Unit type of (Triggering unit)) == Marine
                    (Unit type of (Triggering unit)) == Marauder
        Actions
            Variable - Set Use Abilities[1] = true
            Unit Group - Pick each unit in (Any units in (Region((Position of (Attacking Unit)), 14.0)) owned by player 1 matching Excluded: Structure, Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
                Actions
                    Unit Group - Add (Picked unit) to Player's Army
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    (Number of Living units in Player's Army) >= ((Number of Living units in Attack Wave[1]) / 2)
                Then
                    Unit - Order all units in Attack Wave[1] to (Marine - Use Stimpack) (Replace Existing Orders)
                    General - Wait 10.0 Game Time seconds
                    Variable - Set Use Abilities[1] = false
                Else
    

    This trigger works flawlessly with the exception of one major problem.... The marines/marauders use the stim pack twice........ WHY? Help plz!!

    I also tested out the stim ability on a unit just standing still and it looks like even if I tell a single unit to use stim's, he uses it twice.... I don't understand this.

    Update: It's the ability command... If I manually click on stims on one of my marines it only takes off 10 life. If I issue an order for my marine to use stims, it takes off 20 life... BUG?

    Final Update: Ok... For whatever reason. Going into the data editor and changing the amount of life cost then resetting it back fixed it........

    Still need to know:

    How do you make it so the comp will use abilities if they are researched? Like program the AI to use abilities not with a trigger like the one above.

    Posted in: Miscellaneous Development
  • To post a comment, please or register a new account.