Template:Op scenes and missions

Scenes and missions
To put the player into a 3D scene, you need two things. First is the scene itself. All scenes are defined in module_scenes.py file. The second element is no less important, and it's called mission template. Mission template will determine the context of the events on the scene - who will spawn where, who will be hostile or friendly to player or to each other, etc. Because of all this, when player is put on the 3D scene in the game, it is commonly said that player is "in a mission".

Conditional operations
all_enemies_defeated = 1003
 * (all_enemies_defeated, [time-value]),
 * Checks if all agents from the enemy are defeated. When a time value x (in seconds) is given the operation only succeeds if the last status change (dead, alive, wounded...) happened more than (or exactly) x seconds ago.

race_completed_by_player = 1004
 * (race_completed_by_player),
 * Not documented. Not used in Native. Apparently deprecated.

num_active_teams_le = 1005
 * (num_active_teams_le, ),
 * Checks that the number of active teams (i.e. teams with at least one active agent) is less than or equal to given value.

main_hero_fallen = 1006
 * (main_hero_fallen),
 * Checks that the player has been knocked out.

scene_allows_mounted_units = 1834
 * (scene_allows_mounted_units),
 * Not documented. Used in multiplayer, but it's not clear where horses could be disallowed in the first place. 4research.

is_zoom_disabled = 2222
 * (is_zoom_disabled),
 * Version 1.153+. Checks that the zoom is currently disabled in the module.ini by setting the parameter disable_zoom = 1.

mission_tpl_are_all_agents_spawned = 1943
 * (mission_tpl_are_all_agents_spawned),
 * Agents >300 may keep spawning after ti_after_mission_start (fires .1 second too early). If there is no enough space to spawn for agent.

Scene slot operations
scene_set_slot = 503
 * (scene_set_slot, , , ),

scene_get_slot = 523
 * (scene_get_slot,, , ),

scene_slot_eq = 543
 * (scene_slot_eq, , , ),

scene_slot_ge = 563
 * (scene_slot_ge, , , ),

Scene visitors handling operations
add_troop_to_site = 1250
 * Set troop's position in the world to the specified scene and entry point. Entry point must have mtef_scene_source type. Agent will always appear at that entry when entering that scene. No longer used in Native.
 * Set troop's position in the world to the specified scene and entry point. Entry point must have mtef_scene_source type. Agent will always appear at that entry when entering that scene. No longer used in Native.

remove_troop_from_site = 1251
 * Removes the troop from the specified scene. No longer used in Native.
 * Removes the troop from the specified scene. No longer used in Native.

modify_visitors_at_site = 1261
 * Declares the scene which visitors will be modified from that moment on. Can be called inside mission or at global map.
 * Declares the scene which visitors will be modified from that moment on. Can be called inside mission or at global map.

reset_visitors = 1262
 * If the scene defined in previous operand is not loaded yet all visitors will be removed.
 * If the scene defined in previous operand is not loaded yet all visitors will be removed.

set_visitor = 1263
 * Adds the specified troop as the visitor to the entry point of the scene defined with (modify_visitors_at_site). Entry point must have mtef_visitor_source type. Optional DNA parameter allows for randomization of non-hero agent looks.
 * Default team for entry is 7. It can be overridden by  flags. 7 team is hardcoded neutral for everyone and couldn't be changed.
 * Default team for entry is 7. It can be overridden by  flags. 7 team is hardcoded neutral for everyone and couldn't be changed.

set_visitors = 1264
 * Same as (set_visitors), but spawns an entire group of some troop type.
 * Same as (set_visitors), but spawns an entire group of some troop type.

add_visitors_to_current_scene = 1265
 * Adds a number of troops to the specified entry point when the scene is already loaded. Optional  and  parameters are used in multiplayer mode only, singleplayer mode uses selected entry point settings.
 * Default team is 7 wich can be overridden by  flags. 7 team is hardcoded neutral for everyone and this couldn't be changed.
 * Default team is 7 wich can be overridden by  flags. 7 team is hardcoded neutral for everyone and this couldn't be changed.

mission_tpl_entry_set_override_flags = 1940
 * Allows modder to use a different set of equipment override flags (see af_* constants in header_mission_templates.py) for the selected entry point.
 * Allows modder to use a different set of equipment override flags (see af_* constants in header_mission_templates.py) for the selected entry point.

mission_tpl_entry_clear_override_items = 1941
 * Clears the list of override equipment provided by the entry point definition in module_mission_templates.py.
 * Clears the list of override equipment provided by the entry point definition in module_mission_templates.py.

