I've retaken the problen I left unsolved for my 6 fighter free for all arena fight.
As 'num_active_teams_le' doesn't work with more than 4 teams, I have to do this: finish the battle when there is only 1 fighter alive (or when the player dies, but this is an easy one). I'm trying to use try_for_agents to count the agents in the scene, taking into account that the player can spectate and not be part of the fight, I need to end the mission when there is 1 agent alive (the fighting player) or 2 agents alive (the spectating player and the winner fighter).
I tried this code for my mission:
(
"arena_fight_b",mtf_arena_fight,-1,
"You are about to enter the arena.",
[
(0,mtef_visitor_source,af_override_horse|af_override_weapons|af_override_head,0,1,[]),
(1,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
(4,mtef_visitor_source|mtef_team_2,af_override_horse,aif_start_alarmed,1,[]),
(7,mtef_visitor_source|mtef_team_3,af_override_horse,aif_start_alarmed,1,[]),
(9,mtef_visitor_source|mtef_team_4,af_override_horse,aif_start_alarmed,1,[]),
(12,mtef_visitor_source|mtef_team_5,af_override_horse,aif_start_alarmed,1,[]),
(15,mtef_visitor_source|mtef_team_6,af_override_horse,aif_start_alarmed,1,[])
],
[
(1, 3, ti_once, [(main_hero_fallen,0)],
[(assign,"$arena_fight",1),(assign,"$arena_fight_result",1),(jump_to_scene,"scn_zendar_center")]),
(1, 3, ti_once, [(store_mission_timer_a,reg(1)),(ge,reg(1),1),(assign,reg(2),0),(try_for_agents,reg(0)),(agent_is_alive, reg(0)),(agent_is_human, reg(0)),(val_add,reg(2),1),(try_end),(try_begin),(eq,"$arena_fight_spectate",0),(eq,reg(2),1),(else_try),(eq,"$arena_fight_spectate",1),(eq,reg(2),2),(try_end),(neg|main_hero_fallen,0)],
[(assign,"$arena_fight",1),(assign,"$arena_fight_result",1),(try_begin),(eq,"$arena_fight_spectate",0),(assign,"$arena_fight_pay",15),(assign,"$arena_fight_won",1),(try_end),(jump_to_scene,"scn_zendar_center")])
],
),
As you can see, I just replaced the (num_active_teams_le,1) function with the code in bold. But the mission ends at starts, because somehow the code seems to evaluate as true... I'm still trying to understand this languaje and what the operations and functions do, so I need some help to debug that code in bold (the rest of the code works fine, I've tested that).
Thanks in advance.