Game Development Community

Rpg: Talk To Npc

by Hogie · in Torque Game Engine · 05/08/2008 (5:23 pm) · 6 replies

I was wondering if anyone knows a simple way to detect whether or not a player is close enough to a NPC to talk to that character. I want something simple: if player is close enough, press button, message box pops up. I know there is the onCollision callback, but I can't find a way for that to work how I need it to. I also know there is the RPG dialogue resource, but I don't think I want anything that complex. As always, any help is greatly appreciated. Thanks,
Hogie

#1
05/08/2008 (5:49 pm)
Yak Pak, it's in the pack. I cannot / should not, show that snippit from the pack.
But it's included as part of the whole.
#2
05/08/2008 (10:34 pm)
Also check out the RPGDialog resource or Dreamer's resource on Quests. It shows how to detect a nearby NPC to trigger a chat UI.
#3
05/09/2008 (3:05 am)
Thanks guys, I'll look through those resources
#4
05/09/2008 (7:48 am)
There's a handy-dandy script function for determining distance:
%distance = VectorDist(%player, %npc);
The function ContainerRadiusSearch would probably also be helpful to you as it can tell you which objects are within a certain distance of a certain point (like the player's location). Both of those functions are stock Torque.
#5
05/12/2008 (2:56 am)
Thanks Mark, that is certainly helpful. I was just looking through the code for the rpg dialog and couldn't make too much sense of it.
#6
05/12/2008 (3:00 am)
Do you know what the syntax for ContainerRadiusSearch is?