PDA

View Full Version : Talking to one, making another act as if talked to.


Masaru93
07-20-2007, 03:45 AM
Okay. What I'm trying to do is come up with a script that will fire once I talk to one of two different NPCs. I originally was going to use the standard 'k_con_talkedto' file, but since the entry for both NPCs that use that script are nearly identical in that fact that they argue amongst themselves and the PC, followed by a cold shoulder from both, I wanted to use a script that, if one was talked to, then the other would act as if I talked to him once without actually doing so.

Would I have to set a Global Boolean/Number in order to make that work, or could I do what I described without having to set one? I would have liked to use something a little bit different, but if it's possible to do the latter, I'd like to know what I'd need to edit in the 'k_con_talkedto' script to make it happen.

Either way, thanks for your advice.

Pavlos
07-20-2007, 05:09 AM
Hi there, Masaru :)

#include "k_inc_utility"

void main()
{

/*
OBJECT_SELF = the caller of the script which in this case
is the owner of the dialogue node. The logic behind this is
that if NPC1 calls it, then the local will have to be set
on NPC2 and vice versa.
*/

// The tag of NPC1
if (GetTag(OBJECT_SELF) == "NPC_Tag1") {

// The Tag of NPC2
UT_SetTalkedToBooleanFlag(GetObjectByTag("NPC_Tag2"));

}
else {

UT_SetTalkedToBooleanFlag(GetObjectByTag("NPC_Tag1"));

}

// Always set the local on OBJECT_SELF
UT_SetTalkedToBooleanFlag(OBJECT_SELF);

}

That should work but I've not tested it.

You can use the standard game resource of "k_con_talkedto" to check if either NPC has been spoken to, as normal :).