Difference between revisions of "Create a mission"
(→External Link) |
(updating page) |
||
Line 1: | Line 1: | ||
− | Creating a mission is tough. It is recommended that you start practicing with [[Create_a_thread|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]] | + | Creating a mission is tough. It is recommended that you start practicing with [[Create_a_thread|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. |
− | ==Define your mission== | + | |
+ | == Define your mission == | ||
First define your mission. Find | First define your mission. Find | ||
<source lang="scm">DEFINE MISSIONS</source> | <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. | Increment that number by one. Scroll down until you see the last defined mission. Define your mission below it. | ||
− | <source lang="scm">DEFINE MISSION | + | <source lang="scm">DEFINE MISSION {xxx} AT @MissionStart</source> |
+ | where {xxx} is the mission index, one more from the previous mission. | ||
+ | |||
==Insert your trigger== | ==Insert your trigger== | ||
Next create a thread that will trigger your mission to start. Find | Next create a thread that will trigger your mission to start. Find | ||
<source lang="scm">create_thread</source> | <source lang="scm">create_thread</source> | ||
Insert before it | Insert before it | ||
− | <source lang="scm">004F: create_thread @MissionTrigger</source> | + | {| style="margin-right:auto" |
+ | | width="500px" | <source lang="scm"> | ||
+ | 004F: create_thread @MissionTrigger | ||
+ | </source> | ||
+ | | width="100px" style="text-align:center" | or | ||
+ | | width="500px" | <source lang="scm"> | ||
+ | create_thread @MissionTrigger | ||
+ | </source> | ||
+ | |} | ||
+ | |||
Find | Find | ||
<source lang="scm">//-------------Mission 0---------------</source> | <source lang="scm">//-------------Mission 0---------------</source> | ||
That is where the MAIN section ends and the first mission begins. Insert your trigger between that. | That is where the MAIN section ends and the first mission begins. Insert your trigger between that. | ||
− | <source lang="scm">:MissionTrigger | + | {| style="margin-right:auto" |
+ | | width="500px" | <source lang="scm"> | ||
+ | :MissionTrigger | ||
0001: wait 0 ms | 0001: wait 0 ms | ||
00D6: if | 00D6: if | ||
Line 24: | Line 38: | ||
// Place your condition to start your mission | // Place your condition to start your mission | ||
004D: jump_if_false @MissionTriggerEnd | 004D: jump_if_false @MissionTriggerEnd | ||
− | 0417: start_mission | + | 0417: start_mission {xxx} |
0004: $ONMISSION = 1 | 0004: $ONMISSION = 1 | ||
:MissionTriggerEnd | :MissionTriggerEnd | ||
− | 0002: jump @MissionTrigger</source> | + | 0002: jump @MissionTrigger |
+ | </source> | ||
+ | | width="100px" style="text-align:center" | or | ||
+ | | width="500px" | <source lang="scm"> | ||
+ | :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 | ||
+ | </source> | ||
+ | |} | ||
+ | where {xxx} is your mission index or the label of your mission. | ||
==Insert your mission== | ==Insert your mission== | ||
Line 34: | Line 72: | ||
<source lang="scm">//-------------External script 0 (PLAYER_PARACHUTE)---------------</source> | <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. | That is where the last mission ends and the first external scrpt starts. Insert your mission between that. | ||
− | <source lang="scm">:MissionStart | + | {| style="margin-right:auto" |
+ | | width="600px" | <source lang="scm"> | ||
+ | :MissionStart | ||
03A4: name_thread 'NAME' | 03A4: name_thread 'NAME' | ||
0050: gosub @MissionBegin | 0050: gosub @MissionBegin | ||
Line 58: | Line 98: | ||
0004: $ONMISSION = 0 | 0004: $ONMISSION = 0 | ||
00D8: mission_cleanup | 00D8: mission_cleanup | ||
− | 0051: return</source> | + | 0051: return |
+ | </source> | ||
+ | | width="100px" style="text-align:center" | or | ||
+ | | width="500px" | <source lang="scm"> | ||
+ | :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 | ||
+ | </source> | ||
+ | |} | ||
==Final note== | ==Final note== | ||
Line 66: | Line 135: | ||
* {{GTAF|403790|Mission Coding for Dummies!}} – tutorial by {{U|Dutchy3010}} | * {{GTAF|403790|Mission Coding for Dummies!}} – tutorial by {{U|Dutchy3010}} | ||
− | {{SA | + | {{N|SA|VC|3}} |
− | [[Category:Mission Scripting | + | [[Category:Mission Scripting]] |
Revision as of 22:17, 5 February 2012
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 |
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