Skip to main content

Project 07: Simple mission

In Project 06, you created an unguided ambient encounter. In Project 07, you build your first structured, authored mission: reach a marked destination across town before dying. You will guide the player with radar blips, draw in-world markers, display objective subtitles, handle failure and abandonment cleanly, and grant a one-time cash reward upon arrival.


The mission

Author a complete objective-based mission satisfying six operational deliverables:

  1. Initialize an authored package delivery mission on demand using a keyboard shortcut (F7).
  2. Generate an interactive radar blip with dynamic GPS route navigation leading across Los Santos.
  3. Draw a visible 3D vertical cylinder marker on the ground at the delivery coordinate every active frame.
  4. Evaluate three distinct mission outcomes: arrival success, player death failure, and zone abandonment.
  5. Award a strictly guarded one-time cash reward ($500) to Game.Player.Money upon arrival.
  6. Cleanly erase the radar blip and in-world graphics when the mission ends or when reloading.

Specifications, constraints

  • Per-frame marker rendering: Call World.DrawMarker inside OnTick because engine-rendered 3D markers persist for only a single frame.
  • GPS path routing: Set _targetBlip.ShowRoute = true to display the purple GPS path line on the radar mini-map.
  • Three discrete outcomes: Support successful arrival (distance < 2.5m), death failure (player.IsDead), and perimeter abandonment (distance > 500m).
  • One-time payout protection: Guard payment with _rewardGiven so lingering inside the marker area does not trigger repetitive payouts.
  • Zero orphan blips: Ensure _targetBlip.Delete() is called in OnAborted to avoid permanently staining the pause map.

Implementation steps

  1. Declare mission state: Define fields for _targetBlip, _targetPosition, _rewardGiven, and _missionActive.
  2. Wire lifecycle events: In the constructor, attach event handlers to KeyDown, Tick, and Aborted.
  3. Handle start input: In OnKeyDown, bind Keys.F7 to invoke StartMission().
  4. Initialize objective: In StartMission, clean up any prior state, create a yellow blip at the target position, enable ShowRoute = true, reset flags, and display an objective subtitle.
  5. Monitor conditions in OnTick:
    • Check if _missionActive is true and player exists.
    • If player.IsDead, announce failure, clean up, and exit.
    • If distance to destination exceeds 500 meters, announce abandonment, clean up, and exit.
    • Draw the vertical cylinder marker on the ground at _targetPosition.
    • If distance to destination is under 2.5 meters, call CompleteMission().
  6. Implement completion: In CompleteMission, verify !_rewardGiven, credit $500 to Game.Player.Money, display a success subtitle, and clean up.
  7. Implement cleanup: In CleanUp, delete _targetBlip if it exists and reset _missionActive = false. Call CleanUp in OnAborted.

APIs, tools to explore

  • GTA.Blip: Wrapper representing icons on the mini-map and pause map.
  • GTA.World.CreateBlip(Vector3 position): Instantiates a radar and map icon at target 3D coordinates.
  • Blip.ShowRoute: Boolean property activating real-time GPS road navigation lines leading to the blip.
  • GTA.World.DrawMarker(MarkerType type, Vector3 pos, Vector3 dir, Vector3 rot, Vector3 scale, Color color): Renders 3D geometric shapes directly in the game world for the current frame.
  • Game.Player.Money: Engine property accessing the player character's bank account and wallet.

Validation checklist

Your mod is validated when:

  • Pressing F7: A yellow blip appears on the radar with a GPS trail, and a yellow cylinder renders on the street.
  • Walking inside the cylinder: A green victory subtitle announces payment, $500 is credited once, and the blip vanishes.
  • Pressing F7 and dying: A mission failure ticker is displayed, the blip is removed, and zero money is awarded.
  • Driving more than 500 meters away: An abandonment ticker displays and the mission resets cleanly.
  • Reloading with Insert: The blip is completely removed from both the radar and the pause map.

Solution, explanations

Partner
Verified solution and code explanations

The mission, specifications, and guided steps remain 100% free and open for everyone. The complete verified reference code and production explanations are reserved for Partner members.