Effect.Init - invalid entitySolved
Hey everyone. I'm trying to spawn a Scientist and everything is hunky dory until I kill it... then server starts spamming Effect.Init - invalid entity... until I disconnect... whats wrong? Thanks. :)


using System;
using System.Collections.Generic;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("Test", "Me", 0.1)]
    [Description("Test")]

    class Test : RustPlugin
    {
		void TestR(Vector3 testPos)
		{
		BasePlayer testbotone = GameManager.server.CreateEntity("assets/prefabs/npc/scientist/scientist.prefab", testPos) as BasePlayer;
		testbotone.Spawn();
		}
		
		[ChatCommand("te")]
        void chatCommandTe(BasePlayer player, string command, string[] args)
        {
		var position = player.transform.position;
		TestR(position);
		}
    }
}​

@TTRRust

 

using System;
using System.Collections.Generic;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("Test", "Me", 0.1)]
    [Description("Test")]

    class Test : RustPlugin
    {
		void TestR(Vector3 testPos)
		{
		Scientist testbotone = GameManager.server.CreateEntity("assets/prefabs/npc/scientist/scientist.prefab", testPos) as Scientist;
		testbotone.Spawn();
		}
		
		[ChatCommand("te")]
        void chatCommandTe(BasePlayer player, string command, string[] args)
        {
		var position = player.transform.position;
		TestR(position);
		}
    }
}​


You are trying to create a entity by using the BasePlayer class which is completely wrong. BasePlayer class contains mostly only player related information.

 

Class 'HTNPlayer' is the class for the new scientists - (Military tunnel, events etc)

Class 'Scientist' is the class for the "older" scientists - (That one that patrols the barrels as example etc)

Your prefab is the old scientist. (Newer scientists have HTN in the prefab name)

Thanks man.
Locked automatically