Mission objectives
A mission is more than a set of entities: it is a contract with the player. The game tells the player what to do, monitors their progress, reacts if they fail or abandon, and provides a satisfying reward upon completion.
Subtitles: cinematic narrative delivery
While ticker notifications (GTA.UI.Notification.PostTicker) are great for technical logs and subtle hints, GTA V missions deliver core dialogue and objectives using center-bottom Subtitles:
// Show a subtitle for 4000 milliseconds (4 seconds)
GTA.UI.Screen.ShowSubtitle("~y~Objective:~s~ Reach the drop-off point before rival crews spot you.", 4000);
You can use native color format codes:
~y~: Yellow (standard mission text)~r~: Red (danger / enemies)~g~: Green (allies / objectives)~b~: Blue~s~: Reset to default white
The three mission outcomes
Every mission structure must explicitly handle three distinct outcomes:
- Success: Player arrives at the objective within the rules.
- Failure: Player dies, an escort target is killed, or a required vehicle is destroyed.
- Abandonment: Player gets bored, turns around, and drives two miles in the wrong direction.
private void EvaluateMissionStatus(Ped player)
{
// Failure condition: player died
if (player.IsDead)
{
OnMissionFailed("You died.");
return;
}
// Abandon condition: walked too far away from the mission area
if (player.Position.DistanceTo(_startPoint) > 500f)
{
OnMissionAbandoned();
return;
}
// Success condition: reached the marked target
if (player.Position.DistanceTo(_targetPoint) < 2.5f)
{
OnMissionSuccess();
}
}
The one-time reward flag: memory only
In Project 07, completing the mission awards cash to the player. A common beginner bug is executing Game.Player.Money += 1000 inside OnTick when the distance check passes. Because OnTick runs 60 times a second, standing inside the marker for two seconds gives the player $120,000!
Guard the reward with a dedicated in-memory boolean flag:
private bool _rewardGiven;
private void OnMissionSuccess()
{
if (_rewardGiven)
{
return;
}
_rewardGiven = true;
Game.Player.Money += 500;
GTA.UI.Notification.PostTicker("Mission Complete: +$500 received.", false);
CleanUpMission();
}
Keep this simple: Project 07 uses an in-memory flag only. Persisting reputation and saves to disk across game restarts is covered in Project 08.
In Project 07, you build a complete timed mission from start to finish.