It would be great to have CreateNPC() method also with some other general return value (e.g. ulong as userID) than HumanPlayer. Then we could call it directly from other plugins.
Call CreateNPC externally?Solved
when ya creat you get the human player you should be able to pull the info to get the userID example
var humanPlayer = HumanNPC?.Call("FindHumanPlayerByID", Npc.userID);
var npcID = humanPlayer.info.userid;
You should be able to pull any info from the humanplayer even when you spawn one you will get humanPlayer so can pull the info from that also.
var humanPlayer = HumanNPC?.Call("FindHumanPlayerByID", Npc.userID);
var npcID = humanPlayer.info.userid;
You should be able to pull any info from the humanplayer even when you spawn one you will get humanPlayer so can pull the info from that also.
Thanks for your reply. My point is the creation as my plugin should create a brand new NPC by click button or automatically after wipe. So I wanted something like
var humanplayer = HumanNPC?.Call("CreateNPC", player.transform.position, player.transform.rotation);
but humanplayer is null. So I tried all parameters...
var humanplayer = HumanNPC?.Call("CreateNPC", player.transform.position, player.transform.rotation, "NPC", 0);
but humanplayer is null. I also tried the call ftom your reply
var humanplayer = HumanNPC?.Call("FindHumanPlayerByID", 485905734);
but it is null as well. I think that I can't call your method as I my plugin doesn't know HumanPlayer type.
I just added this method to your plugin
var humanplayer = HumanNPC?.Call("CreateNPC", player.transform.position, player.transform.rotation);
but humanplayer is null. So I tried all parameters...
var humanplayer = HumanNPC?.Call("CreateNPC", player.transform.position, player.transform.rotation, "NPC", 0);
but humanplayer is null. I also tried the call ftom your reply
var humanplayer = HumanNPC?.Call("FindHumanPlayerByID", 485905734);
but it is null as well. I think that I can't call your method as I my plugin doesn't know HumanPlayer type.
I just added this method to your plugin
private ulong CreateNPCDealer(Vector3 position, Quaternion currentRot, string name)
{
HumanPlayer humanPlayer = CreateNPC(position, currentRot, name);
return humanPlayer.info.userid;
}
and now I get exactly what I wanted. My idea was to implement that by default as it woudl be useful for devs.
i will add in on next update..
public object CreateNPCHook(Vector3 position, Quaternion currentRot, string name = "NPC")
{
HumanPlayer humanPlayer = CreateNPC(position, currentRot, name);
if (humanPlayer == null) return null;
return humanPlayer.info.userid;
} Perfect! Thanks
Locked automatically