GTAGames.nl

Singleplayerscript (GTA2)

Van WikiGTA - De Nederlandse Grand Theft Auto Walkthrough!
Ga naar: navigatie, zoeken

Een compleet singleplayerscript van GTA2 bevat, behalve de vereiste code van het basisscript, een uitgebreid systeem van COUNTERs, subroutines en PHONE_TEMPLATEs om de multiscripts correct te laten werken. Onderstaand script bevat een compleet systeem voor de missies van een singleplayerlevel. Het script ondersteunt twee gangs, die ieder zeven missies geven volgens de standaardmethode van GTA2. Twee van die missies (de eerste groene missies van beide gangs) zijn ingeschakeld. Daarnaast is er ruimte voor een savepunt, informatietelefoons, vijf kill frenzies, vijftig badges, een "final mission" als alle gangmissies gehaald zijn en een einddoel als de speler voldoende geld verdient heeft. Het script is gebaseerd op bil.mis.

PLAYER_PED player1 = (129.5, 127.5, 255.0) 25 0

SET_GANG_INFO ( zaibgang , 8 , pistol , machine_gun , rocket_launcher , 3 , 127.5 , 129.5 , 2.0 , 1 , vtype , 2 )
SET_GANG_INFO ( krisgang , 9 , pistol , machine_gun , flame_thrower , 6 , 130.5 , 129.5 , 2.0 , 1 , krsnabus , -1 )

OBJ_DATA zaibgang_green_phone_1 = (127.5, 133.5) 270 GREEN_PHONE
OBJ_DATA zaibgang_green_phone_2 = (126.5, 133.5) 270 GREEN_PHONE
OBJ_DATA zaibgang_yellow_phone_1 = (125.5, 133.5) 270 YELLOW_PHONE
OBJ_DATA zaibgang_yellow_phone_2 = (124.5, 133.5) 275 YELLOW_PHONE
OBJ_DATA zaibgang_red_phone = (123.5, 133.5) 270 RED_PHONE

OBJ_DATA krisgang_green_phone_1 = (130.5, 133.5) 270 GREEN_PHONE
OBJ_DATA krisgang_green_phone_2 = (131.5, 133.5) 270 GREEN_PHONE
OBJ_DATA krisgang_yellow_phone_1 = (132.5, 133.5) 270 YELLOW_PHONE
OBJ_DATA krisgang_yellow_phone_2 = (133.5, 133.5) 270 YELLOW_PHONE
OBJ_DATA krisgang_red_phone = (134.5, 133.5) 270 RED_PHONE

OBJ_DATA zaibgang_info_phone = (127.5, 129.5) 270 PHONE
OBJ_DATA krisgang_info_phone = (130.5, 129.5) 270 PHONE

SAVED_COUNTER flag_passed_zaibgang_green_1 = 0
SAVED_COUNTER flag_passed_zaibgang_green_2 = 0
SAVED_COUNTER flag_passed_zaibgang_yellow_1 = 0
SAVED_COUNTER flag_passed_zaibgang_yellow_2 = 0
SAVED_COUNTER flag_passed_zaibgang_yellow_3 = 0
SAVED_COUNTER flag_passed_zaibgang_red_1 = 0
SAVED_COUNTER flag_passed_zaibgang_red_2 = 0

SAVED_COUNTER flag_passed_krisgang_green_1 = 0
SAVED_COUNTER flag_passed_krisgang_green_2 = 0
SAVED_COUNTER flag_passed_krisgang_yellow_1 = 0
SAVED_COUNTER flag_passed_krisgang_yellow_2 = 0
SAVED_COUNTER flag_passed_krisgang_yellow_3 = 0
SAVED_COUNTER flag_passed_krisgang_red_1 = 0
SAVED_COUNTER flag_passed_krisgang_red_2 = 0

SAVED_COUNTER flag_passed_final_mission = 0

//Oorspronkelijk waren deze flags bedoeld om ervoor te zorgen dat gefaalde missies niet nogmaals gespeeld konden worden.
//Dit is in GTA2 niet gebruikt: missies geven een secundaire flag op wanneer de missie gefaald wordt, waardoor er twee sets zijn.

SAVED_COUNTER flag_failed_zaibgang_green_1 = 0
SAVED_COUNTER flag_failed_zaibgang_green_2 = 0
SAVED_COUNTER flag_failed_zaibgang_yellow_1 = 0
SAVED_COUNTER flag_failed_zaibgang_yellow_2 = 0
SAVED_COUNTER flag_failed_zaibgang_yellow_3 = 0
SAVED_COUNTER flag_failed_zaibgang_red_1 = 0
SAVED_COUNTER flag_failed_zaibgang_red_2 = 0

