Results 1 to 7 of 7

Thread: "Allow AI control" checkbox in all battles

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default "Allow AI control" checkbox in all battles

    Hi everyone,
    Im after something very.. specific. In the interest of a more challenging campaign, I would like to have, as a start, the 'Allow AI to control this army' checkbox available in ALL battles, not just where the army is a reinforcing one. The checkbox i am talking about is the one in this picture:


    That alone would be awesome, but after this i would like to further the concept such that the checkbox is mandatorily checked in all battles that dont involve your Emperor/King (YOU, in a sense). While 'house rules' could also achieve this, this 'standardisation' would be useful in internet-based hotseat multiplayer games.

    In the full extent i would also like to see each battle give you command only of a 'token' unit, (similar to attacking with a single unit on the campaign map, with a huge AI army as AI controlled support - as in that screenshot) so you at least have SOMETHING to do, and also traits for generals/heirs that allow you to control them directly as if they were 'you' ("taught well", or something like that).

    Is there any mod that achieves any of this, and if not, can anyone give me pointers on whether this is possible and which files might require editing? (I am proficient in modifying games).
    I know that IN a battle you can 'group' units and put these 'groups' under 'AI command', but unfortunately this does not use the same AI - it is buggy and you must still give the 'groups' orders, so i would prefer a different solution.

    Thankyou very much!

  2. #2
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: "Allow AI control" checkbox in all battles

    The AI controlling the army is essentially what is achieved by using the auto-resolve system. there's a command:

    Code:
    Identifier:         unit_group_enable_automation
    Parameters:         group_label true/false
    Description:        Sets or unsets unit group automation
    Sample use:         unit_group_enable_automation
    Class:              UNIT_GROUP_ENABLE_AUTOMATION
    Implemented:        Yes
    Author:             Robbie
    Maybe using that command along with the I_InBattle Condition and the BattleConflictPhaseCommenced event, in the campaign_script, you could get it to automate the groups once the player clicks Start Battle. I don't know what the group_label parameter is filled with though, or if that command means what I'm thinking it does, since I don't generally script battle map functions. If it does work, you'd also need to apply an if condition to check for the commanding general. I'm not sure if you can use IsFactionLeader directly in this context, or if you would need to run a script to add to a counter for faction leaders, and then check for the counter to initiate the in-battle script.

    Cheers,
    Augustus

  3. #3

    Default Re: "Allow AI control" checkbox in all battles

    Thanks for your help, its good to get a lead on which files have an effect.

    Autoresolve uses formulas on relative strengths and matchups of the units to determine who 'should' win - it does not actually simulate the battle - how could it, in just a fraction of a second? The really telling part of this is sieges - because the formulas used completely ignore walls, formations, terrain etcetera (because the battle map is never even launched) an autoresolved siege will give the same result as an autoresolved field battle.

    This is why i want to avoid using it, and watch instead two AI fight each other (Plus this is really cool)

    The function you linked sounds like the 'put group under AI command' available on the battle map when you group units. This would be good enough, but the AI used here is different, and really sucks.

    This has got to be some campaign script, probably the same one that runs whenever the "your army attacks/is attacked" screen pops up on the campaign map - are those hardcoded?
    Last edited by irR4tiOn4L; September 02, 2008 at 06:46 AM.

  4. #4
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: "Allow AI control" checkbox in all battles

    Quote Originally Posted by irR4tiOn4L View Post
    Thanks for your help, its good to get a lead on which files have an effect.

    Autoresolve uses formulas on relative strengths and matchups of the units to determine who 'should' win - it does not actually simulate the battle - how could it, in just a fraction of a second? The really telling part of this is sieges - because the formulas used completely ignore walls, formations, terrain etcetera (because the battle map is never even launched) an autoresolved siege will give the same result as an autoresolved field battle.

    This is why i want to avoid using it, and watch instead two AI fight each other (Plus this is really cool)

    The function you linked sounds like the 'put group under AI command' available on the battle map when you group units. This would be good enough, but the AI used here is different, and really sucks.

    This has got to be some campaign script, probably the same one that runs whenever the "your army attacks/is attacked" screen pops up on the campaign map - are those hardcoded?
    Yes, they are hardcoded. The text you see which says "You are attacked by" can be changed in extended.txt in data/text, but not the function itself. You can run a script like:

    Code:
    monitor_event BattleConflictPhaseCommenced I_InBattle
    
            unit_group_enable_automation grouplabel
    
    end_monitor
    From campaign_script.txt in data/world/maps/campaign/imperial_campaign

    Again not sure the input for group label and busy fixing other errors so can't poke around with it. You might also be required to throw in conditions for selecting the group, I guess it all depends on how the battle engine handles group labels, whether it considers them all to be Group 1 if they aren't sub-grouped, etc.

    Cheers,
    Augustus

  5. #5

    Default Re: "Allow AI control" checkbox in all battles

    Ill go dig around in that campaign_script.txt file youve pointed out - seems the answer should be in there if anywhere

  6. #6
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: "Allow AI control" checkbox in all battles

    Quote Originally Posted by irR4tiOn4L View Post
    Ill go dig around in that campaign_script.txt file youve pointed out - seems the answer should be in there if anywhere
    You won't find anything there, just a couple scripts for the mongol and timurid invasions. CA didn't do a whole lot of modder-style scripting in the campaign script. They mainly use the script triggers for traits, ancillaries, and guilds triggers.

    You should download this here:

    Ultimate DocuDemons 4.0 by GrnEyedDvl

    For information on the commands, conditions, and events used to make scripts.

    Cheers,
    Augustus

Posting Permissions

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