• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Does Anyone Know How to Prevent the Player from Leaving a Certain Area Without Doing a Certain Action First?

  • 7
    Posts
    5
    Years
    Hi all,

    This is probably a relatively novice subject, but I'm still inexperienced with scripting. I'm struggling with writing a script at the moment that would prevent the player from leaving a mansion without first traveling through it and interacting with a certain NPC. I tried multiple variations of setting a flag when the interaction with the NPC takes place and running a flag check when trying to leave, but it freezes my game every single time without fail, no matter what flag I set.

    Specifically, what I'm trying to accomplish is this:

    If the player tries to leave the mansion without interacting with the NPC first, he will stop, say something along the lines of "I can't leave yet, I still have to find [insert name of old man here]", then turn around and move backwards back away from the door.

    If the player has already completed the interaction, I'd like nothing to happen at all and the player to exit the mansion normally.

    Does anyone have an example script I could potentially bum, or could anyone explain this to me? Your help would be greatly appreciated.

    Thank you!
     
    Firstly, take a look at the following sections of XSE toot: Variables, Movements and Trigger Scripts.

    What I'd do, is use a repeating trigger script containing movements and your msg at the mansion exit. Then, in the desired NPC's script, set the variable used in the trigger script to something else so that it will stop repeating and the player is free to leave. Hope this helps!
     
    Oh, wow! Thanks a ton for the tutorials and the advice, I really appreciate it. I got it to work in no time with no problems at all. You're a lifesaver!
     
    Back
    Top