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.
    [11:50 pm]
    O)FaRTy1billion[MM] -- nice, now i have more than enough
    [11:49 pm]
    O)FaRTy1billion[MM] -- if i don't gamble them away first
    [11:49 pm]
    O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
    [2024-4-17. : 3:26 am]
    O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
    [2024-4-17. : 1:53 am]
    Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
    [2024-4-17. : 1:52 am]
    Vrael -- hah do you think I was born yesterday?
    [2024-4-17. : 1:08 am]
    O)FaRTy1billion[MM] -- i'll trade you mineral counts
    [2024-4-16. : 5:05 pm]
    Vrael -- Its simple, just send all minerals to Vrael until you have 0 minerals then your account is gone
    [2024-4-16. : 4:31 pm]
    Zoan -- where's the option to delete my account
    [2024-4-16. : 4:30 pm]
    Zoan -- goodbye forever
    Please log in to shout.


    Members Online: Moose, Wing Zero, eksxo, jun3hong