[Help] [Solved] player_spawn_new_agent operation

Users who are viewing this thread

Hi everyone, I have an issue with the operation player_spawn_new_agent.

I have created a new multiplayer game mode and what I want is when I press a menu button, the player who pressed this button spawn.
I want a way to spawn the player character because I've already try to spawn a bot and then the player control it and set the player face keys on the bot but the troop_set_face_keys operation don't seems to work too...


Code:
      (1, 0, 0, [],
        [
          (multiplayer_is_server),
          (get_max_players, ":num_players"),
          (try_for_range, ":player_id", 0, ":num_players"),
          (player_is_active, ":player_id"),
          (neg|player_is_busy_with_menus, ":player_id"),
            (try_begin),
              (player_slot_eq, ":player_id", slot_player_to_spawn, 1),
              (player_spawn_new_agent, ":player_id", 0),
              (player_set_slot, ":player_id", slot_player_to_spawn, 0),
            (try_end),
          (try_end),
        ]),

This piece of code is working (I can spawn things with it), it's just the player_spawn_new_agent operation don't do annything.

Also I dont have put the trigger ti_after_mission_start in my game mode.

Edit: This post is not solved at all, I've missclick the button and I dont know how to set it to unsolved...
 
Last edited:
face_keys require the head to be covered then uncovered to reset, so something like

Python:
# # # The Player take over bot script above, after the facecode change specifically # # #

(agent_get_item_slot, ":head_armor", ":bot_agent", 4), # Store their helmet

(agent_unequip_item, ":bot_agent", ":head_armor", 4), # Unequip their current helmet
(agent_equip_item, ":bot_agent", "itm_some_full_helm", 4), # Equip a helmet with itp_covers_head
(agent_unequip_item, ":bot_agent", "itm_some_full_helm", 4), # Unequip that item

(agent_equip_item, ":bot_agent", ":head_armor", 4),    # Equip the original helmet

# # # The rest of the script here # # #

Should allow you to use your original variation where you spawned a bot then took it over.

I don't do MP so I really cannot help more than this, but as we all know the best way to get a correct answer online it to provide the wrong one.
 
Upvote 0
Yeah thank you this is a good workaround and I understand how face keys work now :grin:
But it doesn't matter that agent_equip_item and agent_unequip_item is only for weapons ?

But I would like to use the operation player_spawn_new_agent instead but I don't know why when I use it nothing happen.
 
Upvote 0
Back
Top Bottom