Frenzies in GTA 2 Coding
Only a handful of people do kill frenzies in a map, and I can see why. The amount of coding for one kill frenzy is quite remarkable, and I’m going to try and explain some of it.
Firstly, a kill frenzy is either on foot or by a vehicle (like a tank). The usual token for a kill frenzy is shown below:
Frenzies applied to vehicles do not use the animated token, you just get the vehicle parked there without any indication of what it contains. “Frenzies are like a box of chocolates; you never know what you're gonna get.” And quite rightly.
What else do we need? First, we need to declare a BONUS check for every kill frenzy you have, a TIMER_DATA so that you can set the time for the player to do your kill frenzy in, a SAVED_COUNTER for storing number of kills etc and an ONSCREEN_COUNTER to show the player how many targets he has left (e.g. 12 people to kill).
Before you start, count how many kill frenzies you are going to have (this can be updated later anyway). Then, before the LEVELSTART command, add the DECLARE_TOTAL_SECRETS command. Let’s say we had two kill frenzies, the code would look like this:
DECLARE_TOTAL_SECRETS ( 2 )
Now, you need to create two SAVED_COUNTER commands, one for how many secrets failed, and the other for how many secrets passed. So, you could have them like this:
SAVED_COUNTER secrets_passed
SAVED_COUNTER secrets_failed
You also need to make a DECLARE_SECRETS_PASSED_FLAG and a DECLARE_SECRETS_FAILED commands. Both of these are COUNTER objects. Now, you can create the kill frenzy (or car) and now a THREAD_TRIGGER which is used on all kill frenzies. In the trigger, you need to specify the commands in it, which are START_BASIC_KF_TEMPLATE, killfrenziename = START_BONUS_CHECK and finally DO_BASIC_KF_TEMPLATE.
The START_BASIC_KF_TEMPLATE tells it to find a thread_trigger_name, use these weapons, a text_brief, item used (icon or car), player_name, weapon_type. So, your code is actually this:
START_BASIC_KF_TEMPLATE ( thread_trigger_name , text_brief , item_name , player_name , weapon_type )
To explain these parameters:
| Value | Description |
|---|---|
thread_trigger_name | Starts this kill frenzy. Also disables it so that you can’t do it over and over again! |
text_brief | Used for giving the player a description of what to do, e.g. “Kill 30 peds with a pistol in 2 minutes!”. |
item_name | What item you used, either a KF or a vehicle. Automatically deletes it except in the vehicle KF types.
|
player_name | The player! |
weapon_type | If a weapon is chosen, it will have infinite ammo. Otherwise, set to NO_WEAPON.
|
To find out what rewards you can give the player, please load up your GTA2 Scripting.doc file and head to page 74. This shows you the various types of bonuses, and is too lengthy to explain here. As a note, time is 30 for a second. One minute would be a time value of 1800 in the case of kill frenzies.
Bonusname = START_BONUS_CHECK ( zone , time , count , score , type , exclusive_mode , damage_type , attack_model , character_occupation )
Once the above has completed, you can now call up the following command:
DO_BASIC_KF_TEMPLATE ( bonus_name , timer_name , time_limit , on_screen_counter , kills_remaining_counter, kills_total, text_brief_ID , player_name , reward_type , reward_value )
Looks complicated? It probably is. Once you create your first successful KF, the rest will come easy (possibly). Briefly, the parameters do this
| Value | Description |
|---|---|
bonus_name | Name of the BONUS used for the KF, also checks if it is finished (passed or failed)/
|
timer_name | A previously declared TIMER_DATA used for all KF types. This is shown on screen.
|
time_limit | How much time does the player have? Place real time seconds here (30 seconds would still be 30 here)! |
onscreen_counter | A previously decalred ONSCREEN_COUNTER.
|
kills_remaining | A previously decalred SAVED_COUNTER used to store hits left to do which is displayed on the on-screen counter/
|
kills_total | What is the total value of kills needed? This is right at the start, and all kills will be deducted from this/ |
text_brief_ID | Same as in the START_BASIC_KF_TEMPLATE.
|
reward_type | When reward given to the player upon completing the KF.
|
Available values for reward_type are:
| Value | Description |
|---|---|
NOTHING | Player gets sod all! |
SCORE | Add money. |
LIVES | Add this number of lives, which is the default. |
MULT | Multiplier. |
reward_value | Amount of reward. |
NOTHING | No reward is given. |
If you don’t understand a word of what I’ve been muttering (I can’t blame you, these KFs are hard to do!), then read the following example. This will have two kill frenzies, one with a machine gun, and one driving a tank. All this gets placed before the LEVELSTART command by the way.
Example Frenzies
Here is an example of a Flamethrower Frenzy and also a Tank Frenzy. I have added a comment to any objects or sections of commands which are specific to either frenzy; the rest is global.
// Items for all KFs
ONSCREEN_COUNTER kf_counter
SAVED_COUNTER kf_counter_total
TIMER_DATA kf_timer
// Declarations
DECLARE_TOTAL_SECRETS ( 2 )
SAVED_COUNTER kf_passed = 0
SAVED_COUNTER kf_failed = 0
DECLARE_SECRETS_PASSED_FLAG ( kf_passed )
DECLARE_SECRETS_FAILED_FLAG ( kf_failed )
// Items for KFs
OBJ_DATA kf01_icon = ( X , Y , Z ) 0 kill_frenzy // for Flamethrower
OBJ_DATA kf02_tank = ( X , Y , Z ) 270 kill_frenzy // for Tank
// Bonus declarations
BONUS kf01 // for Flamethrower
BONUS kf02 // for Tank
// Forwarding KFs
FORWARD do_kf01: // for Flamethrower
FORWARD do_kf02: // for Tank
// Thread triggers for KFs
THREAD_TRIGGER thread_kf01 = THREAD_WAIT_FOR_CHAR_IN_AREA ( player1 , X , Y , Z , search height , search width , do_kf01: ) // for Flamethrower
THREAD_TRIGGER thread_kf01 = THREAD_WAIT_FOR_CHAR_IN_AREA ( player1 , X , Y , Z , search height , search width , do_kf01: ) // for Tank
// Subroutines of triggers
// Kill 30 people in 60 seconds with a flame thrower!
do_kf01:
START_BASIC_KF_TEMPLATE ( thread_kf01 , text-id , kf01_icon , player1 , flame_thrower )
kf01 = START_BONUS_CHECK ( no_zone , 1800 , 30 , 0 , char , not_exclusive , by_flamethrower , none , no_occupation )
DO_BASIC_KF_TEMPLATE ( kf01 , kf_timer , 60 , kf_counter , kf_counter_total , 30 , text-id , player1 , score , 10000 )
RETURN
// Destroy 10 cop cars with the tank in 60 seconds!
do_kf02:
START_BASIC_KF_TEMPLATE ( thread_kf02 , text-id , kf02_tank , player1 , tank_gun )
kf02 = START_BONUS_CHECK ( no_zone , 1800 , 10 , 0 , car , not_exclusive , by_rocket_launcher , TANK , COPCAR )
DO_BASIC_FK_REMPLATE ( kf02 , kf_timer , 60 , kf_counter , kf_counter_total , 10 , text-id , player1 , lives , 1 )
RETURN
Just use variations of these to make your own! And don’t forget to put in real coordinates by the way.
(Originally written by Chris “Pyro” Hockley and formatted by Ben “Cerbera” Millard with full permission.)