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

Missions.send_mission_event

Parameters

mission_entity_id Entity ID of the mission currently accessing the mission script

Description

Event handler called while the flight is in the air, once per progress report. The reports are spread evenly over the flight: each game minute the game computes floor(elapsed / completion time × count) and fires this handler whenever that number grows, where count is 3 for a mission with JSON and the value of get_mission_events_count for a mission without. The flight length comes from the JSON or from get_completion_time.

Inside the handler, missions_api.GetNumberOfEventsSent(mission_entity_id) already includes the current report, so the first call sees 1, never 0.

The handler is intended for relaying how the mission is going, for making the as-planned and skill rolls, or for influencing the crew at the base. default_mission.py uses the first report for the as-planned roll and the second for the skill roll.

from Blindflug.FlightMission import MissionEvent
localization.SetTerm("en", "my_mod/patrol/event_1", "The formation is approaching the target.")
localization.SetTerm("en", "my_mod/patrol/event_2", "The formation is over the target.")
localization.SetTerm("en", "my_mod/patrol/event_3", "The formation is returning.")
@event_handler(MissionEvent.GET_MISSION_EVENTS_COUNT)
def get_mission_events_count(mission_entity_id):
return 3
@event_handler(MissionEvent.SEND_MISSION_EVENT)
def send_mission_event(mission_entity_id):
# Get the number of reports sent so far, including this one (1, 2, 3, ...)
events_sent_count = missions_api.GetNumberOfEventsSent(mission_entity_id)
# Send out an event log entry for this report
event_log.Create("my_mod/patrol/event_{}".format(events_sent_count))
Definition FlightMissionEcsInstaller.cs:7