The Game Modding Community - Since 2001

Mission Coding for Dummies - A Simple Mission

A Tutorial for Grand Theft Auto: San Andreas

A simple mission Like I promised, we are going to make a simple mission. First you have to make a good plan for the mission. In our example, we will spawn a car with an arrow above it. When the player gets in the car, the arrow will disappear, and the sphere where you have to drive to will appear. The player will have a baseball bat. The car is almost wrecked, and with the slightest touch it will explode. When the player is in the sphere, there have to spawn an actor, also with a baseball bat. When he sees the player, he will attack. When the actor is killed, the mission is passed, and you will get a text and $10,000. The marker will also disappear. Of course this isn't a very difficult mission, but you can make it more amusing. For example, when you add a timelimit: you have to drive fast, but may not hit anything! Or that when you get out of the car, there will be another marker on the car. Or that mission failed is when you are dead. But we will start small, with this mission! We have an idea, so we will begin coding. Like usual, we will start with a stripped file: Click First we will load everything and check if it is loaded. The actor (enemy) doesn't have to spawn, the car does. The bat has toi be given to the player, lateron also to the actor. Loading the models and spawning the car: CODE > :MODEL thread 'MODEL' //Load models 0247: load_model #GREENWOO 0247: load_model #bat 0247: load_model #BFYST 038B: load_requested_models :MODEL_LOAD if or 8248: not model #GREENWOO available 8248: not model #bat available 8248: not model #BFYST available else_jump @MODEL_SPAWN wait 0 ms jump @MODEL_LOAD :MODEL_SPAWN 0674: set_car_model #GREENWOO numberplate "ABCDEFGH" 00A5: $greenwood = create_car #GREENWOO at 2458.2483 -1659.0264 13.3047 Car.Angle($greenwood)= 270.0 0224: set_car $greenwood health_to 250 What are we missing before player has to drive? The player has to get a baseball bat and there has to be a marker above the car: CODE > 0186: $m1 = create_marker_above_car $greenwood 01B2: give_actor $PLAYER_ACTOR weapon 5 ammo 10 // Load the weapon model before using this 01B9: set_actor $PLAYER_ACTOR armed_weapon_to 5 NOw we have to wait for the player to enter the car. What happens next? You have to go to the marked place, where there should be a sphere. The marker of the car has to disappear. CODE > repeat wait 0 until Actor.InCar($PLAYER_ACTOR, $greenwood) Marker.Disable($m1) 0004: $coordinate_x = 2100.9604 0004: $coordinate_y = -1366.8369 0004: $coordinate_z = 23.9844 $coordinate = Marker.CreateIconAndSphere(0, $coordinate_x, $coordinate_y, $coordinate_z) What can happen while the player is driving to the sphere? The car can be wrecked! When the car is wrecked, there has to spawn a new car in the beginning and the player has to go back to get it. The check has to continu until the player has reached the sphere. This is perhaps a bit more complex code, but when you give it a good look, I'm sure you can make it next time by yourself! CODE > :MODEL_WRECKED wait 0 ms if 0119: car $greenwood wrecked else_jump @MODEL_END jump @MODEL_SPAWN :MODEL_END wait 0 ms if 01AE: car $greenwood sphere 0 near_point $coordinate_x $coordinate_y radius 5.0 5.0 stopped else_jump @MODEL_WRECKED This means: When the car is wrecked, jump @MODEL_SPAWN. Then you will start all over, by spawning a new car with a new arrow. When the car isn't wrecked, it will jump to MODEL_END, the second label. There it will check if the car is in the sphere. You have to make this a loop, because when you are doing it only once, the car won't be at the sphere yet. So when the car is in the neighbourhood of the sphere (radius 5.0), and the car stopped, then the code may continue. When it isn't, the code goes back to MODEL_WRECKED and check again if the car is wrecked. This continues until the car is in the sphere. When the player is in the car in the sphere, the sphere and the marker have to disappear. Also you have to spawn an actor with baseball bat, which had to attack the player. CODE > Marker.Disable($coordinate) 10@ = Actor.Create(CIVFEMALE, #BFYST, 2094.3499, -1342.9515, 23.9844) Actor.Angle(10@) = 88.44 0187: $marker = create_marker_above_actor 10@ actor.WeaponAccuracy(10@)= 100 actor.Health(10@) = 250 01B2: give_actor 10@ weapon 5 ammo 1000 // Load the weapon model before using this 01B9: set_actor 10@ armed_weapon_to 5 05E2: AS_actor 10@ kill_actor $PLAYER_ACTOR Every part of this code has been explained already in previous tutorials, if it's unclear you can look it up there. Finally, when the actor is dead, the mission is passed. You have to play a sound, put a text on the screen and add some money. The marker on the actor has to be destroyed and the models have to be unloaded: CODE > repeat wait 0 ms until actor.Dead(10@) 0394: play_music 1 01E3: show_text_1number_styled GXT 'M_PASS' number 10000 time 5000 style 1 // MISSION PASSED!~n~~w~$~1~ Player.Money($PLAYER_CHAR) += 10000 0249: release_model #GREENWOO 0249: release_model #BAT 0249: release_model #BFYST Marker.Disable($marker) Every part of this code has also been explained in previous tutorials. Don't forget to add the "end_thread" to stop the thread. Then you are finished. CODE > end_thread When you put this all together: Click. Now you can try your mission! Perhaps it isn't the most difficult mission, but who cares? You have to start small! So it shows, that with some simple codes, you can already make a nice mission. The limitions of the posibilities are not your coding-skills, but your creativity.


None found


Share banner
Image URL:
HTML embed code:
BB embed code:
Markdown embed code:


Original Authors


Arman Ossi Loko avatar
Arman Ossi Loko username pic Joined 11y ago
65,381 points Ranked 57th
65 medals 11 legendary 16 rare
  • GTAV First Adopter Medal icon
  • Submitted 15 Tools Medal icon
  • Submitted 30 Tutorials Medal icon
  • 1st place - 2015 Uberstyles Contest Medal icon
  • Achieved Admin clearance Medal icon
  • 15+ Entries! GameBanana’s Christmas Giveaway 2015 Medal icon

Arman Ossi Loko avatar
Arman Ossi Loko
KOPASSUS Incorporated Flag
KOPASSUS Incorporated

Are you the owner? Request Ownership
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!



Difficulty Level
Beginner Difficulty



  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+


  • 0 Posts
  • 6y Submitted
  • 4y Modified


  • Not yet rated
Sign up to access this!

Attention Gamer! Mascot

GameBanana is one of the oldest mod sites on the net. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation - send modders points.
  • Post: Give modders your thoughts on their work.
  • Vote: Help your favorite modders win monthly awards.
  • Rate: Rate mods and help them stand out.
  • Flag: Alert moderators and warn members of problems with mods.
  • Watch: Get notified when mods are updated.

Join the community! Sign up now!

Already a Bananite? Login tracking pixel