Staredit Network > Forums > SC2 Assistance > Topic: Make computer AI upgrade at specific time.
Make computer AI upgrade at specific time.
Feb 18 2011, 5:03 am
By: thegameplayer  

Feb 18 2011, 5:03 am thegameplayer Post #1



How do i make a melee computer AI upgrade "Zerg melee weapons" at the 10 minute mark as an example.



None.

Feb 18 2011, 5:26 am Roy Post #2

An artist's depiction of an Extended Unit Death

Assuming the AI player is player 2:

UpgradeAt10Minutes
    Events
        Timer - Elapsed time is 6000.0 Game Time seconds
    Local Variables
    Conditions
    Actions
        Tech Tree - Set Zerg Melee Attacks Level 1 upgrade level to 1 for player 2


That gives the upgrade at 10 minutes automatically if the player does not already have it.

UpgradeAt10Minutes
    Events
        Timer - Elapsed time is 6000.0 Game Time seconds
    Local Variables
    Conditions
    Actions
        AI - Suggests order (Evolution Chamber - Evolve Melee Attacks Level 1) to (Random Living unit from (Evolution Chamber units in (Entire map) owned by player 2 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) using tactical AI logic


That suggests for the AI to upgrade melee attack level 1 if it has not done so already. Or, more accurately, it picks an Evolution Chamber at random and tells it that it should upgrade Melee Attacks 1 if it can.

Post has been edited 2 time(s), last time on Feb 18 2011, 6:23 am by Roy. Reason: Fixed trigger, added better explanation




Feb 18 2011, 7:28 pm thegameplayer Post #3



Quote from Roy
Assuming the AI player is player 2:

UpgradeAt10Minutes
    Events
        Timer - Elapsed time is 6000.0 Game Time seconds
    Local Variables
    Conditions
    Actions
        Tech Tree - Set Zerg Melee Attacks Level 1 upgrade level to 1 for player 2


That gives the upgrade at 10 minutes automatically if the player does not already have it.

UpgradeAt10Minutes
    Events
        Timer - Elapsed time is 6000.0 Game Time seconds
    Local Variables
    Conditions
    Actions
        AI - Suggests order (Evolution Chamber - Evolve Melee Attacks Level 1) to (Random Living unit from (Evolution Chamber units in (Entire map) owned by player 2 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) using tactical AI logic


That suggests for the AI to upgrade melee attack level 1 if it has not done so already. Or, more accurately, it picks an Evolution Chamber at random and tells it that it should upgrade Melee Attacks 1 if it can.

But my game gives the host the option to add computer AI players, so it can be any of the 8 players. Would this work still?



None.

Feb 18 2011, 11:51 pm Roy Post #4

An artist's depiction of an Extended Unit Death

Quote from thegameplayer
But my game gives the host the option to add computer AI players, so it can be any of the 8 players. Would this work still?
Yeah, you can just apply it to all players that are AI players. This can be achieved by storing the AI players in an array when the host chooses the number of AI players, and then just iterating one of the mentioned triggers for each player in that array. If you need an example of this, just ask and I or someone else will post one.

Note: Players are represented by integers. There is no "Player" variable.




Feb 18 2011, 11:59 pm thegameplayer Post #5



I need an example, please.



None.

Feb 19 2011, 12:14 am Roy Post #6

An artist's depiction of an Extended Unit Death

Alright, so I'm not sure how you're performing the option for the host, but in that trigger you should add all the AI players being added to a player group (global variable), like so:

PickedAIUnits
    Events
        ------- Your event here
    Local Variables
    Conditions
    Actions
        ------- Your actions here
        ------- Say 4 AI players were chosen. Add them to a global variable:
        Player Group - Add player 2 to AIPlayerGroupVariable
        Player Group - Add player 3 to AIPlayerGroupVariable
        Player Group - Add player 4 to AIPlayerGroupVariable
        Player Group - Add player 5 to AIPlayerGroupVariable


Then, let's say you're going with the first trigger that automatically gives the upgrade after 10 minutes. Change the actions to iterate over each player in the player group:

UpgradeAt10Minutes
    Events
        Timer - Elapsed time is 6000.0 Game Time seconds
    Local Variables
    Conditions
    Actions
        Player Group - Pick each player in AIPlayerGroupVariable and do (Actions)
            Actions
                Tech Tree - Set Zerg Melee Attacks Level 1 upgrade level to 1 for player (Picked player)


That should go through each player in the group and give them the upgrade.

Edit: I guess I should have asked this earlier: by "add" do you mean before the game begins you fill computer slots, or you choose how many players in-game? I assumed the latter.

Edit2: If you're doing it via lobby, use this as the first trigger to populate the player group:

Trigger for Lobby-Determined AI


Post has been edited 1 time(s), last time on Feb 19 2011, 12:22 am by Roy.




Feb 19 2011, 4:26 am thegameplayer Post #7



Quote from Roy
Alright, so I'm not sure how you're performing the option for the host, but in that trigger you should add all the AI players being added to a player group (global variable), like so:

PickedAIUnits
    Events
        ------- Your event here
    Local Variables
    Conditions
    Actions
        ------- Your actions here
        ------- Say 4 AI players were chosen. Add them to a global variable:
        Player Group - Add player 2 to AIPlayerGroupVariable
        Player Group - Add player 3 to AIPlayerGroupVariable
        Player Group - Add player 4 to AIPlayerGroupVariable
        Player Group - Add player 5 to AIPlayerGroupVariable


Then, let's say you're going with the first trigger that automatically gives the upgrade after 10 minutes. Change the actions to iterate over each player in the player group:

UpgradeAt10Minutes
    Events
        Timer - Elapsed time is 6000.0 Game Time seconds
    Local Variables
    Conditions
    Actions
        Player Group - Pick each player in AIPlayerGroupVariable and do (Actions)
            Actions
                Tech Tree - Set Zerg Melee Attacks Level 1 upgrade level to 1 for player (Picked player)


That should go through each player in the group and give them the upgrade.

Edit: I guess I should have asked this earlier: by "add" do you mean before the game begins you fill computer slots, or you choose how many players in-game? I assumed the latter.

Edit2: If you're doing it via lobby, use this as the first trigger to populate the player group:

Trigger for Lobby-Determined AI

Thanks Roy, I meant adding computers via lobby. I want to do another thing but its a little more complex. Want to help me with it?



None.

Feb 19 2011, 4:31 am Roy Post #8

An artist's depiction of an Extended Unit Death

Sure, that's why this forum exists :)




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:18 am]
Sylph-Of-Space -- No complaints here, i'm just curious!
[11:05 pm]
Ultraviolet -- :wob:
[03:55 pm]
Zoan -- :wob:
[10:34 am]
NudeRaider -- SEN doesn't rely on spammers initiate its sleep cycle. It hat fully automated rest and clean-up phases. Please understand that this is necessary for the smooth operation of the site. Thank you.
[2024-5-18. : 3:45 am]
Sylph-Of-Space -- Does the shoutbox get disabled when there's spammers?
[2024-5-17. : 6:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[2024-5-17. : 5:41 am]
Ultraviolet -- 🤔 so inf is in you?
[2024-5-17. : 4:57 am]
O)FaRTy1billion[MM] -- my name is mud
[2024-5-17. : 4:35 am]
Ultraviolet -- mud, meet my friend, the stick
[2024-5-16. : 10:07 pm]
lil-Inferno -- nah
Please log in to shout.


Members Online: Roy, NudeRaider