Page 2 of 4 FirstFirst 1234 LastLast
Results 21 to 40 of 70

Thread: MTW2 Battle Scripting

  1. #21
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: MTW2 Battle Scripting

    Actually I realize the explanation above may sound rather confusing.
    There is a simpler way then, which will have the same effect as lusteds AI if it always does the schiltrom, simply copy and paste the part where it has this code. The code below is taken from my file not his so note you must take that part from his config_ai_battle.xml file specifically, as that part may be different.

    Code:
            <attack-brace>
                <distance>75</distance>
                <time-to-change-formation>3.0</time-to-change-formation>
                <time-to-phalanx>3</time-to-phalanx>
                <time-to-schiltrom>3</time-to-schiltrom>
                <time-to-shield_wall>3</time-to-shield_wall>
            </attack-brace>
    This code is just to give you an idea of what to look for in his, you can use the control+f function that notepad and notepad++ have to find the attack-brace part.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  2. #22

    Default Re: MTW2 Battle Scripting

    well i don't know for sure it was lusted ai but i thought it was,but the lusted ai file is hard too get,will search for it and will find the code,thanks again.

  3. #23

    Default Re: MTW2 Battle Scripting

    i think a found out who made the battle ai so,that spearmen who got the schiltron ability do so if a horse unit come in range of it,it is the battle ai of the great Taiji from battlefield balanced a submod for deus lo vult,i use it in mine persenal mod and then if i charge our get close too it the spearmen goes in schilton,like it schould lol.here is the code line:

    <attack-brace>
    <distance>180.0</distance>
    <time-to-change-formation>2</time-to-change-formation>
    <time-to-phalanx>1</time-to-phalanx>
    <time-to-schiltrom>1</time-to-schiltrom>
    <time-to-shield_wall>1</time-to-shield_wall>
    </attack-brace>

  4. #24
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: MTW2 Battle Scripting

    I've updated the OP and second post with some relevant information about using a battle script within a campaign script which would automate script activation.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  5. #25

    Default Re: MTW2 Battle Scripting

    edit:i was just a little bit confused,so this is just no meaning post,deleted if you want.
    Last edited by stevietheconquer; August 03, 2016 at 01:36 PM.

  6. #26

    Icon4 Re: MTW2 Battle Scripting

    Hello everyone,

    Z3n,

    I've installed your Skynet AI mod, with Kingdom Grand Campaign mod 4.3.

    The game works fine, diplomacy is more interresting and I eager to try the battle.

    However, the last Tier development for settlements have disappeared (Huge City and Citadel), even with the necessary population threshold.

    The origin of that issue seems to be the add_camapaing_script, as removing it from the KGCM 4.3 campaing script resolve the matter.

    I deleted the "script/end_script" inside the KGCM 4.3 campaign_script as advised, but it does not affect that issue.

    Here is the two campaign script merge together, and I don't see any contradiction ( but still looking for )

    campaign_script.txt

  7. #27
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: MTW2 Battle Scripting

    That's odd, try replacing it with this campaign script.
    You don't have to delete the script/end_script part by the way.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  8. #28

    Default Re: MTW2 Battle Scripting

    It's working perfect, what did you do if you don't mind ?

  9. #29
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: MTW2 Battle Scripting

    Well, apparently scripting is extremely close to programming. I hadn't thought so but it is, the while/endwhile statements caused a few issues unfortunately, basically they created punctuation while there were more sentences to say.

    What I did was quite simple, I commented those lines out.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  10. #30

    Default Re: MTW2 Battle Scripting

    Instead of reseting the counters for the next battle within a monitor, would it not be simpler to add "set_counter xxx 0" after "declare_counter xxx"? I imagine that there is a good reason for not doing it, but i have difficulties to see which one...

  11. #31

    Default Re: MTW2 Battle Scripting

    Ok, i just realized that the script is done to be compatible with this weird thing named "campaign_script"...Sorry for the inconvenience (and the double post), i go back in my background_script

  12. #32
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: MTW2 Battle Scripting

    No problem.

    Both ways (background or campaign script) work pretty effectively though I should point out that I haven't really updated the background script in awhile in the 'Skynet AI' resource. It may have a few bugs, I can't really remember. Really glad you're making use of this stuff in any case. If you have any questions feel free, I usually check in here.

    I will point out that setting a counter to 0 is only necessary within the campaign script part I wrote it for (as the campaign script runs continuously unlike a background script which is activated during battle via the advisor then overridden by the campaign script), I think you may have already understood that hence your second post. However counters are automatically set to 0 after you declare them in a background script.
    Last edited by z3n; November 05, 2016 at 01:44 PM.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  13. #33

    Default Re: MTW2 Battle Scripting

    Thank for your answer,

    I knew that the counters are automaticaly reset at zero with "declare_counter", but as i didn't have in mind the compatibility with the campaign, i thought you had used a monitor due to a hidden defect that i didn't know, and i was racking my head to find it...Scripting brings enough bad surprises to become paranoid apparently.

    And thank for your work

  14. #34

    Default Re: Skynet AI

    Is there any way to script in formation changes given certain conditions or army composition? We used to be able to get the AI to use different formations (all named the same) by manipulating the priorities in descr_formations_ai. However the newest (steam?) update has rendered my old descr_formations_ai useless as it now causes CTD on battle start. Before, the AI would deploy in the default formation, but then quickly change to the highest priority formation based on army composition (like Rome did) is that something that can be imitated with scripts?
    Last edited by CavalryCmdr; December 03, 2016 at 10:26 PM.

  15. #35
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: MTW2 Battle Scripting

    In theory yes, I don't think I ever implemented anything though.

    What you'd do is use the change formation command and force the army to use the formation you specified. You may need to group the armies units too, making the more complicated.


    Edit:
    This one, I am not sure if the class/code still exists or is fully functioning in the exe but it should.

    Parameters: group_label formation_name
    Description: sets a group formation from descr_formations.txt
    Sample use: unit_group_order_change_group_formation group2 ordered_triple_line_1

    Also it is a formation from descr_formations.txt formations and not description formations ai.
    Last edited by z3n; December 03, 2016 at 11:09 PM.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  16. #36
    +Mr.Crow+'s Avatar VIVERE MILITARE EST
    Join Date
    Aug 2009
    Location
    Apulia, Kingdom of Sicily
    Posts
    1,359

    Default Re: MTW2 Battle Scripting

    Hi z3n,

    i've not fully understand how ai_gta_add_objective and ai_gta_plan_set work. I simply know that both are able to force an army to do a task but i don't know the difference between them. Furthermore i'm searching the complete list of all possibile associated tasks (DEFEND_FEATURE, ATTACK_ALL, ecc) with their respective meaning.

    Can you help me?
    BELLUM CRUCIS 7.0 Co-Director
    PERSONAL PROJECTS: CSUR || WARWAGON

    Quote Originally Posted by Cyprian2 View Post
    As far as I'm concerned, you've done something that CA should have thought of a long time ago. You should be on their pay-roll!

  17. #37
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: MTW2 Battle Scripting

    Cffexplorer can show whats in the exe. However I am not sure other commands function as intended.


    Defend feature refers to how the AI acts when it normally defends. Defend line (another command) is a bit weird. I can't recall the specifics of it.

    Attack all basically turns the AI back onto aggressive mode. How I used attack all was to trigger the AI into attacking if a player was shooting at them too often.


    There is from what I remmeber a river assault command too but it doesn't work super great and the AI probably triggers it on its own.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  18. #38
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: MTW2 Battle Scripting

    Seems each gta_plan_set could have it's own formation prescribed in config_ai_battle. I tried to add one for defend_line and got that formation when AI set to defence in custom battle. Of course need more tests.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  19. #39
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: MTW2 Battle Scripting

    Woohoo! Thats fantastic news!

    M2tw formations would finally be cracked! I wonder if the exe allows the script command to search for a completely new plan in the xml? Maybe then we could have completely custom formations.
    Last edited by z3n; March 11, 2019 at 12:11 PM.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  20. #40
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: MTW2 Battle Scripting

    I also find such gta_plan as defend_terrain_featured and some strange parameters as "defending_forest" "defending_foggy" "defending_steppy_hill". And much more interesting "key_battle", "we_elephants"/"they_elephants" "we_missile_overpower"/"they_missile_overpower" etc. I can post full list of this tomorrow. I doubt it 100% tied with gta_plans but why not?

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •