Jump to content

Home

Help with Trigger, please!


Seamhainn

Recommended Posts

Hello!

 

I added one Trigger in a .git file. The X-, Y-, ZPositions are 61, 45, 5. I use four PointX, -Y, -Z: (6, 7, 0), (6, -3, 0), (-4, -3, 0), (-4, 7, 0). The Template ResRef is dan13_triggartar. I made a dan13_triggartar.utt and gave TemplateResRef and Tag the same name (dan13_triggartar). The ScriptOnEnter is k_pdan_cort00.

 

k_pdan_cort00 is the following script:

 

void main() 
{
ActionStartConversation(GetFirstPC(),"dan13_cort");
}

 

dan13_cort is the existing but deleted dialog file in dan13_s.rim.

 

The dialogue does not trigger. What did I do wrong?

 

Thanks for any help!

Link to comment
Share on other sites

Are you sure the .ncs and .utt files are in the override folder or .mod file? I know this sounds obvious but it is so easy to forget to chuck them in, I've done it myself countless times, actually last week I was getting snotty with the game because my trigger wouldn't fire then I realised the script wasn't in the override folder.

 

Another thing to try is using the whereami armband somewhere inside or near the trigger to see if it's actually there, although it was designed for TSL I'm sure it works fine with KOTOR.

 

Also have you tried leaving the area and entering it again? if you've loaded a save game from inside the module - new triggers, characters etc won't show up until you enter again.

 

Hope this helps you.

 

Take Care

--Stream

Link to comment
Share on other sites

Are you sure the .ncs and .utt files are in the override folder or .mod file? I know this sounds obvious but it is so easy to forget to chuck them in, I've done it myself countless times, actually last week I was getting snotty with the game because my trigger wouldn't fire then I realised the script wasn't in the override folder.

 

Another thing to try is using the whereami armband somewhere inside or near the trigger to see if it's actually there, although it was designed for TSL I'm sure it works fine with KOTOR.

 

Also have you tried leaving the area and entering it again? if you've loaded a save game from inside the module - new triggers, characters etc won't show up until you enter again.

 

Hope this helps you.

 

Take Care

--Stream

 

Yes, I always start the module anew (annoying and time consuming!). And I put it all in a .mod file.

 

