Hi, me again.
I tried to implement a similar system that we used to move to the target NPC before initializing dialogue to move towards the shop keeper before opening the shop. I’m close, but I’m missing something.
Shop.cs
public bool HandleRaycast(PlayerController callingController)
{
if (Input.GetMouseButtonDown(0))
{
if (Vector3.Distance(callingController.transform.position, this.transform.position) > 3)
{
callingController.GetComponent<Mover>().StartMoveAction(this.transform.position, 1);
}
else
{
callingController.GetComponent<Shopper>().SetActiveShop(this);
}
}
return true;
}
Edit: I spotted an error and have managed to get the player to move to the position without opening the UI, but now it requires a second click once you’ve arrived to open the shop UI.
I also had to disable the shop keeper’s Fighter and Combat Target scripts to stop them from killing each other. I’d like it to be possible that should the town guards become hostile, the shop keeper does too, but I can’t for the life of me figure out why she’s hostile when everyone else is docile. She’s a prefab variant of the King, and he’s not beating me to death with his wares like she is.
Any tips?
Thanks,
Mark.