Ground of Aces Modding
Loading...
Searching...
No Matches
Get Mission Result Text

Missions.get_mission_result_text

Parameters

mission_entity_id Entity ID of the mission currently accessing the mission script

Returns

String The localization key for the mission result text, or the text itself.

Description

Event handler that returns the localization key used to display the mission result in the mission result window. It is called for every mission, with or without JSON, when the result window opens for a completed flight; a cancelled mission shows its own text and does not call it. A mission with JSON and no .py of its own gets this handler from default_mission.py, which returns the missions/<id>/…_transmission key matching the ending. A key of the form missions/<id>/<suffix> is resolved against the mission's _raw* fields as well, so a copied JSON mission with raw text works without registering terms.

from Blindflug.FlightMission import MissionEvent
# Set the localized terms for the two result texts
localization.SetTerm("en", "my_mod/patrol/result_good", "The patrol returned with useful intel.")
localization.SetTerm("en", "my_mod/patrol/result_bad", "The patrol saw nothing but weather.")
@event_handler(MissionEvent.GET_MISSION_RESULT_TEXT)
def get_mission_result_text(mission_entity_id):
is_mission_successful = missions_api.IsMissionSuccessful(mission_entity_id)
# Return the key for the localized mission result text based on mission outcome
if is_mission_successful:
return "my_mod/patrol/result_good"
else:
return "my_mod/patrol/result_bad"
Definition FlightMissionEcsInstaller.cs:7

⚠️ Localization key needs to be unique to avoid conflicts with other localization entries - prefix it with your mod's name ⚠️