Skip to main content

6. Changing Stats in Events

Let's change some Stats c!pp

To change stats in the Event there are two methods. one to change stats for the characters and one to change the money.

The first method to change stats for characters in general is change_stats_with_modifier. That one is a label though so it has to be called appropriately. That would look like this:

label event_label (**kwargs):
    $ begin_event(**kwargs);

    $ image = convert_pattern("main", **kwargs)

    $ show_pattern("main2", **kwargs)
    person "Hi I'm a dialogue text."

    $ image.show(0)
    person "Oh another image."

    $ image.show(1)
    person "Wow such simple"

    call change_stats_with_modifier("school",
        happiness = 2, inhibition = TINY)

    $ end_event('new_daytime', **kwargs)

Here you see the change_stats_with_modifer label. First I inserted the key "school" for the character object and after that I added a set of stats with the value on how they should be changed. The Happiness-Stat will be increased by 2 and Inhibition by a tiny amount. 

To add a bit of variety I added keywords that can be used for the stat changes to change the values a little bit randomly. An overview over these keywords can be found in the method description below.

But what is that modifier in the method name? The game has a modifier system, where modifier can be created to change stat changes. This enables you to create buffs or debuffs. The income of the school is also managed by these modifiers. Documentation on how to use them can be found here.


change_stats_with_modifier(char_name: str, collection: str = 'default', **kwargs)

This method is used to change the stats for the different characters.

char_name: str

The key for the corresponding character.

The following keys are available: schoolteacherparentsecretary

collection: str = 'default'

The collection of modifiers to be used.

**kwargs

A set of stats together with the value changes. The values can be numbers or keywords defining a range of possible values.

When using keywords, a random value inside a specified range will be selected for the value change. An overview over the available keywords can be found in the table below:

KeywordRange
TINY0.1 - 0.3
SMALL0.3 - 0.5
MEDIUM0.5 - 1.0
LARGE1.0 - 3.0
GIANT3.0 - 7.0

By putting "DEC_" in front of the keywords, the values are inverted to their negative counterparts, so "DEC_TINY" for example represents a range from -0.3 to -0.1.


To change the money we use the method change_money_with_modifier. That is is much easier, you just call it and add how you want to change the value. That would look like this:

label event_label (**kwargs):
    $ begin_event(**kwargs);

    $ image = convert_pattern("main", **kwargs)

    $ show_pattern("main2", **kwargs)
    person "Hi I'm a dialogue text."

    $ image.show(0)
    person "Oh another image."

    $ image.show(1)
    person "Wow such simple"

    call change_money_with_modifier(100)

    $ end_event('new_daytime', **kwargs)

I just made it add 100 money.


change_money_with_modifier(value: int, collection: str = "default")

This method is used to change the money.

value: int

The amount on how much to change the money.

collection: str = 'default'

The collection of modifiers to be used.


That is basically everything you need to know to create basic events. Of course you should take a look in the renpy documentation on how to add dialogue, but you can pretty much see it in the examples above or check out the book about dialogue.

The system also has some more advanced stuff which you can find under Advanced Events.