Template:Op game control screens menus dialogs and encounters

Game control: screens, menus, dialogs and encounters
An encounter is what happens when player's party meets another party on the world map. While most operations in the game can be performed outside of encounter, there's one thing you can only do when in encounter context - standard game battle. When you are initiating the battle from an encounter, the game engine will do most of the grunt work for you. You can order the engine to add some parties to the battle on this or that side, and the soldiers from those parties will spawn on the battlefield, in the numbers proportional to the party sizes, and the agents will maintain links with their parties. If agents earn experience, this will be reflected on the world map, and if some agents die, party sizes will be decreased. All this stuff can potentially be emulated by the Module System code, but it's tons of work and is still much less efficient than the tool the game engine already provides to you.

An important notice: when player encounters an AI party on the map, the game calls "game_event_party_encounter" script in the module_scripts.py. So if you want to implement some non-standard processing of game encounters, this is the place you should start from. Also note that the game implements the Camp menu as an encounter with a hardcoded party "p_camp_bandits".

Also you can find many operations in this section dealing with game screens, game menus and game dialogs. Keep in mind that some screens only make sense in certain contexts, and game menus are only available on the world map, you cannot use game menus during the mission.

Conditional operations
entering_town = 36
 * (entering_town, ),
 * Apparently deprecated.

encountered_party_is_attacker = 39
 * (encountered_party_is_attacker),
 * Checks that the party encountered on the world map was following player (i.e. either player was trying to run away or at the very least this is a head-on clash).

conversation_screen_is_active = 42
 * (conversation_screen_is_active),
 * Checks that the player is currently in dialogue with some agent. Can only be used in triggers of module_mission_templates.py file.

in_meta_mission = 44
 * (in_meta_mission),
 * Deprecated, do not use.

Game hardcoded windows and related operations
change_screen_return = 2040
 * (change_screen_return),
 * Closes any current screen and returns the player to world map. In missions nothing happens.

change_screen_loot = 2041
 * (change_screen_loot, ),
 * Opens the Looting interface, using the provided troop as loot storage. Player has full access to troop inventory.

change_screen_trade = 2042
 * (change_screen_trade, [troop_id]),
 * Opens the Trade screen, using the provided troop as the trading partner. When called from module_dialogs, troop_id is optional and defaults to current dialogue partner.

change_screen_exchange_members = 2043
 * (change_screen_exchange_members, [exchange_leader], [party_id]),
 * Opens the Exchange Members With Party interface, using the specified party_id. If called during an encounter, party_id is optional and defaults to the encountered party. Second parameter [0, 1] determines whether the party leader is exchangeable (useful when managing the castle garrison).

change_screen_trade_prisoners = 2044
 * (change_screen_trade_prisoners),
 * Opens the Sell Prisoners interface. Script "script_game_get_prisoner_price" will be used to determine prisoner price.

change_screen_buy_mercenaries = 2045
 * (change_screen_buy_mercenaries),
 * Opens the Buy Mercenaries interface, where player can hire troops from the party specified with (set_mercenary_source_party) operation. Only works from the dialog.

change_screen_view_character = 2046
 * (change_screen_view_character),
 * Opens the character screen of another troop. Can only be used in dialogs.

change_screen_training = 2047
 * (change_screen_training),
 * Opens the character screen for the troop that player is currently talking to. Only works in dialogs. Deprecated, use (change_screen_view_character) instead.

change_screen_mission = 2048
 * (change_screen_mission),
 * Starts the mission, using previously defined scene and mission template.

change_screen_map_conversation = 2049
 * (change_screen_map_conversation, ),
 * Starts the mission, same as (change_screen_mission). However once the mission starts, player will get into dialog with the specified troop, and once the dialog ends, the mission will automatically end.

change_screen_exchange_with_party = 2050
 * (change_screen_exchange_with_party, ),
 * Effectively duplicates (change_screen_exchange_members), but party_id parameter is obligatory and the operation doesn't have an option to prevent party leader from being exchanged.

change_screen_equip_other = 2051
 * (change_screen_equip_other, [troop_id]),
 * Opens the Equip Companion interface. When calling from a dialog, it is not necessary to specify troop_id.

change_screen_map = 2052
 * (change_screen_map),
 * Changes the screen to global map, closing any currently running game menu, dialog or mission.

change_screen_notes = 2053
 * (change_screen_notes, , ),
 * Opens the Notes screen, in the selected category (note_type: 1=troops, 2=factions, 3=parties, 4=quests, 5=info_pages) and for the specified object in that category.

change_screen_quit = 2055
 * (change_screen_quit),
 * Quits the game to the main menu.

change_screen_give_members = 2056
 * (change_screen_give_members, [party_id]),
 * Opens the Give Troops to Another Party interface. Party_id parameter is optional during an encounter and will use encountered party as default value.

change_screen_controls = 2057
 * (change_screen_controls),
 * Opens the standard Configure Controls screen, pausing the game.

change_screen_options = 2058
 * (change_screen_options),
 * Opens the standard Game Options screen, pausing the game.

