Jump to content

Home

Script question


Seamhainn

Recommended Posts

Hello!

 

What does k_act_talktrue do?

 

//:: k_act_talktrue
/*
   Sets the NPC talk to state to
   true.
*/
//:: Created By: Preston Watamaniuk
//:: Copyright (c) 2002 Bioware Corp.

#include "k_inc_debug"
#include "k_inc_utility"

void main()
{
   UT_SetTalkedToBooleanFlag(OBJECT_SELF);
}

 

Does it create conflicts with other scripts?

 

Thanks for any help

Link to comment
Share on other sites

This is a very handy script I've used it on most NPC's in a mod I'm working on.

 

When you first talk to an NPC you may want the them to tell you a load of information, like who they are and what they do etc, you'd have their dialog file with two nodes - On the first node they would tell you all this information, now you wouldn't want to hear it all again so you'd place k_act_talktrue in the script to fire field but you'd also need a conditional script which I think would be k_chk_talktrue or something like that anyway, just look through the scripts in KoTOR Tool.

 

Now when you talk the NPC for the first time the script will check to see if you've talked to them yet, which would be no and at the same time it would tell the game you have now talked to them so when you speak to them a second time, it will see that you have and move to the next node.

 

I hope this makes sense, if you're still confused just post again and I'll try explain better. You will have to double check the B]k_chk_talktrue[/b] script as I don't have either games installed on this computer and I can't remember for sure.

 

--Stream

Link to comment
Share on other sites

Okay, I get that. But how does the game "know" whom do I actually talk to?

 

The UT_SetTalkedToBooleanFlag() custom function sets local boolean number 10 on the object you pass as parameter. The corresponding UT_GetTalkedToBooleanFlag() custom function checks if local boolean number 10 has been set on the object you pass as parameter.

 

The two scripts mentioned by Deadly Stream uses these two functions with OBJECT_SELF as parameter. OBJECT_SELF refers to the object running the script. When a script is run from a dialog it is run by the object owning the dialog, i.e. the NPC you started conversation with (which doesn't necessarily have to be the one speaking on the node the script is run from, if you set a Speaker tag).

 

Thus the scripts allow you to use a standardized way of setting up two separate dialog branches for the first time you talk to an NPC, and an alternate greeting if you talk to them again ("Welcome back...").

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...