Skip to content
Exodia edited this page Sep 21, 2023 · 58 revisions

INFO: with ch_talkobj_dict={"character_id" : TalkObject(conversation_background ="bg character_id location_id talk") you can customize some checks: Talk System

IMPORTANT: To get the list of character icons, the tool relies on ch_talkobj_dict, in case a you want to vacation the chance to talk with the character a stratagem is: ch_talkobj_dict={"alice" : None}

IMPORTANT: in case no particular value is set, default icon will be set based on dictionary key of ch_talkobj_dict, Explained here: Character icon


Routine

Commitment

The Commitment class is the fundamental element.

Usage

INFO: For don't create problems if you not implement this in your project, the df_routine are not defined by default empty. BUT not save the changes.

For implement this you need to add this in your project:

init python:
    from pythonpackages.nqtr.routine import Commitment
    from pythonpackages.nqtr.action_talk import TalkObject

# habitual routine
# dictionary that cannot be modified at runtime, only by modifying the code. (content is not based on saves, but from the code)
define df_routine = {
}

Add an Commitment in dictionary

Recommended

(code-snippets: DR_RoutineAdd_in_dict)

# dictionary editable at runtime, but it is strongly discouraged to pre-enter elements (dictionary contents are based only on saves)
default routine = {}

# habitual routine
# dictionary that cannot be modified at runtime, only by modifying the code. (content is not based on saves, but from the code)
define df_routine = {
    "alice_sleep" : Commitment(
        ch_talkobj_dict={
            "alice" : TalkObject(
                name="talk_alice_sleep",
                label_name="talk_sleep",
                conversation_background = None,
            ),
        },
        hour_start=20, hour_stop=10,
        location_id="house", room_id="alice_room",
        background ="bg alice roomsleep",
    ),
    "alice_read" : Commitment(
        ch_talkobj_dict={
            "alice" : TalkObject(
                name="talk_alice_read",
                conversation_background ="bg alice terrace talk"
            ),
        },
        hour_start=10, hour_stop=20,
        location_id="house", room_id="terrace",
        background ="bg alice terrace",
    ),
    # alice_go_school have more priority than alice_read, because it is after alice_read
    "alice_go_school" : Commitment(
        ch_talkobj_dict={
            "alice" : None,
        },
        hour_start=10, hour_stop=14,
        location_id="school",
        disabled="not_weekend",
    ),
}

Add an Commitment

(code-snippets: DR_RoutineAdd)

routine["stagealice1"] = Commitment(ch_talkobj_dict={"alice" : None}, hour_start=14, hour_stop=20, location_id="house", room_id="terrace")

Disabled

For disable a commitment you can use the property disabled. This property can be set to bool or a string.

If is string: you can put a key of flags ( the sistem get the value of flag). Explained here: Flags - Ability to edit flags in constants

Exemple:

define df_routine = {
    "alice_read" : Commitment(
        ch_talkobj_dict={
            "alice" : TalkObject(
                name="talk_alice_read",
                conversation_background ="bg alice terrace talk"
            ),
        },
        hour_start=10, hour_stop=20,
        location_id="house", room_id="terrace",
        background ="bg alice terrace",
    ),
    # alice_go_school have more priority than alice_read, because it is after alice_read
    "alice_go_school" : Commitment(
        ch_talkobj_dict={
            "alice" : None,
        },
        hour_start=10, hour_stop=14,
        location_id="school",
        disabled="not_weekend",
    ),
}

Events

IMPORTANT: in case at the end of the event the same event occurs again the event will be deleted (to avoid loops). to not delete it you can use some stratagems with these functions: Methods for closing a label

By Events we mean: a label that is automatically started as soon as the player is in a certain position and/or at a certain time and/or based on the disabled check.

To implement it simply pass it by parameter to a Commitment event_label_name

Add an Event in dictionary

Recommended

(code-snippets: DR_EventAdd_in_dict)

Add an Event

(code-snippets: DR_EventAdd)

Add event by if

If you want to add an event based on a condition, you can use the label check_event_custom.

For example:

label check_event_custom:
    # Custom code
    # if (cur_room == ...):
        # ...
    return

Priority

Returns the commitments of the ch (NCPs) in that Location at that time. Prioritize the special commitment and then the first commitment found.

Clone this wiki locally