SAVED_COUNTER flag_failed_krisgang_green_1 = 0
SAVED_COUNTER flag_failed_krisgang_green_2 = 0
SAVED_COUNTER flag_failed_krisgang_yellow_1 = 0
SAVED_COUNTER flag_failed_krisgang_yellow_2 = 0
SAVED_COUNTER flag_failed_krisgang_yellow_3 = 0
SAVED_COUNTER flag_failed_krisgang_red_1 = 0
SAVED_COUNTER flag_failed_krisgang_red_2 = 0

SAVED_COUNTER flag_failed_final_mission = 0

SAVED_COUNTER flag_failed_zaibgang_green_1a = 0
SAVED_COUNTER flag_failed_zaibgang_green_2a = 0
SAVED_COUNTER flag_failed_zaibgang_yellow_1a = 0
SAVED_COUNTER flag_failed_zaibgang_yellow_2a = 0
SAVED_COUNTER flag_failed_zaibgang_yellow_3a = 0
SAVED_COUNTER flag_failed_zaibgang_red_1a = 0
SAVED_COUNTER flag_failed_zaibgang_red_2a = 0

SAVED_COUNTER flag_failed_krisgang_green_1a = 0
SAVED_COUNTER flag_failed_krisgang_green_2a = 0
SAVED_COUNTER flag_failed_krisgang_yellow_1a = 0
SAVED_COUNTER flag_failed_krisgang_yellow_2a = 0
SAVED_COUNTER flag_failed_krisgang_yellow_3a = 0
SAVED_COUNTER flag_failed_krisgang_red_1a = 0
SAVED_COUNTER flag_failed_krisgang_red_2a = 0

SAVED_COUNTER flag_failed_final_missiona = 0

//Dit lijkt te zijn om te bepalen dat de eerste missie van een gele/rode telefoon reeds is gehaald. Preciese werking nog niet duidelijk.
//SAVED_COUNTER flag_played_zaibgang_yellow_3 = 0
//SAVED_COUNTER flag_played_zaibgang_red_2 = 0
//SAVED_COUNTER flag_played_zaibgang_yellow_3a = 0
//SAVED_COUNTER flag_played_zaibgang_red_2a = 0

//SAVED_COUNTER flag_played_krisgang_yellow_3 = 0
//SAVED_COUNTER flag_played_krisgang_red_2 = 0
//SAVED_COUNTER flag_played_krisgang_yellow_3a = 0
//SAVED_COUNTER flag_played_krisgang_red_2a = 0

SAVED_COUNTER flag_on_mission = 0
SAVED_COUNTER flag_on_zaibgang_mission = 0
SAVED_COUNTER flag_on_krisgang_mission = 0
SAVED_COUNTER flag_on_gang_3_mission = 0 //is nodig omdat GTA2 altijd uitgaat van drie gangs. Misschien twee keer dezelfde flag opgeven in PHONE_TEMPLATE?
SAVED_COUNTER flag_zaibgang_missions_passed = 0
SAVED_COUNTER flag_krisgang_missions_passed = 0
SAVED_COUNTER flag_zaibgang_missions_failed = 0
SAVED_COUNTER flag_krisgang_missions_failed = 0
SAVED_COUNTER flag_all_missions_passed = 0
SAVED_COUNTER flag_all_missions_failed = 0
SAVED_COUNTER flag_secrets_passed = 0
SAVED_COUNTER flag_secrets_failed = 0
SAVED_COUNTER flag_game_been_saved = 0

DECLARE_GANG_ONE_MISSIONS_PASSED_FLAG ( flag_zaibgang_missions_passed )
DECLARE_GANG_TWO_MISSIONS_PASSED_FLAG ( flag_krisgang_missions_passed )
DECLARE_MISSIONS_PASSED_FLAG ( flag_all_missions_passed )

DECLARE_FINISH_SCORE ( 5000 )
DECLARE_TOTAL_MISSIONS ( 2 )
DECLARE_TOTAL_SECRETS ( 5 )

DECLARE_GANG_ONE_MISSIONS_TOTAL ( 1 )
DECLARE_GANG_TWO_MISSIONS_TOTAL ( 1 )

DECLARE_SECRETS_PASSED_FLAG ( flag_secrets_passed )
DECLARE_SECRETS_FAILED_FLAG ( flag_secrets_failed )

