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. It should work for GTA3, Vice City, and San Andreas.
Define your mission
First define your mission. Find <source lang="scm">DEFINE MISSIONS</source> Increment that number by one. Scroll down until you see the last defined mission. Define your mission below it. <source lang="scm">DEFINE MISSION ### AT @MissionStart</source>
Insert your trigger
Next create a thread that will trigger your mission to start. Find <source lang="scm">create_thread</source> Insert before it <source lang="scm">004F: create_thread @MissionTrigger</source> Find <source lang="scm">//-------------Mission 0---------------</source> That is where the MAIN section ends and the first mission begins. Insert your trigger between that. <source lang="scm">: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 ### 0004: $ONMISSION = 1
0002: jump @MissionTrigger</source>
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 <source lang="scm">//-------------External script 0 (PLAYER_PARACHUTE)---------------</source> That is where the last mission ends and the first external scrpt starts. Insert your mission between that. <source lang="scm">:MissionStart 03A4: name_thread 'NAME' 0050: gosub @MissionBegin 00D6: if 0112: wasted_or_busted 004D: jump_if_false @MissionEnd 0050: gosub @MissionFailed
0050: gosub @MissionCleanup 004E: end_thread
// This section is where you place the contents of your mission 0051: return
// This section is what happens after you died or got busted during your mission 0051: return
// 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</source>
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.
| Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.|
See Grand Theft Wiki:Copyright for more information.