Define Trigger:
- We add a trigger that fires periodically to check for the condition. This might not be the most efficient approach for all scenarios, but it works as a simple example.
triggers = [
# Existing triggers
(24, # Trigger fires every 24 hours
[
(check_quest_active, "qst_deliver_letter"),
(quest_slot_eq, "qst_deliver_letter", slot_quest_current_state, 1), # State 1 means completed
(quest_get_slot, ":target_lord", "qst_deliver_letter", slot_quest_target_troop),
(call_script, "script_change_player_relation_with_troop", ":target_lord", 5), # Increase relation
(call_script, "script_end_quest", "qst_deliver_letter"),
]
),
# Any other triggers you want to keep
]
Modify Scripts:
- Open or create a
module_scripts.py (if customization is needed beyond what triggers offer). Here's how you could script a relation change, though it's simplified since relation change is already handled in the base game scripts.
scripts = [
# Other scripts
("change_player_relation_with_troop",
[
(store_script_param_1, ":troop_id"),
(store_script_param_2, ":value"),
(troop_get_slot, ":relation", ":troop_id", slot_troop_player_relation),
(val_add, ":relation", ":value"),
(troop_set_slot, ":troop_id", slot_troop_player_relation, ":relation"),
(str_store_troop_name, s1, ":troop_id"),
(assign, reg0, ":relation"),
(display_message, "@Your relation with {s1} has changed to {reg0}."),
]),
# Other scripts
]