DarthRevan101

How to start a dialogue when the player reaches a point in an area?

Recommended Posts

I think this is roughly the 1000th question I've asked on here... Though with Lucasforums down it's harder for me to find answers. 

 

Anyway, I think that's the best way I can describe my question. Like on Tatooine, when you walk out the cave and Calo Nord begins his little speech. I assume I need to edit the .git file, or is there a way to do it through scripts? 

Share this post


Link to post
Share on other sites

What you need is a trigger combined with a script and this needs .git editing.

 

A trigger is simply an area that fires a certain script whenever something enters this area. So you'd set up the area wherever you want your conversation to be initiated and then fire a script that starts the conversation.

 

I'll quote Fair Strides explanation on setting up a trigger for you (he explained it in the chat though, so it's not the most sophisticated tutorial ever^^):

 

 


Open a .utt file in KT.

Okay, the only important parts in the first tab are the Template Resref and tag.
Set them to the same value (preferably), and then go to the second tab.

Now open KT's Text Editor.

Paste this:
 
void main()
{
object oPC = GetEnteringObject(); // Get the object that just entered the trigger's zone.

if(oPC != GetFirstPC())
{
// Nothing to worry about, the player didn't enter the trigger's area...
}
else
{
AssignCommand(oPC, ActionStartConversation(GetObjectByTag("1"), "2", 0, CONVERSATION_TYPE_CINEMATIC, 1));
}
}

 

The script above basically will be used in the OnEntered event for the trigger and checks to see if the object that triggered the script is the PC.
You'll need to replace the "1" with the tag of the NPC (keep the quotes) and if the name of the .dlg file is what's in their .utc file, replace "2" with "".

Otherwise, replace "2" with the name of the dialog file, again with the quotes.
Then you can save and compile the script.

Now enter the script's name as the OnEntered in the Trigger.

Erase any other scripts set.

After that, you can save the trigger (make sure to keep it's name the same as the template resref).

Open and edit the GIT file.

And close all the branches (hit the [ key) and then open a trigger.

Okay, now copy a trigger (right-click the main trigger's branch, above the geometry branch and select Copy) and then paste it by right-clicking on the main Triggers branch and then paste it.

Okay, without knowing jack about where you're placing this, let me give you some guidelines:

1. The XYZ coordinate things are where it's spawned.

2. The Geometry numbers are RELATIVE to the XYZ above.

So now you should be all set to at least test things. You might need to work the Geometry a bit into the right shape (you can add or delete Points, just make sure they never "cross" each other and are just one shape (like a square instead of two triangles).
After that, it's all in the script.

  • Like 2

Share this post


Link to post
Share on other sites

I am kind of surprised you saved such a mediocre tutorial! :D

 

Well, I knew I'd forgot how to do this otherwise, so I just selected the entire chat and copied it to a text file^^

The form I posted above is waaaaay better to read than what I saved back then.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.