mission_tpl_entry_add_override_item = 1942
 * Specified item will be added to any agent spawning on specified entry point.
 * Specified item will be added to any agent spawning on specified entry point.

Mission/scene general operations
set_mission_result = 1906
 * Apparently deprecated. Sets the result of the current mission (1 for victory, -1 for defeat).
 * Apparently deprecated. Sets the result of the current mission (1 for victory, -1 for defeat).

finish_mission = 1907
 * Exits the scene after the specified delay.
 * Exits the scene after the specified delay.

set_jump_mission = 1911
 * Tells the game to use the specified mission template for the next mission. Apparently should precede the call to (jump_to_scene).
 * Tells the game to use the specified mission template for the next mission. Apparently should precede the call to (jump_to_scene).

jump_to_scene = 1910
 * Official: (jump_to_scene,,),
 * Tells the game to use the specified scene for the next mission. Usually followed by (change_screen_mission) call. Parameter entry_no does not seem to have any effect.
 * Tells the game to use the specified scene for the next mission. Usually followed by (change_screen_mission) call. Parameter entry_no does not seem to have any effect.

set_jump_entry = 1912
 * Defines what entry point the player will appear at when the mission starts.
 * Defines what entry point the player will appear at when the mission starts.

store_current_scene = 2211
 * Retrieves the identifier of the current scene. Note that the operation will return the scene id even after the mission is completed and the player is already on global map.
 * Retrieves the identifier of the current scene. Note that the operation will return the scene id even after the mission is completed and the player is already on global map.

close_order_menu = 1789
 * Version 1.161+. If orders menu is currently open, it will be closed.
 * Version 1.161+. If orders menu is currently open, it will be closed.

entry_point_get_position = 1780
 * Retrieves the position of the entry point on the scene.
 * Retrieves the position of the entry point on the scene.

entry_point_set_position = 1781
 * Moves the entry point to the specified position on the scene.
 * Moves the entry point to the specified position on the scene.

entry_point_is_auto_generated = 1782
 * Checks that the entry point is auto-generated (in other words, there was no such entry point placed in the scene file).
 * Checks that the entry point is auto-generated (in other words, there was no such entry point placed in the scene file).

Scene parameters handling
scene_set_day_time = 1266
 * (scene_set_day_time, ),
 * Defines the time for the scene to force the engine to select a different skybox than the one dictated by current game time. Must be called within ti_before_mission_start trigger in module_mission_templates.py. Value should be in range 0..23.

set_rain = 1797
 * (set_rain, <rain-type>, ),
 * Sets a new weather for the mission. Rain_type values: 0 = clear, 1 = rain, 2 = snow. Strength is typically used in range 0..100 but is actually unlimited. Affects number of particles and fog density.

set_fog_distance = 1798
 * (set_fog_distance, <distance_in_meters>, [fog_color]),
 * Sets the density (and optionally color) of the fog for the mission.

set_skybox = 2389
 * (set_skybox, <non_hdr_skybox_index>, <hdr_skybox_index>),
 * Version 1.153+. Forces the scene to be rendered with specified skybox. Index of -1 will disable.

set_startup_sun_light = 2390
 * (set_startup_sun_light, <r>, <g>, &lt;b&gt;),
 * Version 1.153+. Defines the sunlight color for the scene.

set_startup_ambient_light = 2391
 * (set_startup_ambient_light, <r>, <g>, &lt;b&gt;),

set_startup_ground_ambient_light = 2392
 * 1) Version 1.153+. Defines the ambient light level and colour for the scene. Expects Fixed Point values between 0 and 1.
 * (set_startup_ground_ambient_light, <r>, <g>, &lt;b&gt;),
 * Version 1.153+. Defines the ambient light color for the ground.

get_startup_sun_light = 2394
 * (get_startup_sun_light, <position_no>),
 * Version 1.165+. Returns startup sunlight color in (x, y, z) coordinates of position register.

get_startup_ambient_light = 2395
 * (get_startup_ambient_light, <position_no>),
 * Version 1.165+. Returns startup ambient light color in (x, y, z) coordinates of position register.

get_startup_ground_ambient_light = 2396
 * (get_startup_ground_ambient_light, <position_no>),
 * Version 1.165+. Returns startup ambient ground lighting color in (x, y, z) coordinates of position register.

get_battle_advantage = 1690
 * (get_battle_advantage, ),
 * Retrieves the calculated battle advantage.

set_battle_advantage = 1691
 * (set_battle_advantage, ),
 * Sets a new value for battle advantage.