set_mercenary_source_party = 1320
 * (set_mercenary_source_party, ),
 * Defines the party from which the player will buy mercenaries with (change_screen_buy_mercenaries).

start_map_conversation = 1025
 * (start_map_conversation,),
 * Old syntax: (start_map_conversation, , [troop_dna]),
 * Starts a conversation with the selected troop. Can be called directly from global map or game menus. Troop DNA parameter allows you to randomize non-hero troop appearances.

Game menus
set_background_mesh = 2031
 * (set_background_mesh, ),
 * Sets the specified mesh as the background for the current menu. Possibly can be used for dialogs or presentations, but was not tested.

set_game_menu_tableau_mesh = 2032
 * (set_game_menu_tableau_mesh, ,, ),
 * Adds a tableau to the current game menu screen. Position (X,Y) coordinates define mesh position, Z coordinate defines scaling. Parameter will be passed as tableau_material script parameter.

jump_to_menu = 2060
 * (jump_to_menu, ),
 * Opens the specified game menu. Note this only happens after the current block of code completes execution.

disable_menu_option = 2061
 * (disable_menu_option),
 * Never used in native. Apparently deprecated as menu options have prerequisite code blocks now.

Game encounter handling operations
set_party_battle_mode = 1020
 * (set_party_battle_mode),
 * Used before or during the mission to start battle mode (and apparently make agents use appropriate AI).

finish_party_battle_mode = 1019
 * (finish_party_battle_mode),
 * Used during the mission to stop battle mode.

start_encounter = 1300
 * (start_encounter, ),
 * Forces the player party to initiate encounter with the specified party. Distance does not matter in this situation.

leave_encounter = 1301
 * (leave_encounter),
 * Leaves encounter mode.

encounter_attack = 1302
 * (encounter_attack),
 * Apparently starts the standard battle with the encountered party. 4research.

select_enemy = 1303
 * (select_enemy, ),
 * When joining a battle, this determines what side player will be helping. Defending party is always 0, and attacking party is always 1. Player can support either attackers (value = 0, i.e. defenders are the enemy) or defenders (value = 1).

set_passage_menu = 1304
 * (set_passage_menu, ),
 * When setting up a mission, this allows you to determine what game menu will be used for that mission passages instead of "mnu_town". Passage menu item number will determine what menu option (in sequential order, starting from 0) will be executed when the player activates that passage on the scene. Note that menu option condition code block will be ignored.

start_mission_conversation = 1920
 * (start_mission_conversation, ),
 * During the mission, initiates the dialog with specified troop.

set_conversation_speaker_troop = 2197
 * (set_conversation_speaker_troop, ),
 * Allows to dynamically switch speaking troops during the dialog when developer doesn't know in advance who will be doing the speaking. Should be placed in post-talk code section of dialog entry.

set_conversation_speaker_agent = 2198
 * (set_conversation_speaker_agent, <agent_id>),
 * Allows to dynamically switch speaking agents during the dialog when developer doesn't know in advance who will be doing the speaking. Should be placed in post-talk code section of dialog entry.

store_conversation_agent = 2199
 * (store_conversation_agent, ),
 * Stores identifier of agent who is currently speaking.

store_conversation_troop = 2200
 * (store_conversation_troop, ),
 * Stores identifier of troop who is currently speaking.

store_partner_faction = 2201
 * (store_partner_faction, ),
 * Stores faction of the troop player is speaking to.

store_encountered_party = 2202
 * (store_encountered_party, ),
 * Stores identifier of the encountered party.

store_encountered_party2 = 2203
 * (store_encountered_party2, ),
 * Stores the identifier of the second encountered party (when first party is in battle, this one will return it's battle opponent).

set_encountered_party = 2205
 * (set_encountered_party, <party_no>),
 * Sets the specified party as encountered by player, but does not run the entire encounter routine. Used in Native during chargen to set up the starting town and then immediately throw the player into street fight without showing him the town menu.

end_current_battle = 1307
 * (end_current_battle),
 * Apparently ends the battle between player's party and it's opponent. Exact effects not clear. 4research.


 * Operations specific to dialogs

store_repeat_object = 50
 * (store_repeat_object, ),
 * Used in the dialogs code in combination with repeat_for_* dialog parameters, when creating dynamical player responses. Stores the value for the current iteration (i.e. a faction ID when repeat_for_factions is used, etc).

talk_info_show = 2020
 * (talk_info_show, <hide_or_show>),
 * Used in the dialogs code to display relations bar on opponent's portrait when mouse is hovering over it (value = 1) or disable this functionality (value = 0)

talk_info_set_relation_bar = 2021
 * (talk_info_set_relation_bar, ),
 * Sets the relations value for relationship bar in the dialog. Value should be in range -100..100. Enter an invalid value to hide the bar.

talk_info_set_line = 2022
 * (talk_info_set_line, <line_no>, <string_no>)
 * Sets the additional text information (usually troop name) to be displayed together with the relations bar.