You are here

We're currently evaluating new forum software that is meant to replace these here soon. Go have a look.

how do you make an on enter script only happen once

4 posts / 0 new
Last post
Bootlebat
how do you make an on enter script only happen once

To be specific I want to have an undead encounter where when the player enters it says "the tormented dead rise". It works but the text shows up every time I enter even after I killed all the undead. How do I stop this from happening?

  • up
    50%
  • down
    50%
Vanya Mia
Vanya Mia's picture

Assuming you have a script to make the player say it, use the same script to check for a variable on the area, if it is "zero" then make the player say the comment and then set the variable to "one". That way the next time the script is run it should stop when it finds the variable is no longer zero.

"I took Skill Focus: Craft Disturbing Mental Image as my feat last level." Belkar, OOTS

  • up
    50%
  • down
    50%
Proleric
Proleric's picture

...or you can set the local flag on the player. An advantage of setting local variables on clickable objects is that you can debug them with dm_dumplocals etc.

NWN and DAO adventures at http://proleric.com/

  • up
    50%
  • down
    50%
Vanya Mia
Vanya Mia's picture

Agreed, but logging in and out can remove variables stored on players, and there may be more than one player active in the module - leading to the question as to whether the text should be said for other players. It's not clear if this is for a PW or a single story module, hence my suggesting the area. If it's the later then I'd go player too.

  • up
    50%
  • down
    50%