jik
Knight
OK. I've seen 2 ways to spawn troops during a battle. First, I looked at the way it's done in the melee fights:
the gist is they use this : (add_visitors_to_current_scene, ":random_entry_point", ":added_troop", 1),
The only issue I see with this is it's hard to set the teams as you need to know the agents, so you'd have to check each one. This is what they do in the melee fights and it's not bad since the numbers only get up to 7. In my mission template, I hope to get up to around 65 (including the player team) agents, and I don't want to do more overhead than needed.
I did see something similar to this posted:
I did this but it doesn't seem to do anything. I ran to each spawn (entry) point and found no one. Am I doing something wrong? Which way is better?
(0.2, 0, 0,
[
(eq, "$g_mt_mode", abm_training),
(assign, ":num_active_fighters", 0),
(try_for_agents, ":agent_no"),
(agent_is_human, ":agent_no"),
(agent_is_alive, ":agent_no"),
(agent_get_team, ":team_no", ":agent_no"),
(is_between, ":team_no", 0 ,7),
(val_add, ":num_active_fighters", 1),
(try_end),
(lt, ":num_active_fighters", 7),
(neg|main_hero_fallen),
(store_mission_timer_a, ":cur_time"),
(this_or_next|ge, ":cur_time", "$g_arena_training_next_spawn_time"),
(this_or_next|lt, "$g_arena_training_num_agents_spawned", 6),
(num_active_teams_le, 1),
(lt, "$g_arena_training_num_agents_spawned", "$g_arena_training_max_opponents"),
],
[
(assign, ":added_troop", "$g_arena_training_num_agents_spawned"),
(store_div, ":added_troop", "$g_arena_training_num_agents_spawned", 6),
(assign, ":added_troop_sequence", "$g_arena_training_num_agents_spawned"),
(val_mod, ":added_troop_sequence", 6),
(val_add, ":added_troop", ":added_troop_sequence"),
(val_min, ":added_troop", 9),
(val_add, ":added_troop", "trp_arena_training_fighter_1"),
(assign, ":end_cond", 10000),
(get_player_agent_no, ":player_agent"),
(agent_get_position, pos5, ":player_agent"),
(try_for_range, ":unused", 0, ":end_cond"),
(store_random_in_range, ":random_entry_point", 32, 40),
(neq, ":random_entry_point", "$g_player_entry_point"), # make sure we don't overwrite player
(entry_point_get_position, pos1, ":random_entry_point"),
(get_distance_between_positions, ":dist", pos5, pos1),
(gt, ":dist", 1200), #must be at least 12 meters away from the player
(assign, ":end_cond", 0),
(try_end),
(add_visitors_to_current_scene, ":random_entry_point", ":added_troop", 1),
(store_add, ":new_spawned_count", "$g_arena_training_num_agents_spawned", 1),
(store_mission_timer_a, ":cur_time"),
(store_add, "$g_arena_training_next_spawn_time", ":cur_time", 14),
(store_div, ":time_reduction", ":new_spawned_count", 3),
(val_sub, "$g_arena_training_next_spawn_time", ":time_reduction"),
]),
[
(eq, "$g_mt_mode", abm_training),
(assign, ":num_active_fighters", 0),
(try_for_agents, ":agent_no"),
(agent_is_human, ":agent_no"),
(agent_is_alive, ":agent_no"),
(agent_get_team, ":team_no", ":agent_no"),
(is_between, ":team_no", 0 ,7),
(val_add, ":num_active_fighters", 1),
(try_end),
(lt, ":num_active_fighters", 7),
(neg|main_hero_fallen),
(store_mission_timer_a, ":cur_time"),
(this_or_next|ge, ":cur_time", "$g_arena_training_next_spawn_time"),
(this_or_next|lt, "$g_arena_training_num_agents_spawned", 6),
(num_active_teams_le, 1),
(lt, "$g_arena_training_num_agents_spawned", "$g_arena_training_max_opponents"),
],
[
(assign, ":added_troop", "$g_arena_training_num_agents_spawned"),
(store_div, ":added_troop", "$g_arena_training_num_agents_spawned", 6),
(assign, ":added_troop_sequence", "$g_arena_training_num_agents_spawned"),
(val_mod, ":added_troop_sequence", 6),
(val_add, ":added_troop", ":added_troop_sequence"),
(val_min, ":added_troop", 9),
(val_add, ":added_troop", "trp_arena_training_fighter_1"),
(assign, ":end_cond", 10000),
(get_player_agent_no, ":player_agent"),
(agent_get_position, pos5, ":player_agent"),
(try_for_range, ":unused", 0, ":end_cond"),
(store_random_in_range, ":random_entry_point", 32, 40),
(neq, ":random_entry_point", "$g_player_entry_point"), # make sure we don't overwrite player
(entry_point_get_position, pos1, ":random_entry_point"),
(get_distance_between_positions, ":dist", pos5, pos1),
(gt, ":dist", 1200), #must be at least 12 meters away from the player
(assign, ":end_cond", 0),
(try_end),
(add_visitors_to_current_scene, ":random_entry_point", ":added_troop", 1),
(store_add, ":new_spawned_count", "$g_arena_training_num_agents_spawned", 1),
(store_mission_timer_a, ":cur_time"),
(store_add, "$g_arena_training_next_spawn_time", ":cur_time", 14),
(store_div, ":time_reduction", ":new_spawned_count", 3),
(val_sub, "$g_arena_training_next_spawn_time", ":time_reduction"),
]),
the gist is they use this : (add_visitors_to_current_scene, ":random_entry_point", ":added_troop", 1),
The only issue I see with this is it's hard to set the teams as you need to know the agents, so you'd have to check each one. This is what they do in the melee fights and it's not bad since the numbers only get up to 7. In my mission template, I hope to get up to around 65 (including the player team) agents, and I don't want to do more overhead than needed.
I did see something similar to this posted:
(store_random_in_range,":spawn_here",35,46), ##use entry_points 35-45 for random out of the back spawns
(entry_point_get_position,pos2,":spawn_here"),
(set_spawn_position, pos2),
(spawn_agent,"trp_novice_fighter"), ##This operation spawns the agent ID to reg0
(assign,":cur_agent",reg0),
(agent_set_team, ":cur_agent", 1), ##Player' group should be team 0, enemies are team 1
(val_add,"$total_spawned",1), ##Up the count of spawned
(display_message,"@enemy Spawned"),
(entry_point_get_position,pos2,":spawn_here"),
(set_spawn_position, pos2),
(spawn_agent,"trp_novice_fighter"), ##This operation spawns the agent ID to reg0
(assign,":cur_agent",reg0),
(agent_set_team, ":cur_agent", 1), ##Player' group should be team 0, enemies are team 1
(val_add,"$total_spawned",1), ##Up the count of spawned
(display_message,"@enemy Spawned"),
I did this but it doesn't seem to do anything. I ran to each spawn (entry) point and found no one. Am I doing something wrong? Which way is better?