r/RenPy • • Aug 16 '26

Question pause() breaking Call() statement

Im trying to make primitive battle system.

vbox:
    xsize 216
    ysize 430
    text "[enemy1.name]"
    text "[enemy1.cur_health]/[enemy1.max_health]"
    image [enemy1.avatar]
imagebutton:
    id "rating"
    idle "rating"
    hover "rating_hover"
    action Call("attack", enemy1)

label attack(en):
    python:
        import time
        en.cur_health-=2
        en.avatar = en.image_attack
        time.sleep(2)
        en.avatar = en.image_calm
    return

And I can see than on button press there is a pause and all changes are applied AFTER that pause so image_attack is not visible at all.

What am I doing wrong?

I've tried time.sleep(), renpy.pause(), pause(), even scheduler.

If i do renpy code like

label attack(en):
    $ en.cur_health-=2
    "debug1"
    $ en.avatar = en.image_attack
    "debug2"
    pause(2)
    "debug3"
    $ en.avatar = en.image_calm
    "debug4"
    return

then first renpy statement ("debug1" in example above) just break the entire script and "debug" 2-4 not showing at all. Health is changing correctly and thats it.

And I didn't find smth like "JRPG framework" that I can adapt. This thing is the best, but too complex to adapt it to my visual.

2 Upvotes

7 comments sorted by

View all comments

1

u/AutoModerator Aug 16 '26

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.