PDA

View Full Version : Help with Trigger, please!


Seamhainn
01-16-2008, 05:15 PM
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!

Stream
01-16-2008, 05:40 PM
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

Seamhainn
01-17-2008, 01:52 AM
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!

tk102
01-17-2008, 02:15 AM
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");

// 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);
// }


}

Seamhainn
01-17-2008, 02:43 AM
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");

// 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);
// }


}

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!

tk102
01-17-2008, 02:55 AM
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.

Seamhainn
01-17-2008, 03:41 AM
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!

stoffe
01-17-2008, 08:59 AM
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.)

Seamhainn
01-17-2008, 09:43 AM
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

stoffe
01-17-2008, 10:13 AM
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. :))

tk102
01-17-2008, 11:08 AM
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 96Carry on, carry on!

Seamhainn
01-17-2008, 11:36 AM
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

sekan
01-17-2008, 02:02 PM
You can set delay if you're using tk102 dialog editor ( not sure about KT dialog editor) in the delay field.

Seamhainn
01-17-2008, 02:10 PM
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

sekan
01-17-2008, 02:22 PM
Try this script



void main()
{
NoClicksFor(5.0);
ActionPauseConversation();
DelayCommand(2.0,ActionResumeConversation());
}

Seamhainn
01-17-2008, 05:58 PM
It works like a charm now! Thanks all!

The only mistake I made is, that the timing of the spawning was wrong, but I work on that...

Take care

Seamhainn
01-19-2008, 01:18 AM
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!

stoffe
01-19-2008, 08:32 AM
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("TagOfNPC");
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.

Seamhainn
01-19-2008, 10:50 AM
Hello!

It works now as desired! Thank you so much!

Now on to to the conditionals of the dialogue tree...

Take care