Results 1 to 5 of 5

Thread: Automatically testing your mod's campaign.

  1. #1
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Automatically testing your mod's campaign.

    Testing your mod's campaign can be very time consuming as you need to play it and pass turn by turn in order to obersve things like AI movement and CTDs.
    That turns virtually impossible to do as you need to test it several times to find sporadical CTDs and be able to witness all the possible situations. That would consume too many hours of your life and would be extremly boring.

    So there is a way you can let the AI plays the campaign by itself controlling all factions, you dont need to do anything but wait the CTD to happen so you can then read the log, or just use toggle_fow on the console to watch the AI behavior in the strategic map.

    Here we go:

    Find your .cfg file inside your mod folder, open it and in the [video] section type:
    Code:
    windowed        = true
    . This way the game will run in a window while you can use your pc to do whatever you want while the AI plays and test your campaign.

    Go in multiplayer, select hotseat campaign playing as any faction. When the campaign starts, open the cheat console and type control faction (beeing faction the one you select to play)

    Let the ai play with itself until either it crashes or you get curious to see AI movement, use control faction again on the console to get control of the faction back to you.

    It's not quite the same as playing it yourself as any 'local_faction' stuff shouldn't happen, but it's a good way of seeing how the ai moves around the map / if it CTD's.

    BONUS:

    If you're having a CTD, it will be easier to track it if you know in wich faction turn it happened. You can use the following script in "campaign_script.txt", so when the CTD happens the log file will show you wich faction was playing when it happened.

    Code:
       ; keep script unfinised until last monitor termination
    
    monitor_event PreFactionTurnStart sicily
        log always sicily-start
    end_monitor
    monitor_event FactionTurnEnd sicily
        log always sicily-end
    end_monitor
    .
    .
    .
    
    
    wait_monitors
    
    end_script
    In red there is the lines already in the campaign_script so you know where to place yours. You need to repeat this entry for every faction used in the campaign of your mod, as suggests the ...

    PS: Thanks to makanyane and Gigantus for teaching me this. Much from this text was actually copied from makanyane's explanation.
    Last edited by leo.civil.uefs; May 24, 2014 at 04:33 PM.

  2. #2

    Default Re: Automatically testing your mod's campaign.

    Good to know, thanks to everyone involved.

  3. #3

    Default Re: Automatically testing your mod's campaign.

    Here is some useful scripting for auto-running a campaign,

    campaign_script.txt
    Code:
     
    monitor_event RequestTrainingAdvice
      console_command toggle_fow
      console_command toggle_perfect_spy
     end_monitor
    As "toggle_perfect_spy" only works in a script and not in the console. this will toggle both fog of war and perfect spy (see all enemy stats, armies etc.) on or off whenever you ask for advice about which unit to train (a pretty much un-used command.) This is also useful for play-testing a mod without auto-run. Note if you save the game without toggle off first, "perfect_spy" will be disabled while fow will stay, thus they will toggle alternately unless you toggle perfect spy on then manually toggle fow.
    Code:
     monitor_event FactionTurnEnd FactionType slave
      inc_counter myturn 1
      if I_CompareCounter myturn = 50.0
        console_command control papal_states
      end_if
      if I_CompareCounter myturn = 20.0
        console_command control papal_states
      end_if
     end_monitor
    This automatically puts you in control at the set turn number, remember to declare "myturn" counter. I choose 'papal states' and order the AI to never attack the pope and make the pope inactive, although technically it could be any faction, but if stated faction is destroyed it causes problems.

  4. #4
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Automatically testing your mod's campaign.

    If the faction chosen is destroyed then the campaign ends and you're taken back to the menu. To avoid that you could choose to play all factions and use the control command on each of them to switch them to AI control. Or better yet, a script that does that last bit for you...

    Code:
    monitor_event FactionTurnStart I_HotseatEnabled
    
      if not I_IsFactionAIControlled england
        console_command control england
      end_if
      if not I_IsFactionAIControlled france
        console_command control france
      end_if
      if not I_IsFactionAIControlled hre
        console_command control hre
      end_if
      ;... all other playable factions ...
    
    terminate_monitor
    end_monitor

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

    Default Re: Automatically testing your mod's campaign.

    I use papal_faction for testing, so even after faction death game doesn't stop.

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

Posting Permissions

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