Missions.send_mission_result_event
Parameters
| |
| mission_entity_id | Entity ID of the mission currently accessing the mission script |
Description
Event handler called once when a mission completes, after the result is known. It runs for every mission, with or without JSON, but not for a cancelled mission - that fires the sibling MissionEvent.SEND_MISSION_CANCELLED_EVENT instead. Its purpose is to influence the crew, or give rewards to the player, based on how the mission went.
The Python constant is MissionEvent.SEND_MISSION_RESULT_EVENT; the underlying event string is send_mission_result_text (and send_mission_cancelled_text for the cancelled sibling). Use the constants.
localization.SetTerm("en", "my_mod/patrol/result_event_good",
f"Mission finished. Everyone's [morale:{MoraleCategory.Confidence}] and [morale:{MoraleCategory.Mood}] improves!")
localization.SetTerm("en", "my_mod/patrol/result_event_bad",
f"Mission finished. Everyone's [morale:{MoraleCategory.Confidence}] and [morale:{MoraleCategory.Mood}] worsens!")
@event_handler(MissionEvent.SEND_MISSION_RESULT_EVENT)
def send_mission_result_event(mission_entity_id):
is_mission_successful = missions_api.IsMissionSuccessful(mission_entity_id)
if is_mission_successful:
characters_api.ModifyMorale(MoraleCategory.Confidence, 5)
characters_api.ModifyMorale(MoraleCategory.Mood, 5)
event_log.Create("my_mod/patrol/result_event_good")
else:
characters_api.ModifyMorale(MoraleCategory.Confidence, -5)
characters_api.ModifyMorale(MoraleCategory.Mood, -2)
event_log.Create("my_mod/patrol/result_event_bad")
Definition FlightMissionEcsInstaller.cs:7
Definition CharacterMoraleEffectPresenter.cs:7