But I will take your advice and will delete the .ncs files from the .mod file and will work from the override folder step by step. Curious thing is by the way that I got the action once and after changing something (I don't know what), the conversation just refuses to trigger :-) .

 

Thanks for your help!

Link to comment
Share on other sites

I always rely on the SendMessageToPC function when I script to be sure the script is actually firing. IIRC, you should also set your trigger Faction to 1 (hostile).

void main() {
object oWho=GetEnteringObject();

if (!GetIsPC(oWho)) {
  return;
}

SendMessageToPC(oWho,"PC has entered my trigger");

if (!GetLocalBoolean(OBJECT_SELF,1)) {
  SendMessageToPC(oWho,"This trigger has already been fired so never mind.");
  return;
}

SendMessageToPC(oWho,"Trigger script commencing.");

ActionStartConversation(oWho,"my_dialog");
[color=palegreen]
// note in one of your dialog scripts, be sure to set
// the local boolean of the trigger to TRUE like:

// void main() {
//   object oTrig = GetObjectByTag("my_trigger");
//   SetLocalBoolean(oTrig,1,TRUE);
// }
[/color]

}

Link to comment
Share on other sites

I always rely on the SendMessageToPC function when I script to be sure the script is actually firing. IIRC, you should also set your trigger Faction to 1 (hostile).

void main() {
object oWho=GetEnteringObject();

if (!GetIsPC(oWho)) {
  return;
}

SendMessageToPC(oWho,"PC has entered my trigger");

if (GetLocalBoolean(OBJECT_SELF,1)) {
  SendMessageToPC(oWho,"This trigger has already been fired so never mind.");
  return;
}

SendMessageToPC(oWho,"Trigger script commencing.");

ActionStartConversation(oWho,"my_dialog");
[color=palegreen]
// note in one of your dialog scripts, be sure to set
// the local boolean of the trigger to TRUE like:

// void main() {
//   object oTrig = GetObjectByTag("my_trigger");
//   SetLocalBoolean(oTrig,1,TRUE);
// }
[/color]

}

 

Okay, I will test that out tonight. And, yes, the Faction is set to 1.

 

One more question though: WHEN exactly must I set the Trigger to 1,TRUE? Before entereing the Trigger itself I assume.

 

Thanks for the help!

Link to comment
Share on other sites

WHEN exactly must I set the Trigger to 1,TRUE? Before entereing the Trigger itself I assume.
Oops sorry I meant to not include that exclamation point. :o

 

Change: !GetLocalBoolean to GetLocalBoolean

 

I fixed the script above so now it can proceed with boolean being FALSE to start with which is the default. Later, in your dialog, you should set it to TRUE.

Link to comment
Share on other sites

Oops sorry I meant to not include that exclamation point. :o

 

Change: !GetLocalBoolean to GetLocalBoolean

 

I fixed the script above so now it can proceed with boolean being FALSE to start with which is the default. Later, in your dialog, you should set it to TRUE.

 

Thanks, tk!

 

I don't want to annoy you, but as the Trigger must be set BEFORE it is entered, how do I do that?

 

The scene is as follows:

- the pc walks arround,

- the pc encounters two jedi (Garrum and Tar'eelok) which I spawned with the .git file (works),

- if he approches those two jedi the Trigger should fire the script which starts the dialogue,

- the dialogue fires a script that the two jedi fight a few round (without any dialogue though),

- then the dialogue fires a script that the figth ends, and the "real" conversation begins,

- after the pc can speak with both jedis with different dialogue files implemented in the respective .utc files,

- of course, the fight scene should only happen once.

 

So I am having difficulties to see WHERE/HOW I can set the Trigger values for the entry.

 

I hope that makes it clear.

 

Thanks again!

Link to comment
Share on other sites

k_pdan_cort00 is the following script:

 

void main() 
{
ActionStartConversation(GetFirstPC(),"dan13_cort");
}

 

dan13_cort is the existing but deleted dialog file in dan13_s.rim.

The dialogue does not trigger. What did I do wrong?

 

I guess you want to start conversation with an NPC, correct? Your script currently attempts to start conversation with the trigger itself. I'm not sure that would work. Try assigning the Conversation action to the NPC you want to talk to instead. Like:

void main()  {
   if (!GetLocalBoolean(OBJECT_SELF, 40) && (GetEnteringObject() == GetFirstPC())) {
       object oNPC = GetObjectByTag("TagOfNPC");
       AssignCommand(oNPC, ActionStartConversation(GetFirstPC(),"dan13_cort", FALSE, 0, TRUE));
       SetLocalBoolean(OBJECT_SELF, 40, TRUE);
   }
}

 

(You should also check that it's the player who trips the trigger since it will otherwise fire for NPCs crossing it as well. And block it out once the dialog has been started so it won't happen whenever the player enters the trigger area. Local Boolean 40 is usually used for setting triggers as fired.)

Link to comment
Share on other sites

I guess you want to start conversation with an NPC, correct? Your script currently attempts to start conversation with the trigger itself. I'm not sure that would work. Try assigning the Conversation action to the NPC you want to talk to instead. Like:

void main()  {
   if (!GetLocalBoolean(OBJECT_SELF, 40) && (GetEnteringObject() == GetFirstPC())) {
       object oNPC = GetObjectByTag("TagOfNPC");
       AssignCommand(oNPC, ActionStartConversation(GetFirstPC(),"dan13_cort", FALSE, 0, TRUE));
       SetLocalBoolean(OBJECT_SELF, 40, TRUE);
   }
}

 

(You should also check that it's the player who trips the trigger since it will otherwise fire for NPCs crossing it as well. And block it out once the dialog has been started so it won't happen whenever the player enters the trigger area. Local Boolean 40 is usually used for setting triggers as fired.)

 

As a scripting deletant I am totally at a loss here. But to explain things further: the conversation shall be between two npcs, as a cutscene so to speak. Sorry, I don't know how to explain it any better.

 

Thanks anyway

Link to comment
Share on other sites

As a scripting deletant I am totally at a loss here. But to explain things further: the conversation shall be between two npcs, as a cutscene so to speak. Sorry, I don't know how to explain it any better.

 

Put the tag of one of the participant NPCs (preferably the one who has the first line in the conversation) where it says TagOfNPC in the script. This will make the NPC start the conversation with the player.

 

Then, in the dialog itself, you set the Speaker fields to the tags of the NPC who should say each respective line/node.

 

If I remember correctly you can only start dialog with creatures or placeables, while in the script you posted you were trying to start conversation with the trigger itself. ActionStartConversation() is not a generic "enter dialog mode" command, it's an action that instructs the object assigned the action to start conversing with another specified object. (In this case the player since you want to get into dialog/cutscene mode.) Action commands generally only work on objects that have an action queue.

 

Thus ActionStartConversation() would likely fail if you try to make the trigger do it. Hence you should assign the Conversation action to one of the participant NPCs instead, like in the example I posted above. :)

 

(Hopefully I haven't confused you even more now. It's hard to explain things in English sometimes. :))

