Author Topic: Setting variable upon a finished rest?  (Read 309 times)

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Setting variable upon a finished rest?
« on: May 22, 2014, 03:55:36 pm »


               

I wanted to have several items with unique powers, but make it so that not only they would be usable once per day, but that if a player uses one of them, he can't use any others in the same day.


 


So, naturally, simply choosing a unique power spell usable once per day as an item property won't cut it.


I wanted to achieve this with variables - using any of these items will set a specific integer on a PC to 1 and if the user has this variable set to 1, then he will receive a message that he needs to rest upon trying to use the item.


 


Here's where the problem lies. I wanted the variable to reset to 0 upon resting, but only if the PC actually completes the rest. A simple SetInteger in the OnRest event would reset this variable as soon as the player starts to rest.


 


What can I do to make the variable reset after a finished rest only? '<img'>



               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Setting variable upon a finished rest?
« Reply #1 on: May 22, 2014, 04:37:56 pm »


               

http://www.nwnlexico...stRestEventType


 


If I have a bit of time later I'll post some sample code, doing something similar to what you are, from our rest event. You can see how it basically works from the lexicon example, though.


 


Funky



               
               

               
            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
Setting variable upon a finished rest?
« Reply #2 on: May 22, 2014, 05:04:05 pm »


               

Exactly what I needed!


Thank you.