Evil Speak Trigger!

Greetings ! It’s been a while since I posted on here and it’s good to see you’re all still ticking along.

I’ve got a speak trigger that’s driving me mad ! It’s set up to fire when a journal condition is met using the conversation’s conditions. So it’s always on in the variables and gets destroyed at the end of the conversation.

The npc that “owns” it was a tiny tiny rat so he’s always around and nearby when the PC treads on it but for some reason it’s not working and the rat’s gone on strike ! I can see him but he’s being badly behaved.

I changed it so a companion owns it now and it’s all a bit hit and miss. You have to run back over it a couple of times to guarantee success. It also fired the conversation in another area and crashed the game which was really weird !

So my question is… What is the most indestructible and guaranteed way to fire a speak trigger when a journal condition is met and you walk over it ?

Bear in mind that I haven’t got a clue about scripting, on enter the area stuff could be problematic due to the party being close together and that this trigger always worked before !

Thank you.

1 Like

The best way, in my experience, to fire a speak trigger, or a general trigger firing a conversation, is to use CreateIPSpeaker. I learned this quite a while ago by andysks. What I do when I want to be sure that a trigger fires a conversation, is that I place a New Generic Trigger and on the OnEnter script slot under Properties I place a code like this:

#include "ginc_ipspeaker"

void main()
{

object oPC = GetEnteringObject();

if(!GetIsPC(oPC)) return;

CreateIPSpeaker("talkingNPC", "conversation_tag", GetLocation(GetFirstPC()), 0.5f);


}

You would have to change the “talkingNPC” to the tag of the companion, and “conversation_tag” to the name of the conversation you want to fire.

Oh, and you would want a code for the trigger deleting itself, I guess. I’ve never done that but I guess you could use DeleteLocalObject as a function perhaps. KevL_s, travus or Lance_Botelle would know this for sure. I would probably use ga_destroy in a conversation and just write the tag of the trigger there at the end node of the conversation.

Edit: I also use regular speak triggers but I usually add code like the function SetCutscenemode. Why do I do that? Well, because I’ve noticed that if you run over a speak trigger, and a companion or NPC that you are to talk to are not close enough, the trigger won’t always trig the conversation. With cutscene mode the game halts, the PC can’t do anything, until the conversation starts. However, there can be bugs with this too…So, the safest way, or best way most of the times, is to use CreateIPSPeaker.

Thanks for the quick reply, it sounds like the sort of thing I need.

Only thing is it wont compile and comes up with Script9.nss(6); ERROR:UNIDENTIFIED IDENTIFIER.

I put in the right conversation and npc tag in the brackets and it’s the same as yours except for the 0.5f didn’t change colour (if that’s relevant).

To destroy the trigger I just use ga destroy on the conversation node at the end and stick in it’s tag.

p.s. Line 6 is the one with the CreateIPSpeaker bit in it on my script.

Sorry. Made a mistake in the code. This is correct:

#include "ginc_ipspeaker"

void main()
{

object oPC = GetEnteringObject();

if(!GetIsPC(oPC)) return;

CreateIPSpeaker("talkingNPC", "conversation_tag", GetLocation(GetFirstPC()), 0.5f);


}

This checks quest index and only fires once. Is that what you’re looking for?

//	Place on a generic trigger's OnEnter handler.

void main()
{
	object oPC = GetEnteringObject();
	object oRat = GetNearestObjectByTag("rat_tag");			// <--- set the rat's tag
	string sConvo = "convo_name";							// <--- set the convo file name
	
	if (!GetLocalInt(OBJECT_SELF, "DoOnce")
	 && GetJournalEntry("quest_tag", GetFirstPC()) == 11)	// <--- set quest tag and index to whatever you need
	{
		SetLocalInt(OBJECT_SELF, "DoOnce", TRUE);
		AssignCommand(oPC, ClearAllActions());
		AssignCommand(oRat, ActionStartConversation(oPC, sConvo, FALSE, FALSE));
	}
}

Since you wrote @Tsongo that you needed it to fire when a journal condition is met (which I forgot to take into account), I think you should go for travus’ script here. It would work just as well as my script I believe.

I’ve used many of travus’ scripts and he’s a genius when it comes to this. In particular, I’m using a script by him in my latest module, where I have several companions, and when you cross a trigger a conversation is supposed to start, but sometimes the game would freeze if you controlled a companion instead of the PC. His script made this totally bullet proof by jumping the companions to the main PC if they were too far behind. I, and 4760, tested this thoroughly and it never failed. And in that case he also used ActionStartConversation and ClearAllActions, so I’m not positive that you really need CreateIPSpeaker in all cases. I know that Lance_Botelle is not fond of that function, 'cause there are some limitations to it (that I can’t remember at the moment).

Thank you both very much for trying to help me. I’ve taken your advice andgalf and gone with travus’ script as it does the journal entry too. Although your one should work because the conversation has a journal condition on it’s first line.

However the second script ( travus’ one ) doesn’t compile either and comes up with a variable defined without type error on the line with the Action Start Conversation part in it.

I copied the whole thing with spaces and even got my daughter to check it as I read it out but it just wont compile.

OH NO ! I’M AN IDIOT !

I had a last check and was pressing the wrong button to compile it. I was pressing the compile results bit at the bottom and not the top “save and compile” one. So I kept getting the same answer from when I missed a bit out !

Guess what ? It works now !

This just proves how long it’s been since I messed about with the toolset. I said it was an evil trigger and it’s definitely trying to curse me.

I’ll await it’s results when I play through the module on a test and keep my fingers crossed.

Once again, many thanks to you both.

2 Likes

You’re welcome. I believe I might have played some of your modules back in the day. I believe I recognize your name. Could that be so?

You are correct and it was a long time ago that I made my modules.

I’ve started doing a big polish and tidy up job on my first campaign as it’s in need of one and deserves it so I’m relearning the toolset and trying to work out exactly what on earth I was thinking and how it all went together.

I’m mainly sticking to areas and conversations because the rest is so inter linked and like a big pile of confusing spaghetti that it’s a bit scary and something could go horribly wrong !

2 Likes

I played Bad Habits a long time ago, Tsongo. Had a lot of fun :slight_smile:

Ah, Bad Habits! Yeah, that one was good! It was about a female monk and her adoptive daughter, or something like that, I believe…or maybe it was her real daughter…

Good to have you back with us, Tsongo!

Glad you liked it. I made it because monks are my favourite class.

That one can stay as it is for eternity, it’s Serene that’s getting my assistance. I always meant to tidy it up and never got around to it.

3 Likes

I just replayed that in January. It’s still a great mod. Good luck with the update.

1 Like

If you are making changes to Serene I’ll hold off for a while replaying it. I realized I had played it in a long time and was thinking about playing it next.