Ok, i think i figured out, what was the cause.
I'm using Devil Islands custom map and it came with a plugin called:
FOffNavmeshSpam.
Tried to disable the plugin and manually spawn scientist npc inside buildings, because i could not do that either and it worked.
As i can see the plugin avoid spamming messages ov invalid navmesh position, i think maybe the custom map is not well polished.
I will try with procedural map to see if the issue is solved.
Is there any chance to deactivate that plugin while inside of raidablebases? maybe a fragment of code i can use to add the exception on raidablebases ?
Thx for advantage.
using UnityEngine;
using UnityEngine.AI;
namespace Oxide.Plugins
{
[Info("FOffNavmeshSpam", "bmgjet", "1.0.0")]
[Description("Stops the navmesh spamming for bots")]
public class FOffNavmeshSpam : RustPlugin
{
void OnEntitySpawned(BaseNetworkable entity)
{
BaseNavigator baseNavigator = entity.GetComponent<BaseNavigator>();
if (baseNavigator != null)
{
Vector3 pos;
if (!baseNavigator.GetNearestNavmeshPosition(entity.transform.position + (Vector3.one * 2f), out pos, (baseNavigator.IsSwimming() ? 30f : 6f)))
{
baseNavigator.topologyPreference = (TerrainTopology.Enum)TerrainTopology.EVERYTHING;
BasePlayer bp = null;
bp = entity as BasePlayer;
if (bp != null){ClipGround(bp, baseNavigator);}
}
}
}
private void ClipGround(BasePlayer bp, BaseNavigator baseNavigator)
{
NavMeshHit hit;
if (NavMesh.SamplePosition(bp.transform.position, out hit, 30, (int)baseNavigator.topologyPreference))
{
bp.gameObject.layer = 17;
baseNavigator.Warp(hit.position);
bp.SendNetworkUpdateImmediate();
}
NextTick(() =>
{
Vector3 pos;
if (!baseNavigator.GetNearestNavmeshPosition(bp.transform.position + (Vector3.one * 2f), out pos, (baseNavigator.IsSwimming() ? 30f : 6f)))
{
Puts("No Navmesh found @ " + pos.ToString() + " bot will be stationary to stop spam.");
baseNavigator.CanUseNavMesh = false;
}
});
}
}
}