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.
[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: UndeadStar, Ultraviolet