Event to happen every so often
Zabikai
20 Dec 2020, 23:05Hi everyone! I'm trying to make it so they can only do X twice every time they do Y.
I have a function that counts the day it is, by adding one to the date every time they sleep, and I want the player to only be able to ask for something from an NPC twice a day. Atm all they have to do is go up to them and talk to them and the NPC will ask if they want an apple, but I want to limit this to two apples a day. How do I do it?
Thank you!

Y4T5UR0
21 Dec 2020, 07:07If I were you I probably would create a variable or attribute, let's call it x_num, which is an integer. This x_num is the number of apples the player has taken in a day. It starts at 0 each day, and every time the player asks for an apple, the x_num will increase by 1. It's going to be put on the asking script, and before the day ends, the x_num will return to 0. Oh, and don't forget to add the if script for the NPC not to give the player any more apple if x_num = 2
Basically:
'Ask' action script
if (x_num = 2) {
msg ("I'm sorry, I'm out of apples")
}
else {
// NPC giving player apple
x_num = x_num + 1
I don't know if it's going to work tho, others might come up with better idea
Zabikai
21 Dec 2020, 23:31Thank you!

Y4T5UR0
22 Dec 2020, 00:55Your welcome!