Fat Cat
Recruit
Hello there, I want to make a non/hosting player the team leader of their team ideally by keypress, only for LAN (example, start a LAN battle with bots, NOT tick / checkbox select any to control, Press a key = all bots on your team come under control, same for 2nd player on other team).
My following codes do not work tried a few variations (looked at mbcommands Operations Page), was getting opcode errors in game, invalid player / agent / group to each code block below
Only done very basic codes for game before, do I need to use multiplayer_send_int_to_server, is my code complete garbage, can anyone please help?
Thank you.
My following codes do not work tried a few variations (looked at mbcommands Operations Page), was getting opcode errors in game, invalid player / agent / group to each code block below
Only done very basic codes for game before, do I need to use multiplayer_send_int_to_server, is my code complete garbage, can anyone please help?
Code:
multiplayer_make_agent_team_leader = (### this code gives invalid agent id.
0, 0, 0, [],
[
(this_or_next|multiplayer_is_server),
(neg|game_in_multiplayer_mode),
(key_is_down, key_minus),
##### find the player ID and their agent ID ?
# (try_for_players, ":player_no", 0),# (try_for_players, <destination>, [skip_server]), 1 skip server player entry
(try_begin),
(assign, ":player_no", reg0),# (try_for_players, <destination>, [skip_server]), 1 skip server player entry
(player_get_team_no, ":playerteam", ":player_no"),# (player_get_team_no, <destination>, <player_id>),
(player_get_agent_id, ":agent_id", ":player_no"),# (player_get_agent_id, <destination>, <player_id>),
(agent_get_team, ":playerteam", ":agent_id"),# (agent_get_team, <destination>, <agent_id>),
# (try_end),
##### now try for the bot agents...
(try_for_agents, ":bots_id"),# (try_for_players, <destination>, [skip_server]), 1 skip server player entry
(agent_is_human, ":bots_id"),
(agent_is_alive, ":bots_id"),
(agent_get_team, ":botteam", ":bots_id"),# (agent_get_team, <destination>, <agent_id>),
# (agent_get_group, ":botgroups", ":bots_id"),# (agent_get_group, <destination>, <agent_id>),### Retrieves reference to player who is currently the leader of specified bot agent.
(eq, ":botteam", ":playerteam"),# Does Value 1 = Value 2?
(try_begin),
(team_set_leader, ":playerteam", ":player_no"),# (team_set_leader, <team_no>, <new_leader_agent_id>),### tried agent_id,
# (agent_set_group, ":botgroups", ":player_no"),# (agent_set_group, <agent_id>, <player_leader_id>),### puts bot under player control MP
(str_store_string, s1, "@agent is leader ???"),
(display_message, "@{s1}"),
(try_end),
(try_end),
(try_end),
])
multiplayer_make_agent_admin = (### this code gives invalid player id.
0, 0, 0, [],
[
(this_or_next|multiplayer_is_server),
(neg|game_in_multiplayer_mode),
(key_is_down, key_equals),
##### find the player ID and their agent ID ?
# (try_for_players, ":player_no", 0),# (try_for_players, <destination>, [skip_server]), 1 skip server player entry
(try_begin),
(assign, ":agent_id", reg0),# (try_for_players, <destination>, [skip_server]), 1 skip server player entry
# (player_get_team_no, ":playerteam", ":player_no"),# (player_get_team_no, <destination>, <player_id>),
# (player_get_agent_id, ":agent_id", ":player_no"),# (player_get_agent_id, <destination>, <player_id>),
(agent_is_alive, ":agent_id"),
(agent_is_human, ":agent_id"),
(agent_get_team, ":playerteam", ":agent_id"),# (agent_get_team, <destination>, <agent_id>),
# (try_end),
##### now try for the bot agents...
(try_for_agents, ":bots_id"),# (try_for_players, <destination>, [skip_server]), 1 skip server player entry
(agent_is_human, ":bots_id"),
(agent_is_alive, ":bots_id"),
(agent_get_team, ":botteam", ":bots_id"),# (agent_get_team, <destination>, <agent_id>),
# (agent_get_group, ":botgroups", ":bots_id"),# (agent_get_group, <destination>, <agent_id>),### Retrieves reference to player who is currently the leader of specified bot agent.
(eq, ":botteam", ":playerteam"),# Does Value 1 = Value 2?
(try_begin),
(team_set_leader, ":playerteam", ":agent_id"),# (team_set_leader, <team_no>, <new_leader_agent_id>),### tried agent_id,
# (agent_set_group, ":botgroups", ":player_no"),# (agent_set_group, <agent_id>, <player_leader_id>),### puts bot under player
###(agent_set_group, ":botgroups", ":agent_id"),# # (agent_set_group, <agent_id>, <value>),### puts bot under player
(str_store_string, s1, "@any notes ???"),
(display_message, "@{s1}"),
(try_end),
(try_end),
(try_end),
])
multiplayer_make_agent_team_leader_v2 = (### this code gives invalid group id.
0, 0, 0, [],
[
(this_or_next|multiplayer_is_server),
(neg|game_in_multiplayer_mode),
(key_is_down, key_0),
(try_begin),
(assign,":agent_id"),
(get_player_agent_no,":agent_id"),
(agent_get_team, ":playerteam", ":agent_id"),# (agent_get_team, <destination>, <agent_id>),
(team_set_leader, ":playerteam", ":agent_id"),# (team_set_leader, <team_no>, <new_leader_agent_id>),### tried agent_id,
(multiplayer_send_int_to_server, multiplayer_event_agent_team_and_group_leader, slot_player_bot_type_1_wanted),
(str_store_string, s1, "@any notes ???"),
(display_message, "@{s1}"),
(try_end),
])
Thank you.