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:
- Initialize an authored package delivery mission on demand using a keyboard shortcut (
F7). - Generate an interactive radar blip with dynamic GPS route navigation leading across Los Santos.
- Draw a visible 3D vertical cylinder marker on the ground at the delivery coordinate every active frame.
- Evaluate three distinct mission outcomes: arrival success, player death failure, and zone abandonment.
- Award a strictly guarded one-time cash reward ($500) to
Game.Player.Moneyupon arrival. - Cleanly erase the radar blip and in-world graphics when the mission ends or when reloading.
Specifications, constraints
- Per-frame marker rendering: Call
World.DrawMarkerinsideOnTickbecause engine-rendered 3D markers persist for only a single frame. - GPS path routing: Set
_targetBlip.ShowRoute = trueto 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
_rewardGivenso lingering inside the marker area does not trigger repetitive payouts. - Zero orphan blips: Ensure
_targetBlip.Delete()is called inOnAbortedto avoid permanently staining the pause map.
Implementation steps
- Declare mission state: Define fields for
_targetBlip,_targetPosition,_rewardGiven, and_missionActive. - Wire lifecycle events: In the constructor, attach event handlers to
KeyDown,Tick, andAborted. - Handle start input: In
OnKeyDown, bindKeys.F7to invokeStartMission(). - Initialize objective: In
StartMission, clean up any prior state, create a yellow blip at the target position, enableShowRoute = true, reset flags, and display an objective subtitle. - Monitor conditions in
OnTick:- Check if
_missionActiveis 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().
- Check if
- Implement completion: In
CompleteMission, verify!_rewardGiven, credit $500 toGame.Player.Money, display a success subtitle, and clean up. - Implement cleanup: In
CleanUp, delete_targetBlipif it exists and reset_missionActive = false. CallCleanUpinOnAborted.
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
F7and 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.