Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Got question with Function interacting with each other (im lacking little bit on python knowledge for this one)
I made a simple skill that decreases enemy attack damage by 20%. Main focus here is DEBUFFED_DAMAGE_HOLDER now when damage is reduced it will be stored in there.
Now that damage is stored in there how do I access it in another function "COOLDOWNS_CHECK(self):" to sum it up again? I know there is a way if I add it a Class but is there way around it?
def COOLDOWNS_CHECK(self): # Checks if player is debuffed and decreases the CD
if self.DMG_DEBUFF_DURATION > 0:
self.DMG_DEBUFF_DURATION -= 1
if self.DMG_DEBUFF_DURATION < 1:
self.PLAYER_DAMAGE += DEBUFFED_DAMAGE_HOLDER
Last edited by Nero on Wed Aug 16, 2017 6:29 pm, edited 1 time in total.
There's no way to do it with a local variable, by definition. If it's local to the method, it's discarded once the method returns.
There are a whole bunch of ways to pass data around between methods, but local variables don't persist outside of their scope, so unfortunately that's not something that would ever work.
it is good to know thanks for the information . In ren'py you can defined local variable and use it for the whole game so I though maybe that's the case with python code too.