DECLARE_MISSION_FLAG ( player1 , flag_on_mission )
DECLARE_GANG_ONE_MISSION_FLAG ( player1 , flag_on_zaibgang_mission )
DECLARE_GANG_TWO_MISSION_FLAG ( player1 , flag_on_krisgang_mission )
DECLARE_GANG_TWO_MISSION_FLAG ( player1 , flag_on_gang_3_mission ) //Misschien nodig, misschien niet.

DECLARE_GANG_ONE_DEATH_BASE_BRIEF ( player1 , 4200 )
DECLARE_GANG_TWO_DEATH_BASE_BRIEF ( player1 , 4210 )

SAVED_COUNTER counter_all_missions_passed = 0
SAVED_COUNTER true = 1
SAVED_COUNTER false = 0
COUNTER flag_reached_finish_score = 0

//Bedoeling van deze counters is nog onduidelijk
SAVED_COUNTER zaibgang_easy_phones_killed
SAVED_COUNTER zaibgang_med_phones_killed
SAVED_COUNTER zaibgang_hard_phones_killed
SAVED_COUNTER krisgang_easy_phones_killed
SAVED_COUNTER krisgang_med_phones_killed
SAVED_COUNTER krisgang_hard_phones_killed

FORWARD ans_zaibgang_green_phone_1:
FORWARD ans_krisgang_green_phone_1:

/*
FORWARD ans_zaibgang_green_phone_2:
FORWARD ans_zaibgang_yellow_phone_1:
FORWARD ans_zaibgang_yellow_phone_2:
FORWARD ans_zaibgang_red_phone:
FORWARD ans_krisgang_green_phone_2:
FORWARD ans_krisgang_yellow_phone_1:
FORWARD ans_krisgang_yellow_phone_2:
FORWARD ans_krisgang_red_phone:
*/

FORWARD savepoint_1:
FORWARD ans_zaibgang_info_phone:
FORWARD ans_krisgang_info_phone:

//XXXXXXXXXXXXXXXXXXXXXXXXXXXX GTA 2 TOKENS FOR KILL BONUS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

OBJ_DATA gta2_token = (128.5, 123.5) 0 BONUS_TOKEN // x50. Aantal badges lijkt niet gedeclareerd te worden. Wellicht hardcoded naar vijftig per level?

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX OBJECTS FOR KILL FRENZYS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

OBJ_DATA KF_icon1 = (120.0, 119.0) 0 KILL_FRENZY
OBJ_DATA KF_icon2 = (121.0, 119.0) 0 KILL_FRENZY
OBJ_DATA KF_icon3 = (122.0, 119.0) 0 KILL_FRENZY
OBJ_DATA KF_icon4 = (123.0, 119.0) 0 KILL_FRENZY
OBJ_DATA KF_icon5 = (124.0, 119.0) 0 KILL_FRENZY

BONUS kill_frenzy_1
BONUS kill_frenzy_2
BONUS kill_frenzy_3
BONUS kill_frenzy_4
BONUS kill_frenzy_5

ONSCREEN_COUNTER kf_counter
SAVED_COUNTER counter_total
SAVED_COUNTER kf_counter_total
TIMER_DATA kf_timer

FORWARD do_kill_frenzy_1:
FORWARD do_kill_frenzy_2:
FORWARD do_kill_frenzy_3:
FORWARD do_kill_frenzy_4:
FORWARD do_kill_frenzy_5:

//XXXXXXXXXXXXXXXXXXXXXXXXXXX Zaibatsu Corporation green mission 1 XXXXXXXXXXXXXXXXXXXXXXXXXXX

THREAD_TRIGGER thr_zaibgang_green_1 = THREAD_WAIT_FOR_ANSWER_PHONE ( player1 , zaibgang_green_phone_1 , ans_zaibgang_green_phone_1: )

ans_zaibgang_green_phone_1:
DO_EASY_PHONE_TEMPLATE ( 3118 , zaibgang_green_1.mis , flag_passed_zaibgang_green_1 , flag_failed_zaibgang_green_1a , flag_on_zaibgang_mission , flag_on_gang_3_mission , flag_on_krisgang_mission , zaibgang , 0 )
RETURN

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Hare Krishna green mission 1 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

THREAD_TRIGGER thr_krisgang_green_1 = THREAD_WAIT_FOR_ANSWER_PHONE ( player1 , krisgang_green_phone_1 , ans_krisgang_green_phone_1: )

ans_krisgang_green_phone_1:
DO_EASY_PHONE_TEMPLATE ( 3098 , krisgang_green_1.mis , flag_passed_krisgang_green_1 , flag_failed_krisgang_green_1a , flag_on_krisgang_mission , flag_on_gang_3_mission , flag_on_zaibgang_mission , krisgang , 0 )
RETURN

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Save point XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

