You must be logged in to post messages.
Please login or register

Scenario Design
Moderated by Yeebaagooon, TAG

Hop to:    
Welcome! You are not logged in. Please Login or Register.15 replies
Age of Mythology Heaven » Forums » Scenario Design » How to enable multiplayer unit movement for player 0 (Mother Nature)
Bottom
Topic Subject:How to enable multiplayer unit movement for player 0 (Mother Nature)
nottud
Mortal
posted 17 November 2018 08:25 PM EDT (US)         
Just recently been informed that triggers can run AI commands. In particular a command called aiSet("ai fileame", 0); which assigns an ai file to a player. I wondered what you happen if you assign an AI to player 0 and it turns out it enables units to be moved for Mother Nature via triggers as well as make them appear form some reason in scoring.

To activate use the trigger xs user code and put the following text: aiSet("", 0);

Alternatively use this trigger:

<Effect name="AI allow Mother Nature move multiplayer">
<Command>aiSet("", 0);</Command>
</Effect>

This should hopefully remove some annoyances from scenario designing such as needing a player with moveable objects but without using an AI player.

[This message has been edited by nottud (edited 11-18-2018 @ 06:04 AM).]

AuthorReplies:
nottud
Mortal
posted 18 November 2018 06:06 AM EDT (US)     1 / 15       
Other fun stuff I have found:

<Effect name="AI set blank AI">
<Param name="Player" dispName="Player" VarType="string">0</Param>
<Command>aiSet("NoAI", %Player%);</Command>
</Effect>

Replaces the player's AI with a blank do nothing one. (Make the aggro distance works however) It can also be used to forcefully remove a CPU's AI scipt even if the player didn't set it to off.

<Effect name="AI set custom AI">
<Param name="Player" dispName="Player" VarType="string">0</Param>
<Param name="AI" dispName="AI" VarType="string">NoAI</Param>
<Command>aiSet("%AI%", %Player%);</Command>
</Effect>

Replaces the player's AI with the one provided.

<Effect name="AI set aggro distance">
<Param name="Player" dispName="Player" VarType="string">0</Param>
<Param name="Distance" dispName="Distance" VarType="string">100.0</Param>
<Command>xsSetContextPlayer(%Player%);</Command>
<Command>aiSetAttackResponseDistance(%Distance%);</Command>
</Effect>

This sets the distance that a player will react to an attack when an AI is used. (This includes No AI in multiplayer!) Setting this to 0 makes a player very passive, but setting to a huge number will cause the player to throw everything they have against you if you so much as damage a single unit.

<Effect name="AI send message">
<Param name="FromPlayer" dispName="From Player" VarType="string">2</Param>
<Param name="ToPlayer" dispName="To Player" VarType="string">1</Param>
<Param name="Type" dispName="Chat Type" VarType="string">1</Param>
<Param name="Variation" dispName="Variation" VarType="string">-1</Param>
<Command>xsSetContextPlayer(%FromPlayer%);</Command>
<Command>aiCommsSendStatement(%ToPlayer%, %Type%, %Variation%);</Command>
</Effect>

