How to lock an area until a certain point- SOLVED

Hopefully an easy question but beyond me.

I have two areas. I don’t want the PC and party to be able to access Area B until they finish a quest in Area A.

I created a trigger and put a restriction on the trigger not to fire unless a certain quest had been finished. It didn’t work and I’m guessing that’s because there was nothing in my script about the transition. I’d assumed that if my script didn’t fire because the restriction wouldn’t be met everything else about the transition would be fine. Not so, apparently.

I’m thinking this must be a fairly standard set of circumstances so is there an accepted ( read easy!) way to lock an area till a certain point in the plot?

1 Like

To make a transition trigger work on a condition:

  • setup destination as usual (trigger type = area transition)
  • put this code as trigger’s OnClick event handler:
// Only jump to destination if module int var JUMP_ALLOWED is TRUE
void main()
{
    if(GetLocalInt(GetModule(), "JUMP_ALLOWED"))
    {
        ExecuteScript("nw_g0_transition", OBJECT_SELF);
    }
    else
    {
        SendMessageToPC(GetEnteringObject(), "** YOU CANNOT PASS **");
    }
}

nw_g0_transition is the default transport script for triggers and doors, executed by them if module builder didn’t specify his own script (most of the cases). Code above makes that execution conditional based on the module variable JUMP_ALLOWED which you replace with your quest var.

4 Likes

Thanks. Will have a go at that.

Hmm, nearly . . .

My script now looks like this.


// Only jump to destination if module int var JUMP_ALLOWED is TRUE

void main()
{

   // Get the creature who triggered this event.
    object oPC = GetEnteringObject();

    if(GetLocalInt(oPC, "NW_JOURNAL_ENTRYThe Cave") >= 4)
    {
        ExecuteScript("nw_g0_transition", OBJECT_SELF);
    }
    else
    {
       // Have text appear over the PC's head.
    FloatingTextStringOnCreature("Hmm, I haven't spoken to the Keeper yet! I'd better do that before leaving this area, Grandad.", oPC);

    }
}

Tried it in various ways.

  1. Trigger with no script - transition works both ways.
  2. Trigger with script but NOT completing the quest - throws up correct line (although very briefly)
  3. Trigger with script + quest completed ( finished category ticked in journal, quest appears in completed tab etc.) still throws up line but transition doesn’t work.

If the transition doesn’t work then you know this check never returns true:

Make sure that you’re using correct quest tag (not name) there. If unsure, enter debug mode, type dm_dumplocals, click on PC and look at the message log.

1 Like

I’m not gonna lie. That was the problem and I should know to check that by now.

Thanks !

1 Like