Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Script question

Page: 1 of 1
 Seamhainn
01-13-2008, 2:14 AM
#1
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
 Stream
01-13-2008, 4:33 AM
#2
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
 Seamhainn
01-13-2008, 4:39 AM
#3
Okay, I get that. But how does the game "know" whom do I actually talk to?
 Stream
01-13-2008, 4:56 AM
#4
I'm not exactly sure how it works I just know it does - I think it's to do with Boolean's which I know nothing about but I think it records the Tag or ResRef of the NPC.

--Stream
 stoffe
01-13-2008, 9:28 AM
#5
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...").
 Darth Xander
01-13-2008, 9:53 AM
#6
Okay, I get that. But how does the game "know" whom do I actually talk to?I don't think that that specific script is assigned to a specific npc it just works for the speaker of the node which you only want "said" once.
Page: 1 of 1