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.



Who am I, and why should I care?

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?



    Who am I, and why should I care?

    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.



    Who am I, and why should I care?

    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?



    Who am I, and why should I care?

    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [12:50 am]
    MTiger156 -- Could try an automatic difficulty scaling based on player count. Turning down enemy HP and damage via EUD, or reducing enemy count?
    [07:59 pm]
    Ultraviolet -- Ya I heard that watching the vid, too. Was considering submitting Impossible Ultraviolet, but it's only technically playable with one person.. in practice playing with one person would be terrible
    [05:52 pm]
    MTiger156 -- Oh, the full rules for submissions only appear in the Discord server. "Single Player Only" is a big oof since I'm only good at multiplayer concepts. However I will inquire about trying a multiplayer PvE concept that can be fully played and won alone.
    [10:34 am]
    C(a)HeK -- greetings all, test #7 is complete :)
    [08:10 am]
    Ultraviolet -- you all talk Tiger :P
    [03:33 am]
    MTiger156 -- Holy shit, this "Maporino! 2021" event that just got announced... this is something that takes place every year? Damn I wish I knew about it sooner, this can be my huge breakthrough in motivation :0_0:
    [2021-2-26. : 7:23 am]
    C(a)HeK -- thank you!
    [2021-2-26. : 5:14 am]
    C(a)HeK -- hello all, test 6 is complete - http://www.staredit.net/topic/18203/ :)
    [2021-2-26. : 3:09 am]
    RdeRenato -- yes
    [2021-2-25. : 2:55 pm]
    MTiger156 -- General Kenobi
    Please log in to shout.


    Members Online: Roy, DarkenedFantasies, Vrael