get_scene_boundaries = 1799
 * (get_scene_boundaries, <position_min>, <position_max>),
 * Retrieves the coordinates of the bottom-left and top-right corner of the scene to the provided position registers.

mission_enable_talk = 1935
 * (mission_enable_talk),
 * Allows dialogue with agents on the scene.

mission_disable_talk = 1936
 * (mission_disable_talk),
 * Disables dialogue with agents on the scene.

mission_get_time_speed = 2002
 * (mission_get_time_speed, <destination_fixed_point>),
 * Retrieves current time speed factor for the mission.

mission_set_time_speed = 2003
 * (mission_set_time_speed, <value_fixed_point>),
 * Instantly changes the speed of time during the mission. Speed of time cannot be set to zero or below. Operation only works when cheat mode is enabled.

mission_time_speed_move_to_value = 2004
 * (mission_time_speed_move_to_value, <value_fixed_point>, <duration-in-1/1000-seconds>),
 * Changes the speed of time during the mission gradually, within the specified duration period. Speed of time cannot be set to zero or below. Operation only works when cheat mode is enabled.

mission_set_duel_mode = 2006
 * (mission_set_duel_mode, ),
 * Sets duel mode for the multiplayer mission. Values: 0 = off, 1 = on.

store_zoom_amount = 2220
 * (store_zoom_amount, <destination_fixed_point>),
 * Version 1.153+. Stores current zoom rate.
 * Works only if native shift zoom is disabled in module.ini parameter disable_zoom = 1.

set_zoom_amount = 2221
 * (set_zoom_amount, <value_fixed_point>),
 * Version 1.153+. Sets new zoom rate.
 * Works only if native shift zoom is disabled in module.ini parameter disable_zoom = 1.

Mission timers
reset_mission_timer_a = 2375
 * (reset_mission_timer_a),
 * Resets the value of first mission timer and starts it from zero.

reset_mission_timer_b = 2376
 * (reset_mission_timer_b),
 * Resets the value of second mission timer and starts it from zero.

reset_mission_timer_c = 2377
 * (reset_mission_timer_c),
 * Resets the value of third mission timer and starts it from zero.

store_mission_timer_a = 2370
 * (store_mission_timer_a, ),
 * Retrieves current value of first mission timer, in seconds.

store_mission_timer_b = 2371
 * (store_mission_timer_b, ),
 * Retrieves current value of second mission timer, in seconds.

store_mission_timer_c = 2372
 * (store_mission_timer_c, ),
 * Retrieves current value of third mission timer, in seconds.

store_mission_timer_a_msec = 2365
 * (store_mission_timer_a_msec, ),
 * Retrieves current value of first mission timer, in milliseconds.

store_mission_timer_b_msec = 2366
 * (store_mission_timer_b_msec, ),
 * Retrieves current value of second mission timer, in milliseconds.

store_mission_timer_c_msec = 2367
 * (store_mission_timer_c_msec, ),
 * Retrieves current value of third mission timer, in milliseconds.

Camera and rendering operations
is_camera_in_first_person = 61
 * (is_camera_in_first_person),

set_camera_in_first_person = 62
 * (set_camera_in_first_person, ),: 1 = first, 0 = third person

mission_cam_set_mode = 2001
 * (mission_cam_set_mode, <mission_cam_mode>, <duration-in-1/1000-seconds>, ),
 * Not documented. Changes main camera mode. Camera mode is 0 for automatic and 1 for manual (controlled by code). Duration parameter is used when switching from manual to auto, to determine how long will camera move to it's new position.
 * if value = 0, then camera velocity will be linear. else it will be non-linear

mission_cam_set_screen_color = 2008
 * (mission_cam_set_screen_color, ),
 * Not documented. Paints the screen with solid color. Parameter contains color code with alpha component. Can be used to block screen entirely, add tint etc.

mission_cam_animate_to_screen_color = 2009
 * (mission_cam_animate_to_screen_color,, <duration-in-1/1000-seconds>),
 * Not documented. Same as above, but color change is gradual. Used in Native to fill the screen with white before the end of marriage scene.

mission_cam_get_position = 2010
 * (mission_cam_get_position, <position_register_no>),
 * Retrieves the current position of camera during the mission (i.e. the point from which the player is observing the game).

mission_cam_set_position = 2011
 * (mission_cam_set_position, <position_register_no>),
 * Moves the camera to the specified position during the mission.