THREAD_TRIGGER thr_savepoint_1 = THREAD_WAIT_FOR_CHAR_IN_AREA (player1, 126.5, 109.5, 2.0, 3.0, 1.0, savepoint_1:)
savepoint_1:
 PERFORM_SAVE_GAME ( thr_savepoint_1 , 44.5 , 100.5 , 2.0 , 3.0 , 1.0 )
RETURN

//************************************** KILL FRENZY ONE ***********************************

THREAD_TRIGGER thr_kill_frenzy_1 = THREAD_WAIT_FOR_CHAR_IN_AREA (player1, 120.0, 119.0, 2.0, 0.2, 0.2, do_kill_frenzy_1:)

do_kill_frenzy_1:
 START_BASIC_KF_TEMPLATE ( thr_kill_frenzy_1 , 4315 , KF_icon1 , player1 , machine_gun )
 kill_frenzy_1 = START_BONUS_CHECK ( no_zone , 1800 , 40 , 0 , char , not_exclusive , by_gun , none , no_occupation )
 DO_BASIC_KF_TEMPLATE ( kill_frenzy_1 , kf_timer , 60 , kf_counter , kf_counter_total , 40 , 4315 , player1 , lives , 1 )
RETURN



//************************************* PC KILL FRENZY TWO *********************************

THREAD_TRIGGER thr_kill_frenzy_2 = THREAD_WAIT_FOR_CHAR_IN_AREA (player1, 121.0, 119.0, 2.0, 0.2, 0.2, do_kill_frenzy_2:)

do_kill_frenzy_2:
 START_BASIC_KF_TEMPLATE ( thr_kill_frenzy_2 , 4316 , KF_icon2 , player1 , machine_gun )
 kill_frenzy_2= START_BONUS_CHECK ( no_zone , 2700 , 20 , 0 , char , not_exclusive , by_gun , none , any_law_enforcement )
 DO_BASIC_KF_TEMPLATE ( kill_frenzy_2 , kf_timer , 90 , kf_counter , kf_counter_total , 20 , 4316 , player1 , lives , 1 )
RETURN

//************************************ PC KILL FRENZY THREE*********************************

THREAD_TRIGGER thr_kill_frenzy_3 = THREAD_WAIT_FOR_CHAR_IN_AREA (player1, 122.0, 119.0, 2.0, 0.2, 0.2, do_kill_frenzy_3:)

do_kill_frenzy_3:
 START_BASIC_KF_TEMPLATE ( thr_kill_frenzy_3 , 4317 , KF_icon3 , player1 , molotov )
 kill_frenzy_3 = START_BONUS_CHECK ( no_zone , 1800 , 20 , 0 , char , not_exclusive , by_molotov , none , no_occupation )
 DO_BASIC_KF_TEMPLATE ( kill_frenzy_3 , kf_timer , 60 , kf_counter , kf_counter_total , 20 , 4317 , player1 , lives , 1 )
RETURN

//************************************ PC KILL FRENZY FOUR**********************************

THREAD_TRIGGER thr_kill_frenzy_4 = THREAD_WAIT_FOR_CHAR_IN_AREA (player1, 123.0, 119.0, 2.0, 0.2, 0.2, do_kill_frenzy_4:)

do_kill_frenzy_4:
 START_BASIC_KF_TEMPLATE ( thr_kill_frenzy_4 , 4318 , KF_icon4 , player1 , molotov )
 kill_frenzy_4 = START_BONUS_CHECK ( no_zone , 2700 , 30 , 0 , car , not_exclusive , by_molotov , none , none )
 DO_BASIC_KF_TEMPLATE ( kill_frenzy_4 , kf_timer , 90 , kf_counter , kf_counter_total , 30 , 4318 , player1 , lives , 1 )
RETURN

//*********************************** PC KILL FRENZY FIVE **********************************

THREAD_TRIGGER thr_kill_frenzy_5 = THREAD_WAIT_FOR_CHAR_IN_AREA (player1, 124.0, 119.0, 2.0, 0.2, 0.2, do_kill_frenzy_5:)

do_kill_frenzy_5:
 START_BASIC_KF_TEMPLATE ( thr_kill_frenzy_5 , 4319 , KF_icon5 , player1 , rocket_launcher )
 kill_frenzy_5 = START_BONUS_CHECK ( no_zone , 1800 , 40 , 0 , char , not_exclusive , by_rocket_launcher , none , no_occupation )
 DO_BASIC_KF_TEMPLATE ( kill_frenzy_5 , kf_timer , 60 , kf_counter , kf_counter_total , 40 , 4319 , player1 , lives , 1 )
