EDIT: I think the reason the mecha boss in the campaign map can stop kneeling is because you call IPlayer.Kill() which
is undesirable in my situation, I want to keep the player alive
Code: Select all
private IPlayer player;
public void OnStartup()
{
player = Game.GetPlayers()[0];
player.SetInputEnabled(false);
player.AddCommand(new PlayerCommand(PlayerCommandType.DeathKneelInfinite));
Events.UpdateCallback.Start(OnUpdate);
}
private float m_kneelTimer = 0;
private void OnUpdate(float dt)
{
if (m_kneelTimer != -1)
m_kneelTimer += dt;
if (m_kneelTimer >= 3000)
{
Game.ShowChatMessage("Stop kneeling");
player.AddCommand(new PlayerCommand(PlayerCommandType.StopDeathKneel));
//player.AddCommand(new PlayerCommand(PlayerCommandType.StopAll));
//player.ClearCommandQueue();
player.SetInputEnabled(true);
m_kneelTimer = -1;
}
}