Send one of the predefined AI messages. The type are as follows (Use the ID):
  • None=0;
  • AIBuildSettlement=1;
  • AIResignGatherers=2;
  • AIResignSettlements=3;
  • AIResignActiveEnemies=4;
  • Intro=5;
  • GenericGodPower=6;
  • OffensiveGodPower=7;
  • EconomicGodPower=8;
  • AILostSettlement=9;
  • AILostLastSettlement=10;
  • EnemyBuildSettlement=11;
  • EnemyLostSettlement=12;
  • EnemyLostLastSettlement=13;
  • AIWinningAgeRace=14;
  • AILosingAgeRace=15;
  • AIWonderDestroyed=16;
  • PlayerWonderDestroyed=17;
  • PlayerBuildingWalls=18;
  • AIAttack=19;
  • AIAttackHere=20;
  • AIRetreat=21;
  • HelpHere=22;
  • HelpHome=23;
  • AITakeWater=24;
  • TakingEnemyRelic=25;
  • TakingAllyRelic=26;
  • ResignQuestion=27;

    [This message has been edited by nottud (edited 11-18-2018 @ 06:38 AM).]

  • WarriorMario
    Mortal
    posted 18 November 2018 06:41 AM EDT (US)     2 / 15       
    Hmn I should have made a post somewhere I guess, I was already wondering when people would start to use this but apparently the information didn't spread to others.

    There is lots of other things that can be done now as well. It's basically possible to script an AI in the editor now.

    One useful thing that comes up to mind is polling what type of terrain a unit is on.

    We cannot rely on luck to be successful.
    nottud
    Mortal
    posted 18 November 2018 07:46 AM EDT (US)     3 / 15       
    oooh - which function does that? I'm currently in middle of making an effect to allow the casting of Tsunami as the current invoke god power doesn't do it but I found a working ai function to do it.

    Just currently trying to figure out the direction as it is going all over the place at the moment - I have seen some code in the ai script that does a direction correction but even that seems to not be quite right based on what I got.

    EDIT: Got it working - turns out the second location measures from top of map with directions negated.... weird! (Also having a different y value causes some really weird behaviour for the end position where the power faces a different direction to the direction it actually travels)

    <Effect name="AI cast Tsunami">
    <Param name="Player" dispName="Player" VarType="string">0</Param>
    <Param name="DstPoint1" dispName="From" varType="area">0,0,0</Param>
    <Param name="DstPoint2" dispName="To" varType="area">0,0,0</Param>
    <Command>xsSetContextPlayer(%Player%);</Command>
    <Command>aiCastGodPowerAtPositionFacingPosition(598, vector(%DstPoint1%), xsVectorSet(kbGetMapXSize() - xsVectorGetX(vector(%DstPoint2%)), xsVectorGetY(vector(%DstPoint1%)), kbGetMapZSize() - xsVectorGetZ(vector(%DstPoint2%))));</Command>
    </Effect>

    [This message has been edited by nottud (edited 11-18-2018 @ 08:33 AM).]

    Izalith
    Mortal
    (id: Lilitu)
    posted 18 November 2018 01:39 PM EDT (US)     4 / 15       
    Just as a note, all of this works in the Steam Extended Edition (EE) only, rite?

    Azarath Metrion Zinthos

    Steam: Order of Azarath
    Twitch: twitch.tv/orderofazarath
    Discord: Azarath @ https://discord.gg/3ENKJeb
    nottud
    Mortal
    posted 18 November 2018 03:17 PM EDT (US)     5 / 15       
    Yea was told it was an EE thing - probably explains why it took so for me to find out about it.
    Lewonas
    Mortal
    posted 23 November 2018 01:11 PM EDT (US)     6 / 15       
    It's basically possible to script an AI in the editor now.

    One useful thing that comes up to mind is polling what type of terrain a unit is on.
    Really? Where can I read up on this?

    Out of curiousity, what AI file is set when you use the aiSet("", 0) command? And when you set one of the existing AI files for the Gaia player, does it start behaving like normal CPU players or does it only enable unit interaction? It would be interesting if the latter is the case, although it's not as useful anymore because the NoAI AI file is a thing now.

    What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
    Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
    Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]
    nottud
    Mortal
    posted 23 November 2018 02:12 PM EDT (US)     7 / 15       
    If I recall if you set an AI to AI it will start doing AI stuff as if it is an AI player. The other AI methods also work on Mother Nature when enabled like the agro distance.
    nottud
    Mortal
    posted 23 November 2018 02:41 PM EDT (US)     8 / 15       

    <Effect name="AI set world difficulty">
    <Param name="Difficulty" dispName="Difficulty" VarType="string">0</Param>
    <Command>aiSetWorldDifficulty(%Difficulty%);</Command>
    </Effect>

    This sets the world difficulty - unlike other difficulty setter commands this one works in multiplayer. This is useful for making the AI super aggressive for a Scenario.
    Zenophobia
    Irrational Fear
    posted 25 November 2018 02:32 PM EDT (US)     9 / 15       
    wow, this stuff is actually really useful for multiplayer designers!

    [This message has been edited by Zenophobia (edited 02-29-2094 @ 10:60 AM).]
    TAG
    That AoM Guy
    (id: aom expert)
    posted 25 November 2018 08:32 PM EDT (US)     10 / 15       
    i suspect a new trigger pack is in store

    Check out my YouTube
    For live help with me, enter this chatroom. If I'm not on you can leave a message.
    nottud
    Mortal
    posted 26 November 2018 07:20 AM EDT (US)     11 / 15       
    Couple I meant to add but forget as one to set the military and economic population. If you wack up the military pop the AI will go crazy with building units. :P (Probably something similar will happen with the economic but say with villagers)

    At work so can't add it right now but will try and remember when I get back.

    But yes eventually should get added to a pack - need to also put together my Delegate and For Player as well as a couple of recent misc ones I have written locally.

    [This message has been edited by nottud (edited 11-26-2018 @ 07:21 AM).]

    Someone_9999
    Banned
    posted 27 November 2018 06:45 PM EDT (US)     12 / 15       
    Will the AI set blank AI trigger work in multiplayer too?
    I want to make a multiplayer map with some bots do specific stuff but in multiplayer bots always have AI even if i didn't add one.
    nottud
    Mortal
    posted 28 November 2018 07:27 AM EDT (US)     13 / 15       
    Yes that should solve your problem.
    Someone_9999
    Banned
    posted 28 November 2018 01:19 PM EDT (US)     14 / 15       
    Will it work in classic version of the game or in Extended only?

    EDIT: Tried it, didn't work :/

    [This message has been edited by Someone_9999 (edited 11-28-2018 @ 02:04 PM).]

    nottud
    Mortal
    posted 29 November 2018 02:05 PM EDT (US)     15 / 15       
    Yea extended edition only I am afraid.
    You must be logged in to post messages.
    Please login or register

    Hop to:    

    Age of Mythology Heaven | HeavenGames