Staredit Network > Forums > Modding Assistance > Topic: PyAI: make players coordinate attacks AND defense
PyAI: make players coordinate attacks AND defense
Feb 23 2021, 4:50 pm
By: Fruitdispenser  

Feb 23 2021, 4:50 pm Fruitdispenser Post #1



I was looking at stock Insane AI's and Campaign AI's (like last BW Zerg) but I couldn't find something like (attack together) or (defend ally base) or something like that. Is it possible?

While we are at it, is there a place where I could find all PyAI functions? Like a standard library or something like that. Thanks!



None.

Feb 23 2021, 6:19 pm IlyaSnopchenko Post #2

The Curious

It's the help_iftrouble() command that makes the AIs defend each other. It's not in the main scripts usually (like in the BW Zerg 10 ones) but in that mission it's invoked through a dedicated script, ZB1F.

It can be used in a combat AI script, too. Does not work with human players to make the computers defend them, unfortunately, even if you use a human-compatible script as base.



Trial and error... mostly error.

Feb 23 2021, 8:37 pm Fruitdispenser Post #3



Quote from IlyaSnopchenko
help_iftrouble()

I thought so, but from here
Quote
There are relatively few cases where campaign AIs end up defending state 4 regions, and while some of them involve default_min, it can also be consistently done if you concentrate 2+ state 4 regions that border each other and rely on state 7 switching

I read about region states at the bottom of the document, but I didn't understand it.

If there isn't a way to coordinate attacks, I guess if I'm in an UMS scenario, I could use something like
Triggername
Players

  • Someplayer
  • Conditions

  • Current player has units near anotherPlayer --it means, it will attack
  • Actions

  • Order some units of allyofSomeplayer attack a region inside base of anotherPlayer




  • None.

    Feb 23 2021, 11:47 pm Nekron Post #4



    The state 4 region stuff basically means, that if you want an AI player to help another one(which of course requires help_iftrouble), they should have at least 1 defendable building per pathfinding region close together in a cluster of several regions in their base

    You can't coordinate attack targets without mods, i'm afraid




    Feb 24 2021, 7:40 am IlyaSnopchenko Post #5

    The Curious

    I guess the AIs can be synched by forcing wait loops on them until a common condition (death counter?) is achieved, and then ordered to attack the same target using attack_to opcode?

    BTW the guide to all the new commands introduced in AISE is floating around here somewhere. Maybe this one, although I don't know how up-to-date it is (I'm using a locally saved copy of another reference sheet). Thx Pr0nogo!
    http://pr0nogo.wikidot.com/rs-ext-ai
    EDIT: this guide does not seem to denote which AI opcodes work in 1.16 only (there are several that don't work in Remastered). So take care. It also contains several opcodes that are specific to an extended build of AISE not in general circulation. Nekron, do you have a link to the guide that is Remastered-compliant?



    Trial and error... mostly error.

    Feb 24 2021, 10:40 am Nekron Post #6



    There's no guide for RM, since no one made one: also, based on Fruitdispenser's threads I'm fairly sure he's using EUDs to add aiscripts, so AISE is completely out of the question :P Obviously attack_to could be used to sync them otherwise




    Feb 24 2021, 11:50 am IlyaSnopchenko Post #7

    The Curious

    Obviously? Not really, since this is in the "Modding" section (I checked that, for once. :))

    Alright, the opcodes that do not work in SCR are the following:
    - player_jump
    - kills (with a remark that, quote, though the bulk of this command's functionality is only usable in 1.16.1, you can still read values you've written elsewhere when writing scripts for 1.2. You will not be able to track kills in-game, unquote.)
    - reveal_area (works in SCR with the latest update to AISE by Neiv)
    - lift_land (not sure what practical purpose it does serve anyway)
    - aicontrol -> only the dont_focus_disabled / focus_disabled bit.
    - ping
    - unit_name
    - base_layout - very much a pity.
    - remove_creep - also could be handy.



    Trial and error... mostly error.

    Feb 24 2021, 3:04 pm Fruitdispenser Post #8



    Quote from Ilya
    Obviously? Not really, since this is in the "Modding" section (I checked that, for once. :))
    As Nekron said, I'm using EUD's. I asked in the MOD sections because I figured that most info on modifying aiscript and bwscript would be related to MODs. But then, in half the forums I'm a regular I sometimes post in the wrong section


    Quote from Nekron
    The state 4 region stuff basically means, that if you want an AI player to help another one(which of course requires help_iftrouble), they should have at least 1 defendable building per pathfinding region close together in a cluster of several regions in their base

    That means I should take a look at pathfinding regions and see if they are close together in the scenario, right?



    None.

    Feb 24 2021, 6:26 pm IlyaSnopchenko Post #9

    The Curious

    I wonder if help_iftrouble works if a computer player invoking it does not have a running town script?



    Trial and error... mostly error.

    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [06:48 pm]
    Ultraviolet -- :wob:
    [2024-4-21. : 1:32 pm]
    Oh_Man -- I will
    [2024-4-20. : 11:29 pm]
    Zoan -- Oh_Man
    Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
    You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
    [2024-4-20. : 8:20 pm]
    Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
    [2024-4-20. : 8:20 pm]
    Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
    [2024-4-20. : 8:18 pm]
    Ultraviolet -- Oh_Man
    Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
    oh ya I saw that when Armo posted it on Discord, pretty crazy
    [2024-4-20. : 8:09 pm]
    Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
    [2024-4-20. : 8:09 pm]
    Vrael -- woo baby talk about a time crunch
    [2024-4-20. : 8:08 pm]
    Vrael -- Oh_Man
    Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
    so that gives me approximately 27 more years to finish tenebrous before you get to it?
    [2024-4-20. : 7:56 pm]
    Oh_Man -- lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
    Please log in to shout.


    Members Online: C(a)HeK