mission_cam_animate_to_position = 2012
 * (mission_cam_animate_to_position, <position_register_no>, <duration-in-1/1000-seconds>, ),
 * Moves the camera to the specified position smoothly. Second parameter determines how long it will take camera to move to destination, third parameter determines whether camera velocity will be linear (value = 0) or non-linear (value = 1).

mission_cam_get_aperture = 2013
 * (mission_cam_get_aperture, ),
 * If player is holding shift for zooming aperture = 37, normal aperture = 75. When player dies with shift holding mission cam aperture don't return to normal

mission_cam_set_aperture = 2014
 * (mission_cam_set_aperture, ),
 * Set aperture for cam.

mission_cam_animate_to_aperture = 2015
 * (mission_cam_animate_to_aperture,, <duration-in-1/1000-seconds>, )
 * Not documented. if value = 0, then camera velocity will be linear. else it will be non-linear

mission_cam_animate_to_position_and_aperture = 2016
 * (mission_cam_animate_to_position_and_aperture, <position_register_no>,, <duration-in-1/1000-seconds>, ),
 * Not documented. if value = 0, then camera velocity will be linear. else it will be non-linear

mission_cam_set_target_agent = 2017
 * (mission_cam_set_target_agent, <agent_id>, ),
 * Not documented. if value = 0 then do not use agent's rotation, else use agent's rotation

mission_cam_clear_target_agent = 2018
 * (mission_cam_clear_target_agent),
 * Not documented.

mission_cam_set_animation = 2019
 * (mission_cam_set_animation, <anim_id>),
 * Plays any bone animation from animations.py, taking the coordinates from the first bone in the hierarchy. The name and number of bones does not matter.

mouse_get_world_projection = 751
 * (mouse_get_world_projection, <position_no_1>, <position_no_2>),
 * Version 1.161+. Returns current camera coordinates (first position) and mouse projection to the back of the world (second position). Rotation data of resulting positions seems unreliable.

cast_ray = 1900
 * (cast_ray,, <hit_position_register>, <ray_position_register>, [<ray_length_fixed_point>]),
 * Version 1.161+. Casts a ray starting from <ray_position_register> and stores the closest hit position into <hit_position_register> (fails if no hits). Rotations of hit position will be normal to the surface, i.e. perpendicular. If the body hit is a scene prop, its instance id will be stored into, otherwise it will be -1. Optional <ray_length> parameter seems to have no effect.
 * Y-axis points to obstacle.

set_postfx = 2386
 * (set_postfx, <postfx_params-ID>),
 * Sets the respective postfx effect for the current scene. Count through your post_fx-settings beginning from 0 to get the ID for the effect or put the line 'ID_postfx_params import *' at the top to use directly the ID-name. Not used in Native. Can get called with all mission triggers, even when already in the scene. However, in latter case a delay can be noticed when the postfx switches. Appearantly a manually set postfx disappears if HDR gets toggled on/off in the graphic options.

set_river_shader_to_mud = 2387
 * Changes river material for muddy shader variant affecting visibility and color (drastically darker). Cannot be undone.
 * Changes river material for muddy shader variant affecting visibility and color (drastically darker). Cannot be undone.

rebuild_shadow_map = 2393
 * (rebuild_shadow_map),
 * Version 1.153+. Rebuilds shadow map for the current scene to match props' new positions. When you move the prop and don't use this operation, its shadow will still fall on its old position.

set_shader_param_int = 2400
 * (set_shader_param_int, <parameter_name>, ),:Sets the int shader parameter <parameter_name> to
 * Version 1.153+. UNTESTED. Allows direct manupulation of shader parameters. Operation scope is unknown, possibly global. Parameter is an int value.

set_shader_param_float = 2401
 * (set_shader_param_float, <parameter_name>, <value_fixed_point>),
 * Version 1.153+. Sets the float shader parameter <parameter_name> to
 * Allows direct manupulation of shader parameters. Operation scope is unknown, possibly global.

set_shader_param_float4 = 2402
 * (set_shader_param_float4, <parameter_name>,, , , ),
 * Version 1.153+. Allows direct manupulation of shader parameters. Operation scope is unknown, possibly global. Parameter is a set of 4 float values.

set_shader_param_float4x4 = 2403
 * (set_shader_param_float4x4, <parameter_name>, [0][0], [0][1], [0][2], [1][0], [1][1], [1][2], [2][0], [2][1], [2][2], [3][0], [3][1], [3][2]), Sets the float4x4 shader parameter <parameter_name> to the given values .w components are 0001 by default
 * Version 1.153+. Allows direct manupulation of shader parameters. Operation scope is unknown, possibly global. Parameter is a set of 4x4 float values.