KnightV 说:i will use but how game will get to know what troops to spawn? What triggers /codes do this?
MP? If so, see section Z24 (Lav's header_operations.py) for operations on player (like player_set_troop_id).pete99 说:How would you go about auto-assigning a particular troop to a player: e.g. player selects a nation and is automatically assigned a particular troop type?
kalarhan 说:KnightV 说:i will use but how game will get to know what troops to spawn? What triggers /codes do this?
follow the code. For SP it starts from the world event (field) or the game menu (sieges), calling a script/piece of code, that directs to a series of scripts for setup and the spawn of troops (based on the encountered parties). Triggers of the mission template do some of the work, and also handle the reinforcement code. If in doubt just look for who calls that mission template, and the template own triggers.
for MP you will need to check MP own code.
remember to follow the recipe for the mission template flags and how it handles the entry rows (for the EP).
MP? If so, see section Z24 (Lav's header_operations.py) for operations on player (like player_set_troop_id).pete99 说:How would you go about auto-assigning a particular troop to a player: e.g. player selects a nation and is automatically assigned a particular troop type?
For SP you can check the other sections from the same reference.
kalarhan 说:Nameless Warrior 说:Any idea what can cause a phantom quickstring?
likely a syntax error or a invalid character (that breaks the string split). Easiest way to track it down is to search the module file, as they are created in order. Find "closed the gate" and "to party morale" on your module_scripts.py and see what is between it.
you can also inject a logger on your process_XXX.py file if the manual search failed.
插入代码块:def load_quick_strings(export_dir): def save_quick_strings(export_dir, quick_strings):
pete99 说:would you or anyone else know also how to 'grey' the options out so you can't select a particular class (like when horses aren't allowed on a map)? And yes, this is for multiplayer.
# [ Z23 ] PRESENTATIONS
overlay_set_display = 947 # (overlay_set_display, <overlay_id>, <value>),
# Shows (value = 1) or hides (value = 0) the specified overlay.
erennuman_mb 说:I was looking at some code in the module system some time ago and I saw a slot operation that didn't use a slot.
troop_set_slot = 500 # (troop_set_slot, <troop_id>, <slot_no>, <value>),
Nameless Warrior 说:It suggests in this operation description that there is a way to remove scene props from a battlefield.
scene_prop_fade_out = 1822 # (scene_prop_fade_out, <scene_prop_id>, <fade_out_time>)
# Version 1.153+. Makes the scene prop instance disappear within specified time.
try_for_prop_instances = 16 # (try_for_prop_instances, <destination>, [<object_id>], [<object_type>]),
# Version 1.161+. if object_id and object_type is not given, it loops through all instances. For object types see list of "somt_" in header_common.py
pete99 说:Sorry, I would like to create a trigger where when the correct conditions are met it resets the map/round (like the option in the admin panel to reset map). I was wondering if there is a straightforward way (like a callable script) to go about doing this?
#initialize my team at start of round (it will be assigned again at next round's first death)
(assign, "$my_team_at_start_of_round", -1),
#clear scene and end round
(multiplayer_clear_scene),
(call_script, "script_multiplayer_initialize_belfry_wheel_rotations"),
(try_begin),
(eq, "$g_battle_death_mode_started", 2),
(call_script, "script_move_death_mode_flags_down"),
(try_end),
(assign, "$g_battle_death_mode_started", 0),
(assign, "$g_reduced_waiting_seconds", 0),
#initialize moveable object positions
(call_script, "script_multiplayer_close_gate_if_it_is_open"),
(call_script, "script_multiplayer_move_moveable_objects_initial_positions"),
(assign, "$g_round_ended", 0),
(assign, "$g_multiplayer_num_bots_required_team_1", "$g_multiplayer_num_bots_team_1"),
(assign, "$g_multiplayer_num_bots_required_team_2", "$g_multiplayer_num_bots_team_2"),
(store_mission_timer_a, "$g_round_start_time"),
(call_script, "script_initialize_all_scene_prop_slots"),
#initialize round start times for clients
(get_max_players, ":num_players"),
(try_for_range, ":player_no", 0, ":num_players"),
(player_is_active, ":player_no"),
(multiplayer_send_int_to_player, ":player_no", multiplayer_event_set_round_start_time, -9999), #this will also initialize moveable object slots.
(try_end),
]),
(0, 0, 0, [], #if there is nobody in any teams do not reduce round time.
[
#(multiplayer_is_server),
(assign, ":human_agents_spawned_at_team_1", "$g_multiplayer_num_bots_team_1"),
(assign, ":human_agents_spawned_at_team_2", "$g_multiplayer_num_bots_team_2"),
(get_max_players, ":num_players"),
(try_for_range, ":player_no", 0, ":num_players"),
(player_is_active, ":player_no"),
(player_get_team_no, ":player_team", ":player_no"),
(try_begin),
(eq, ":player_team", 0),
(val_add, ":human_agents_spawned_at_team_1", 1),
(else_try),
(eq, ":player_team", 1),
(val_add, ":human_agents_spawned_at_team_2", 1),
(try_end),
(try_end),
(try_begin),
(this_or_next|eq, ":human_agents_spawned_at_team_1", 0),
(eq, ":human_agents_spawned_at_team_2", 0),
(store_mission_timer_a, ":seconds_past_since_round_started"),
(val_sub, ":seconds_past_since_round_started", "$g_round_start_time"),
(le, ":seconds_past_since_round_started", 2),
(store_mission_timer_a, "$g_round_start_time"),
(try_end),
]),
(1, 0, 0, [],
[
(multiplayer_is_server),
(get_max_players, ":num_players"),
(try_for_range, ":player_no", 0, ":num_players"),
(player_is_active, ":player_no"),
(neg|player_is_busy_with_menus, ":player_no"),
(try_begin),
(player_slot_eq, ":player_no", slot_player_spawned_this_round, 0),
(player_get_team_no, ":player_team", ":player_no"), #if player is currently spectator do not spawn his agent
(lt, ":player_team", multi_team_spectator),
(player_get_troop_id, ":player_troop", ":player_no"), #if troop is not selected do not spawn his agent
(ge, ":player_troop", 0),
(assign, ":spawn_new", 0),
(assign, ":num_active_players_in_team_0", 0),
(assign, ":num_active_players_in_team_1", 0),
(try_begin),
(assign, ":num_active_players", 0),
(get_max_players, ":num_players"),
(try_for_range, ":player_no_2", 0, ":num_players"),
(player_is_active, ":player_no_2"),
(val_add, ":num_active_players", 1),
(player_get_team_no, ":player_team_2", ":player_no_2"),
(try_begin),
(eq, ":player_team_2", 0),
(val_add, ":num_active_players_in_team_0", 1),
(else_try),
(eq, ":player_team_2", 1),
(val_add, ":num_active_players_in_team_1", 1),
(try_end),
(try_end),
(store_mul, ":multipication_of_num_active_players_in_teams", ":num_active_players_in_team_0", ":num_active_players_in_team_1"),
(store_mission_timer_a, ":round_time"),
(val_sub, ":round_time", "$g_round_start_time"),
(this_or_next|lt, ":round_time", multiplayer_new_agents_finish_spawning_time),
(this_or_next|le, ":num_active_players", 2),
(eq, ":multipication_of_num_active_players_in_teams", 0),
(eq, "$g_round_ended", 0),
(assign, ":spawn_new", 1),
(try_end),
(eq, ":spawn_new", 1),
(try_begin),
(eq, ":player_team", 0),
(assign, ":entry_no", multi_initial_spawn_point_team_1),
(else_try),
(eq, ":player_team", 1),
(assign, ":entry_no", multi_initial_spawn_point_team_2),
(try_end),
(call_script, "script_multiplayer_buy_agent_equipment", ":player_no"),
(player_spawn_new_agent, ":player_no", ":entry_no"),
(player_set_slot, ":player_no", slot_player_spawned_this_round, 1),
(else_try), #spawning as a bot (if option ($g_multiplayer_player_respawn_as_bot) is 1)
(eq, "$g_multiplayer_player_respawn_as_bot", 1),
(player_get_agent_id, ":player_agent", ":player_no"),
(ge, ":player_agent", 0),
(neg|agent_is_alive, ":player_agent"),
(agent_get_time_elapsed_since_removed, ":elapsed_time", ":player_agent"),
(gt, ":elapsed_time", "$g_multiplayer_respawn_period"),
(player_get_team_no, ":player_team", ":player_no"),
(assign, ":is_found", 0),
(try_for_agents, ":cur_agent"),
(eq, ":is_found", 0),
(agent_is_alive, ":cur_agent"),
(agent_is_human, ":cur_agent"),
(agent_is_non_player, ":cur_agent"),
(agent_get_team ,":cur_team", ":cur_agent"),
(eq, ":cur_team", ":player_team"),
(assign, ":is_found", 1),
#(player_control_agent, ":player_no", ":cur_agent"),
(try_end),
(try_begin),
(eq, ":is_found", 1),
(call_script, "script_find_most_suitable_bot_to_control", ":player_no"),
(player_control_agent, ":player_no", reg0),
(player_get_slot, ":num_spawns", ":player_no", slot_player_spawned_this_round),
(val_add, ":num_spawns", 1),
(player_set_slot, ":player_no", slot_player_spawned_this_round, ":num_spawns"),
(try_end),
(try_end),
(try_end),
]),
multiplayer_server_spawn_bots,
multiplayer_server_manage_bots,
multiplayer_server_check_end_map,
Nameless Warrior 说:I have the latest module download on the forum which has a header operations titled "header_operations expanded v.1.0.1" but the coding is as you say different on yours. What is that version called? I just downloaded lavs and that also has the old code.
kalarhan 说:Nameless Warrior 说:I have the latest module download on the forum which has a header operations titled "header_operations expanded v.1.0.1" but the coding is as you say different on yours. What is that version called? I just downloaded lavs and that also has the old code.
VC modsys merged with Lav's headers, as operations for 1.153+ were created for the DLC. I also used it for the tweaks tool and the code can be found https://github.com/KalarhanWB/VC_Tweaks_Tool/tree/master/app
when you destroy a object it can take some time to cycle out of memory, so check the status by using a parameter like HP or a slot to filter it out. See how long they remain in use.
you can also maintain your own list of objects as they are created/destroyed, instead of relying on the engine to tell you who they are. There are even OSP code to implement lists, arrays, etc based on slots for easy coding (they are based on fake objects like a troop and slots).