Quick question about encounter triggers

I just added an encounter to an area using a normal Encounter Trigger. I just want this encounter to happen when a certain thing has been done in the journal. So I added a script at the OnEnteredScript looking like this:

void main()
{

object oPC = GetEnteringObject();

if(!GetIsPC(oPC)) return;
	
int nInt=GetLocalInt(oPC,"NW_JOURNAL_ENTRYq_summon");

if (nInt <31) return;

}

This, I suppose, works just like if you were to put a script in the OnEnter of a New Generic Trigger right? Or do you have to treat Encounters differently as supposed to other Triggers?

//	Place this on the encounter's OnEnter event.
//	Set the encounter's "Active" flag to FALSE.

void main()
{
	object oPC = GetEnteringObject();
		
	if (GetIsPC(oPC) && GetJournalEntry("q_summon", GetFirstPC()) > 30)
	{
		SetEncounterActive(TRUE);
		TriggerEncounter(OBJECT_SELF, oPC, 0, -1.0f);
	}
}
1 Like

Ok. Is that a better way to do it then, or just another way, travus?

Better.

1 Like

I don’t think that will work. At least in NWN1 it won’t. You need to make the encounter active prior to player stepping into it - that means in the moment player gets that quest update.

I tested it before posting it. Works great.

1 Like

maybe a difference between NWN1 and NWN2 or I am totally wrong…

@Shadooow Encounters got a big revamp in 2

Thanks for clarifying. I will be using your script then, travus.