Create a mission
Creating a mission is tough. It is recommended that you start practicing with simple threads and work your way up instead of attempting to create a mission right away. There are many ways to create a mission so to simplify this for beginners, the rest of the article will show the basic structure of creating a working mission. The format uses Sanny Builder and should work for GTA III, Vice City, and San Andreas.
Contents |
Define your mission
First define your mission. Find
DEFINE MISSIONS
Increment that number by one. Scroll down until you see the last defined mission. Define your mission below it.
DEFINE MISSION {xxx} AT @MissionStart
where {xxx} is the mission index, one more from the previous mission.
Insert your trigger
Next create a thread that will trigger your mission to start. Find
create_thread
Insert before it
004F: create_thread @MissionTrigger |
or | create_thread @MissionTrigger |
Find
//-------------Mission 0---------------That is where the MAIN section ends and the first mission begins. Insert your trigger between that.
:MissionTrigger 0001: wait 0 ms 00D6: if 0256: player $PLAYER_CHAR defined 004D: jump_if_false @MissionTriggerEnd 00D6: if 0038: $ONMISSION == 0 004D: jump_if_false @MissionTriggerEnd 00D6: if // Place your condition to start your mission 004D: jump_if_false @MissionTriggerEnd 0417: start_mission {xxx} 0004: $ONMISSION = 1 :MissionTriggerEnd 0002: jump @MissionTrigger |
or | :MissionTrigger while true wait 0 if 0256: player $PLAYER_CHAR defined then if $ONMISSION == 0 then if // Condition to start your mission then start_mission {xxx} $ONMISSION = 1 end end end end |
where {xxx} is your mission index or the label of your mission.
Insert your mission
Last insert your mission. If you are using GTA3 or Vice City, scroll all the way to the end of the file to insert your mission. If you are using San Andreas, find
//-------------External script 0 (PLAYER_PARACHUTE)---------------That is where the last mission ends and the first external scrpt starts. Insert your mission between that.
:MissionStart 03A4: name_thread 'NAME' 0050: gosub @MissionBegin 00D6: if 0112: wasted_or_busted 004D: jump_if_false @MissionEnd 0050: gosub @MissionFailed :MissionEnd 0050: gosub @MissionCleanup 004E: end_thread :MissionBegin // This section is where you place the contents of your mission 0051: return :MissionFailed // This section is what happens after you died or got busted during your mission 0051: return :MissionCleanup // This section is where you clean up the contents of your mission so you can end it 0004: $ONMISSION = 0 00D8: mission_cleanup 0051: return |
or | :MissionStart thread 'NAME' gosub @MissionBegin if wasted_or_busted then gosub @MissionFailed end gosub @MissionCleanup end_thread :MissionBegin // Place the contents of your mission return :MissionFailed // Died or got busted during your mission return :MissionCleanup // Clean up the contents of your mission so you can end it $ONMISSION = 0 mission_cleanup return |
CLEO Mission
First of all, in order to make a CLEO mission two files are required: A .cs file which will trigger the mission this file usually includes conditions. Also, you need a .cm file which contains the code of the mission.
Example
Mission Trigger
It contains some conditions and if they are true the mission is eventually triggered.
{CLEO .cs} 0000: NOP while true wait 0 if and $ONMISSION == 0 player.defined(0) then if // your conditions then 0004: $ONMISSION = 1 0A94: start_custom_mission "MyMission" end end end
Firstly, this script checks if the player is on a mission and if he is defined. Finally if your conditions are true too the mission script is triggered.
0A94: start_custom_mission "MyMission"
- 0A94 is used to start the mission the parameter must match to the mission name without the .cm extension because the opcode will search for the file with the extension .cm. The parameter can also contain the directory of the file (starting from game\CLEO) example "Missions\MyMission".
Mission Script
{CLEO .cm} :MissionStart 03A4: name_thread "TEST" gosub @MissionBegin if wasted_or_busted then gosub @MissionFailed end gosub @MissionCleanup end_thread :MissionBegin // Place the contents of your mission return :MissionFailed // Died or got busted during your mission return :MissionCleanup // Clean up the contents of your mission so you can end it $ONMISSION = 0 mission_cleanup return
{CLEO .cm}
- This CLEO directive is used because we want the file to be compiled as a CLEO Mission(.cm).
Also in a .cm script you can use up to 1022 + 2 timers local variables instead of 32 + 2 timers.
NOTE
- In order to end a CLEO mission script you have to use 004E: end_thread instead of 0A93: end_custom_thread which is used in normal CLEO scripts.
Final note
Using this format requires you to start a new game. If you do not understand what is being said here, try looking into the Tutorial Forum for more in-depth tutorials or the Mission Coding Forum on how to understand this.
External Links
-
GTAForums: Tutorial Forum
-
GTAForums: Mission Coding for Dummies! – tutorial by Dutchy3010
| File Formats | .col • .cfg • .cut • .dff • .dat • .fxp • .gxt • .ide • .ifp • .img • .ipl • nodes*.dat • .rep • .rrr • .scm • .set • .txd |
| Documentation | Audio • Cryptography • Cutscenes • Handling.cfg • Map Listing • Mission Packs • Opcodes • Paths • Replays • Saves • Scripts |
| Tools | CLEO • Collision File Editor II • ENBSeries • G-Tools • IMG Tool • Limit Adjuster • Map Editor • San Andreas Audio Toolkit • Sanny Builder • TXD Workshop |
| Tutorials | San Andreas v2.0 Modding • How to create a mission • How to create a thread • How to use Map Editor |
| Modifications | Design Your Own Mission • Gostown Paradise • GTA: United • Myriad Islands |
| Multiplayer | gtaTournament • Multi Theft Auto • San Andreas Multiplayer • (more...) |
| Useful links | Community portal • Discussion forums • Mods on GTAGarage.com • Opcodes database |
| File Formats | .adf • .col • .cfg • .dff • .dat • .gxt • .ide • .ifp • .img/.dir • .ipl • .raw/.sdt • .rep • .scm • .txd |
| Documentation | Handling • Map Listing • Opcodes • Script Paths • Saves • Sound Effects |
| Tools | CLEO • Collision File Editor II • G-Tools • GXT Editor • IMG Tool • Limit Adjuster • KEd (map editor) • Sanny Builder (script editor) • TXD Workshop |
| Tutorials | How to create a mission • How to create a thread |
| Modifications | GTA: Liberty City • State of Liberty |
| Multiplayer | GTA:LC Multiplayer • gtaTournament • Multi Theft Auto • State Of Liberty Online • Vice City Multiplayer • Vice City Online • Multi-Vice |
| Useful links | Community portal • Discussion forums • Mods on GTAGarage.com • Opcodes database |
| File Formats | .col • .cfg • .dff • .dat • .gxt • .ide • .ifp • .img • .ipl • .scm • .txd |
| Documentation | Audio • Handling.cfg • Map Listing • Opcodes • Paths |
| Tools | CLEO • Collision File Editor II • G-Tools • IMG Tool • Map Editor • Sanny Builder • TXD Workshop • Water Editor |
| Tutorials | How to create a mission • How to create a thread • How to use Map Editor |
| Modifications | Curbshire • Real GTA • Ultimate Stunt Park • Intercity Highway |
| Multiplayer | Liberty Unleashed • Multi Theft Auto • More... |
| Useful links | Community portal • Discussion forums • Mods on GTAGarage.com • Modding GTA 3 Mobile version • Opcodes database |