If it helps, this is what im using for Missions for my current project, it uses Blue Phones for missions.
Code: Select all
SAVED_COUNTER Global_OnMission = 0
SAVED_COUNTER Global_MissionsPassed = 0
DECLARE_TOTAL_MISSIONS (40)
DECLARE_MISSION_FLAG (Player1, Global_OnMission)
SAVED_COUNTER Mission_TutStatus = 0 //TUTORIAL - No faction: Too easy
SAVED_COUNTER Mission_As1Status = 0 //GRAND THEFT ICE CREAM - Loonies: Easy
OBJ_DATA Global_TutorialPhone = (124.5, 130.5, 2.0) 180 PHONE
OBJ_DATA Global_AsylumPhone1 = (240.5, 17.5, 2.0) 0 PHONE
//Mission 1.
FORWARD TutSub://TUTORIAL
THREAD_TRIGGER TutSubThread = THREAD_WAIT_FOR_ANSWER_PHONE (player1, Global_TutorialPhone, TutSub:)
TutSub:
IF(Global_OnMission = 1)
DISPLAY_BRIEF (1008) //Uses Custom GXT: n!#Finish your current job first# before you try and start a new one!
Delay(20)
ENABLE_THREAD_TRIGGER (TutSubThread)
RETURN
ENDIF
LAUNCH_MISSION (wsd_tut.mis)
RETURN
//Mission 2.
FORWARD As1Sub://GRAND THEFT ICE CREAM
THREAD_TRIGGER As1SubThread = THREAD_WAIT_FOR_ANSWER_PHONE (player1, Global_AsylumPhone1, As1Sub:)
As1Sub:
IF(Global_OnMission = 1)
DISPLAY_BRIEF (1008) //Same text.
Delay(20)
ENABLE_THREAD_TRIGGER (As1SubThread)
RETURN
ENDIF
LAUNCH_MISSION (wsd_as1.mis)
RETURN
COUNTERS/Flags like Global_OnMission(checks if player's on a mission) and Global_MissionsPassed(used to display the number of missions passed in the pause screen) are handled manually after one of the missions ends.
A quick example of the tutorial mission in the project, where it shows everything done manually:
Code: Select all
//TUTORIAL MISSION
//Mission declares and counters.
CAR_DATA Tut_Taxi
COUNTER Tut_Passed = 0
COUNTER Tut_Failed = 0
FORWARD Tut_Cleanup: //Do not let this be the first thing in a mission file.
Tut_Main: //Consider this a mission file's LEVELSTART. And the stuff above this before LEVELSTART.
EXEC
//Setup criticals beforehand.
SET Global_OnMission = 1 //The player is now on a mission.
SET MissionLoop = 1
STOP_PHONE (Global_TutorialPhone) //This phone who started the mission will now stop ringing.
//Mission stuff between this and WHILE_EXEC.
Tut_Taxi = CREATE_CAR (127.5, 139.0, 2.0) -1 0 TAXI END
DISPLAY_MESSAGE (1007)
DISPLAY_BRIEF_NOW (1002)
Delay(1)
DISPLAY_BRIEF (1003)
Delay(1)
DISPLAY_BRIEF (1005)
ENDEXEC
WHILE_EXEC(MissionLoop = 1)
DO_NOWT//Just in case.
IF(IS_CHARACTER_IN_CAR (Player1, Tut_Taxi))
CLEAR_ALL_BRIEFS ()
DISPLAY_BRIEF_NOW (1006)
DISPLAY_MESSAGE (1124) //JOB COMPLETE!
ADD_SCORE (Player1, 10000)
ADD_LIVES (Player1, 94) //Dont mind this.
GIVE_WEAPON (Player1, PISTOL, 20)
CLEAR_WANTED_LEVEL (Player1)
SET Tut_Passed = 1
RETURN
ENDIF
//These IS_CAR_WRECKED or HAS_CHARACTER_DIED/ARRESTED states are here to make the mission fail if the player dies, gets arrested or wrecks the Taxi.
IF(IS_CAR_WRECKED(Tut_Taxi))
CLEAR_ALL_BRIEFS ()
DISPLAY_BRIEF_NOW (1004)
DISPLAY_MESSAGE (1125)//JOB FAILED!
SET Tut_Failed = 1
RETURN
ENDIF
IF(HAS_CHARACTER_DIED (Player1))
CLEAR_ALL_BRIEFS ()
DISPLAY_MESSAGE (1125)//JOB FAILED!
SET Tut_Failed = 1
RETURN
ENDIF
IF(HAS_CHAR_BEEN_ARRESTED (Player1))
CLEAR_ALL_BRIEFS ()
DISPLAY_MESSAGE (1125)//JOB FAILED!
SET Tut_Failed = 1
RETURN
ENDIF
ENDWHILE
RETURN //Consider each RETURN command to be the same as a main scripts LEVELEND.
//-----------------------------------CLEAN UP--------------------------------------
Tut_Cleanup: //Same deal, its kind of a second LEVELSTART. There's ussually no reason to WHILE-Loop this part though.
IF(Tut_Passed = 1) //These two handle what should happen if the mission passed or failed.
//SET Mission_TutStatus = 1//Completed
//++Global_MissionsPassed
//Global_TutorialLight = CREATE_OBJ (124.3, 130.2, 2.0) 270 GENLITE END
DISABLE_THREAD_TRIGGER(TutSubThread)
SET Global_OnMission = 0
SET MissionLoop = 0
//STOP_PHONE_RINGING (Global_TutorialPhone)
SET_PHONE_DEAD (Global_TutorialPhone)
ENDIF
IF(Tut_Failed = 1) //If the mission failed re-activate it.
SET Mission_TutStatus = 0
ENABLE_THREAD_TRIGGER(TutSubThread)
SET Global_OnMission = 0
SET MissionLoop = 0
ANSWER_PHONE (Player1, Global_TutorialPhone, -1)
ENDIF
SET Global_OnMission = 0 //And important commands before running MISSION_HAS_FINISHED.
SET MissionLoop = 0
SET Global_MissionFinished = 1
SET Tut_Passed = 0
SET Tut_Failed = 0
MISSION_HAS_FINISHED()
//Dont mind this part, normally MISSION_HAS_FINISHED is the last thing in a cleanup block.
SET Mission_TutStatus = 1//Completed
++Global_MissionsPassed
Global_TutorialLight = CREATE_OBJ (124.3, 130.2, 2.0) 270 GENLITE END
RETURN //And this can be considered the second LEVELEND.
MISSIONSTART //Here is where the mission actually starts. But you should probaly call a Subroutine from here and work it out from there.
GOSUB Tut_Main: //First call the main subroutine, that declares stuff, spawns stuff, and runs the while loop untill the mission failed or passed.
GOSUB Tut_Cleanup: //Then call this and use this to clean up leftovers from the mission. No need to delete items declared and spawned during missions, they delete themselves automatically when out of sight, if this is not an option, delete anyway. Use FORCE_CLEANUP(weaponorpickup) instead on any OBJ_DATA spawned weapons so they do get removed when complete.
MISSIONEND
In the Tutorial mission's example, it will stop working once its passed, but if its failed it will re-enable itself though, in the case of using blue phones to trigger missions i suggest stopping the phone after the mission starts, this is somewhere in the start of the mission. No idea if its needed for red/yellow or green phones though.
If this still doesnt help you i can take the liberty of translating these two dutch tutorial pages later on which are still not officially translated, they happen to contain the rather complex mission stuff.
Pages in question:
http://nl.wikigta.org/wiki/PHONEs_(GTA2)
http://nl.wikigta.org/wiki/Missie_scripten_(GTA2)
Here's whats in English so far, these are all GTA2 tutorials:
http://en.wikigta.org/index.php/Modding_(GTA2)
Edit - Link could be disfunctional, if so try this:
http://en.wikigta.org/wiki/Modding_%28GTA2%29
(Hm, has this resource ever been officially listed? Its pretty good, i learned alot from there, cranes, trains, it proved to be very accurate and easy to handle.)