michaelm75au
Posts: 13500
Joined: 5/5/2001 From: Melbourne, Australia Status: offline
|
Lua can be very useful as a tool. But is only available in the Scenario Editor mode. One of thing I usually need to do when starting a scenario is to check and change the Side Doctrine settings as needed. I have always thought about being able to just have a common setting I could import as a User Preference. [WRA is the other one that I spend time on tweaking at the start and would like to handle it in the same way - but this is much more complicated .] So as a first step I have built a Special Action that can be run in non-edit mode - once you have saved it in a new copy To get the base settings, you can change the Side Doctrine to suit what you want. Then via the Lua console, run local old = ScenEdit_GetDoctrine( {side='playerside'} ) print(old) It should look something like this ... quote:
{ refuel_unrep_allied = '0', weapon_control_status_surface = '1', deploy_on_defence = '5', rtb_when_winchester = '1', weapon_control_status_land = '1', fuel_state_planned = '0', engaging_ambiguous_targets = '2', weapon_state_planned = '0', use_aip = '1', fuel_state_rtb = '2', gun_strafing = '0', unrep_selection = '0', use_refuel_unrep = '0', deploy_on_attack = '5', withdraw_on_defence = '0', weapon_control_status_subsurface = '1', dive_on_threat = '0', recharge_on_patrol = '60', maintain_standoff = '1', recharge_on_attack = '10', avoid_contact = '0', kinematic_range_for_torpedoes = '2', use_nuclear_weapons = '0', withdraw_on_damage = '0', weapon_state_rtb = '1', use_sams_in_anti_surface_mode = '0', weapon_control_status_air = '1', deploy_on_fuel = '5', air_operations_tempo = '0', automatic_evasion = '1', ignore_emcon_while_under_attack = '1', withdraw_on_attack = '0', deploy_on_damage = '1', dipping_sonar = '0', ignore_plotted_course = '0', bvr_logic = '1', jettison_ordnance = '0', engage_opportunity_targets = '0', withdraw_on_fuel = '1', quick_turnaround_for_aircraft = '1' } Copy and paste the table output in a text file. To use it, load a scenario in Editor mode, and create a Special Action as below. Make it active and repeatable. quote:
Script:Set user preference - Side Doctrine local doctrine = {} local data = ScenEdit_InputBox('Paste the doctrine table to be used') for k, v in string.gmatch(data, "(%g+) = '(%w+)'") do doctrine[k] = v end local old = ScenEdit_GetDoctrine( {side='playerside'} ) print(old) local new = ScenEdit_SetDoctrine( {side='playerside'}, doctrine ) print(new) Save the new scenario. When you start the scenario up, you can run the SA which will ask for the doctrine string to apply. Just paste the contents from the earlier text file into it and continue. The new settings should be applied. Note currently the Player Edit options are not being applied, that is the options are not checked. A future change to SetDoctrine will allow an option on the call to follow the designer's conditions. This only affects the Side Doctrine (and by implication any other doctrines that inherit it). But it won't change any specific settings you have made to individual unit/group/mission doctrine settings. The SA is a temporary way to handle this. I am looking at how this can built into CMO so you can just select a file that has your preferences in it and load it on any scenario.
_____________________________
Michael
|