Link to comment
Share on other sites

I guess you want to start conversation with an NPC, correct? Your script currently attempts to start conversation with the trigger itself. I'm not sure that would work.

Glad that was bothering you too, stoffe. It looks like some trigger scripts (such as k_bant_trig.ncs which triggers banter in KotOR1) do in fact call the ActionStartConversation function directly.

 

Using the AssignCommand has two advantages that I can see. The first is that you don't have to keep putting the Tag of the Speaker in the dialog file because it will default to whomever you put in the AssignCommand parameter. The second advantage is that you have have the trigger set its own boolean as the closing script function. I didn't have the confidence to set the boolean prior to having the trigger directly start a conversation.

 

I thought, Seamhainn, perhaps your dialog was just a cutscene with no words otherwise I would've suggested using AssignCommand as well.

Local Boolean 40 is usually used for setting triggers as fired.

IIRC, KotOR1 doesn't have boolean 40 available, but rather it was some number less than 25. Have you tested?

 

Edit: Never mind I just found this comment in k_inc_generic.nss:

//LOCAL BOOLEANS RANGE FROM 0 to 96
Carry on, carry on!
Link to comment
Share on other sites

Carry on, carry on!

 

I will, but most of the things I do scriptwise is pure guesswork, and all of the scripts are actually written by you folks. In other words - you are wonderful!

 

Take care

 

Edit: It works now, thanks to you, stoffe and tk102!

 

What I need now is a delay. Garrum and Tar'eelok are fighting now. Is there a command that just makes the game delay some seconds?

 

I hope I made myself clear this time.

 

Thanks and take care

Link to comment
Share on other sites

You can set delay if you're using tk102 dialog editor ( not sure about KT dialog editor) in the delay field.

 

I tried that. Unfortunately it did not work :-( .

 

Also I want that the two npcs face each other. One has the YOrientation 3 and looks in the same direction. But I can't get the other npc look in the opposite direction (the first npc in the face). I tried several values, but it did not work.

 

Take care

Link to comment
Share on other sites

Another approch:

 

The Trigger fires this script:

void main() 
{

!GetLocalBoolean(OBJECT_SELF, 41);
ActionStartConversation(GetFirstPC(),"dan13_cort");

SetLocalBoolean(OBJECT_SELF, 41, TRUE);

}

 

Is it possible to make the script fire as follows:

 

- fire only if DAN_JEDI_PLOT is greater then 0 AND the Trigger can ONLY ne fired by the PC

 

- else the Trigger is set to NOT TRIGGERED

 

?

 

Thanks for any help!

Link to comment
Share on other sites

Is it possible to make the script fire as follows:

- fire only if DAN_JEDI_PLOT is greater then 0 AND the Trigger can ONLY ne fired by the PC

 

- else the Trigger is set to NOT TRIGGERED

 

void main() {
   if ((GetEnteringObject() == GetFirstPC())
       && (GetGlobalNumber("DAN_JEDI_PLOT") > 0)
       && !GetLocalBoolean(OBJECT_SELF, 40))
   {
       object oSpeaker = GetObjectByTag("[color=Yellow]TagOfNPC[/color]");
       AssignCommand(oSpeaker, ActionStartConversation(GetFirstPC(),"dan13_cort"));
       SetLocalBoolean(OBJECT_SELF, 40, TRUE);
   }
}

 

Change TagOfNPC in the script to the tag of the NPC to start conversation with.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...