Aller au contenu

Photo

NPCs speaking to each other


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Ellychid32

Ellychid32
  • Members
  • 37 messages
So basically I am trying to create a simple script using the GetNextCreature fuction which checks which NPC is next to an NPC and then they start a discussion with each other. Is there any examples where I can find someone who has done this /or/ how can this be achieved?

Thank you.

#2
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
GetNearestObject is the function you're looking for.

#3
bealzebub

bealzebub
  • Members
  • 352 messages
Here's what I use. It is for specific Npcs though, not for who ever is closest.

#include "ginc_group"

void main()
{
object oNpc1 = GetNearestObjectByTag("npc1");
object oNpc2 = GetNearestObjectByTag("npc2");

if (IsMarkedAsDone() == FALSE )

if (GetIsPC(GetEnteringObject()) == TRUE )
{
AssignCommand(oNpc1, ActionStartConversation(oNpc2, "bark_npc", FALSE, FALSE, TRUE, TRUE));
MarkAsDone();
}
else return;
}

#4
Dann-J

Dann-J
  • Members
  • 3 161 messages
I recently discovered that randomly wandering NPCs will occasionally start mimed conversations all by themselves. It seems that if two wandering non-hostile creatures in the same faction bump into each other head-on, they start playing conversation animations to each other for a while. I couldn't believe my eyes when two of my verbeegs started chatting to each other without me having to script anything.

Of course, hoping that two randomly wandering NPCs will just happen to collide head-on is a bit optimistic, so scripting it to happen might be a better option. :)

Modifié par DannJ, 26 janvier 2012 - 09:28 .


#5
Guest_Iveforgotmypassword_*

Guest_Iveforgotmypassword_*
  • Guests
DannJ... I'm going to have fun with my waypoints now !

#6
kamal_

kamal_
  • Members
  • 5 260 messages

DannJ wrote...

I recently discovered that randomly wandering NPCs will occasionally start mimed conversations all by themselves. It seems that if two wandering non-hostile creatures in the same faction bump into each other head-on, they start playing conversation animations to each other for a while. I couldn't believe my eyes when two of my verbeegs started chatting to each other without me having to script anything.

Of course, hoping that two randomly wandering NPCs will just happen to collide head-on is a bit optimistic, so scripting it to happen might be a better option. :)

If you have these variables on the npc, it will happen automatically and regularly, it's built into the game's default scripts.
X2_L_SPAWN_USE_AMBIENT_IMMOBILE = 1
X2_L_SPAWN_USE_AMBIENT = 1

If the second one is on, the npc will wander around some, and react appropriately for things llike store, point of interest, and inn waypoints.

#7
Dann-J

Dann-J
  • Members
  • 3 161 messages

kamal_ wrote...
If you have these variables on the npc, it will happen automatically and regularly, it's built into the game's default scripts.
X2_L_SPAWN_USE_AMBIENT_IMMOBILE = 1
X2_L_SPAWN_USE_AMBIENT = 1

If the second one is on, the npc will wander around some, and react appropriately for things llike store, point of interest, and inn waypoints.


I was simply testing some Verbeegs to see what they looked like fully equipped (spear and shield) and moving about, so I replaced the default OnSpawn script with the one that causes creatures to wander randomly (called something like gp_wander from memory). I suspect that script sets the second variable you mentioned above (and possibly the first as well).