Solved Teleporting a BaseNPC?

Discussion in 'Rust Development' started by Reynostrum, Aug 31, 2016.

  1. I am trying to teleport a BaseNPC.
    With BasePlayer you can do (from some plugin, i don't remember which one):
    Code:
                player.MovePosition(position);
                if (player.net?.connection != null) player.ClientRPCPlayer(null, player, "ForcePositionTo", position);
                player.TransformChanged();
                if (player.net?.connection != null) player.SetPlayerFlag(BasePlayer.PlayerFlags.ReceivingSnapshot, true);
                player.UpdateNetworkGroup();
                player.SendNetworkUpdateImmediate(false);
                if (player.net?.connection == null) return;
                try { player.ClearEntityQueue(null); } catch { }
                player.SendFullSnapshot();
    But I have no idea how to teleport a BaseNPC. I am doing it by killing the npc and spawning on other position but I was wondering if is possible to teleport a BaseNPC.
     
  2. Does 'npc.transform.position = newposition' not work?
     
  3. Yes it work. Thank you!