Ground of Aces Modding
Loading...
Searching...
No Matches
Send Mission Result Event

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.

from Blindflug.FlightMission import MissionEvent
from Blindflug.Game.Characters.Morale import MoraleCategory
# Set the localized terms for the two result events
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):
# Get whether the mission is successful or not
is_mission_successful = missions_api.IsMissionSuccessful(mission_entity_id)
# Trigger different result events based on mission outcome
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