Skip to content

I want to prevent the player from exiting an area until an enemy is defeated

I'm not exactly sure how to do this, but I have a few ideas which should work:

1. After the player passes through a certain door, the door automatically closes and locks, and can't be re-opened unless you recover a key from the enemy.

2. When you enter a certain area, there are no area transitions, but after you defeat the enemy, a portal appears which allows the player to leave the area.

-

If anyone can let me know how to do either of the above, I would appreciate it.

Comments

  • ElGrilloElGrillo Member Posts: 11
    Lots of ways to do those things.
    Best place to ask build/script-related questions is usually the Neverwinter Vault discord - many helpful and knowledgeable builders, coders & modders there: https://neverwintervault.org/chat
  • ProlericProleric Member Posts: 1,282
    #1 is easy. Set up the locked door, but make the inbound transition to a waypoint just inside the door (not to the door itself). That way, the door doesn't open until you get the key from the enemy. No scripting required.

    #2 inbound transition to a waypoint. In the OnDeath script of the enemy, CreateObject to make a portal from a pre-made placeable template whose OnUsed script jumps the clicker to another waypoint. More help available at the Vault forum if needed.
  • mmatmmat Member Posts: 18
    Indeed there are many ways to do this. The following goes to do "OnAreaTransitionClick" event of any area transition (door or trigger). It's universal, since the tag of the monster is set to a variable on the door/trigger. Anything else can use the transition freely, only the player is restricted to some exit-condition
    void main()
    {
      object oPC = GetClickingObject();
      if (GetIsPC (oPC))
      {
        string bg = GetLocalString (OBJECT_SELF, "BigBadBadGuy");
        object bbbg = GetObjectByTag (bg);
        if (GetIsObjectValid (bbbg))
          {
          FloatingTextStringOnCreature ("I must not leave now, the big bad Badguy is still alive.", oPC);
          return;
          }
      }
    
      object t = GetTransitionTarget(OBJECT_SELF);
      AssignCommand (oPC, JumpToObject (t));
    }
    

Sign In or Register to comment.