RETURN

//XXXXXXXXXXXXXXXXXXXXXXXXX Zaibatsu Corporation information phone XXXXXXXXXXXXXXXXXXXXXXXXXXX

THREAD_TRIGGER thr_zaibgang_info_phone = THREAD_WAIT_FOR_ANSWER_PHONE (player1, zaibgang_info_phone, ans_zaibgang_info_phone:)

ans_zaibgang_info_phone:
 DISPLAY_BRIEF ( 3724 ) //"We are the Hare Krishna."
 DISPLAY_BRIEF ( 3725 ) //"We hate the Zaibatsu Corporation!"
RETURN

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXX Hare Krishna information phone XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

THREAD_TRIGGER thr_krisgang_info_phone = THREAD_WAIT_FOR_ANSWER_PHONE (player1, krisgang_info_phone, ans_krisgang_info_phone:)

ans_krisgang_info_phone:
 DISPLAY_BRIEF ( 3728 ) //"We are the Zaibatsu Corporation."
 DISPLAY_BRIEF ( 3729 ) //"We hate the Hare Krishna!"
RETURN

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

LEVELSTART

IF ( flag_game_been_saved = 0 )
 DISPLAY_BRIEF ( 3230 ) // "Welcome to this level!"
 SET flag_game_been_saved = 1
ENDIF

SET_GANG_KILL_REACTION ( krisgang , zaibgang , 1 )
SET_GANG_KILL_REACTION ( zaibgang , krisgang , 1 )

SET_DEATHARREST_STATE ( player1 , ON )

WHILE ( true = 1 )
 IF ( ( counter_all_missions_passed = 14 )
 AND ( flag_on_mission = 0 ) )
 SET counter_all_missions_passed = 15
// LAUNCH_MISSION ( example_end.mis )
 ENDIF

 IF ( ( ( CHECK_SCORE_GREATER ( player1 , 4999 ) )
 AND ( flag_on_mission = 0 ) )
 AND ( flag_reached_finish_score = 0 ) )
 LEVEL_END_POINT_ARROW_AT ( arrow , 126.5 , 108.5 , 2.0 )
 SET flag_reached_finish_score = 1
 DISPLAY_BRIEF ( 3752 )
 ENDIF

 IF ( ( ( flag_reached_finish_score = 1 )
 AND ( flag_on_mission = 1 ) )
 AND ( CHECK_SCORE_GREATER ( player1 , 4999 ) ) )
 REMOVE_ARROW ( arrow )
 SET flag_reached_finish_score = 0
 ENDIF

 IF ( ( ( flag_reached_finish_score = 1 )
 AND ( flag_on_mission = 0 ) )
 AND ( NOT ( CHECK_SCORE_GREATER ( player1 , 4999 ) ) ) )
 REMOVE_ARROW ( arrow )
 SET flag_reached_finish_score = 0
 DISPLAY_BRIEF ( 3753 )
 ENDIF

 IF ( ( ( flag_reached_finish_score = 1 )
 AND ( flag_on_mission = 0 ) )
 AND ( LOCATE_CHARACTER_ANY_MEANS ( player1 , 126.5 , 108.5 , 2.0 , 1.0 , 1.0 ) ) )
 FINISH_LEVEL ( BONUS_1 )
 ENDIF
ENDWHILE

LEVELEND
Modding tutorials van Grand Theft Auto 2
Mapping Editor (Epic) · Gebouwen · Wegen · Water & animaties · Slopes · Flat tiles · Collision info · Rand van een level · Zones · Level ingame zetten
Scripting Declareren: Basisscript · Script Compiler (MIS Pad) · Codelijsten · Commando's · Voertuigen · Objecten · Geluiden · Personages · Groepen · Deuren
Programmeren: IF · WHILE · COUNTERs · Subroutines · THREAD TRIGGERs · EXEC · PARK · Kill Frenzies · PHONEs · Singleplayerscript · Missies · Jesus saves
Beide Belichting · Car shops · Cranes & crushers · Gangs · Metro · Multiplayerlevels
Bestandstypes .gci · .gmp · .gxt · .mis · .mmp · .pal · .scr · .seq · .sty · .tmp
Overig Texting · Physics (Lijst) · Texturing · Voertuigen maken · Plattegrond · Terminologie · Levels installeren
Deze pagina is online te bekijken via "http://nl.wikigta.org/wiki/Singleplayerscript_(GTA2)"