Hi there! So I have been attempting to make a script that would regenerate stats in real-time (ie, on the overworld your health would slowly regenerate, in battle you would regain MP, etc). Unfortunately, despite my many efforts, I can't make it work.
Right now, my biggest priority is creating a simple script that would slowly give players TP in battle, so that the longer the battle lasted, the more complex skills they could use, yadda yadda. I tried doing:
def tp_gain while true do self.tp +=1 sleep(2) endendThis was under the game_battler class. Unfortunately, I couldn't get it to work. I am not sure if this is a problem with the code itself (I think it looks sound, but I could not code myself out of a wet paper bag) or a problem with calling the method. When I tried putting tp_gain into initialize, it caused problems with the actor class. What am I doing wrong? If someone doesn't want to write a whole script for me, that's fine, I would also take advice that could push me in the right direction.
Right now, this is what I have:
def gain_tp time = $game_system.playtime time += 2 update_tpenddef update_tp while true do if Time.now >= time self.tp += 1 break elsif Time.now < time return endend gain_tp end
Any advice? I apologize for my coding. I've only been coding a couple of months, and I understand I am very bad at it.
Right now, my biggest priority is creating a simple script that would slowly give players TP in battle, so that the longer the battle lasted, the more complex skills they could use, yadda yadda. I tried doing:
def tp_gain while true do self.tp +=1 sleep(2) endendThis was under the game_battler class. Unfortunately, I couldn't get it to work. I am not sure if this is a problem with the code itself (I think it looks sound, but I could not code myself out of a wet paper bag) or a problem with calling the method. When I tried putting tp_gain into initialize, it caused problems with the actor class. What am I doing wrong? If someone doesn't want to write a whole script for me, that's fine, I would also take advice that could push me in the right direction.
Right now, this is what I have:
def gain_tp time = $game_system.playtime time += 2 update_tpenddef update_tp while true do if Time.now >= time self.tp += 1 break elsif Time.now < time return endend gain_tp end
Any advice? I apologize for my coding. I've only been coding a couple of months, and I understand I am very bad at it.