Frenzies in GTA 2 Mission Scripts

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.

Providing a Frenzy

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:

Kill Frenzy icon.

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.

Required Objects

It starts with a vehicle or a powerup. Now all we need is…a hell of lot, actually!

Parameters
GENERATOR or CAR_DATA The powerup or vehicle which begins the frenzy.
BONUS Sets what the player must do to complete the frenzy. One for each kill frenzy.
TIMER_DATA Sets the time limit. One for each kill frenzy.
SAVED_COUNTER Storing number of kills while on a frenzy. Shared by all frenzies.
ONSCREEN_COUNTER Shows the player how many targets remain (e.g. 12 people to kill). Shared by all frenzies.
DECLARE_TOTAL_SECRETS Number of kill frenzies in your level.
SAVED_COUNTER Number of kill frenzies the player has passed.
SAVED_COUNTER Number of kill frenzies the player has failed.

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 a DECLARE_SECRETS_PASSED_FLAG and a DECLARE_SECRETS_FAILED. Both of these are COUNTER objects.

Required Commands

Then you can create the kill frenzy (either a powerup or a vehicle) and a THREAD_TRIGGER which is used on all kill frenzies. In the subroutine which is started by the THREAD_TRIGGER, you need to specify these essential commands, in this order:

  1. START_BASIC_KF_TEMPLATE
  2. START_BONUS_CHECK
  3. DO_BASIC_KF_TEMPLATE.

START_BASIC_KF_TEMPLATE

Tells the game to find a thread_trigger_name, use these weapons, a BRIEF_ID, item used (icon or car), player_name, weapon_type. So, your code is actually this:

START_BASIC_KF_TEMPLATE (thread_trigger_name, BRIEF_ID, item_name, player_name, WEAPON_TYPE)
Parameters
thread_trigger_nameStarts this kill frenzy. Also disables it so that you can’t do it over and over again!
BRIEF_IDUsed for giving the player a description of what to do, e.g. “Kill 30 peds with a pistol in 2 minutes!”.
item_nameWhat item you used, either a KF or a vehicle. Automatically deletes it except in the vehicle KF types.
player_nameThe player!
WEAPON_TYPEIf a weapon is chosen, it will have infinite ammo. Otherwise, set to NO_WEAPON.

START_BONUS_CHECK

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)

(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.)

Once the above has completed, you can now call up the next command.

DO_BASIC_KF_TEMPLATE

DO_BASIC_KF_TEMPLATE (bonus_name, timer_name, time_limit, on_screen_counter, kills_remaining_counter, kills_total, 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).

Parameters
bonus_nameName of the BONUS used for the KF, also checks if it is finished (passed or failed)/
timer_nameA previously declared TIMER_DATA used for all KF types. This is shown on screen.
time_limitHow much time does the player have? Place real time seconds here (30 seconds would still be 30 here)!
onscreen_counterA previously decalred ONSCREEN_COUNTER.
kills_remainingA previously decalred SAVED_COUNTER used to store hits left to do which is displayed on the on-screen counter/
kills_totalWhat is the total value of kills needed? This is right at the start, and all kills will be deducted from this/
BRIEF_IDSame as in the START_BASIC_KF_TEMPLATE.
reward_typeWhen reward given to the player upon completing the KF.
Values for REWARD_TYPE
NOTHINGPlayer gets sod all!
SCOREAdd money.
LIVESAdd this number of lives, which is the default.
MULTMultiplier.
IntegerNumber of points to give.

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 = (127.0,127.0,255.0) 000 KILL_FRENZY // for Flamethrower
OBJ_DATA kf02_tank = (129.0,129.0,255.0) 270 KILL_FRENZY // for Tank

// Bonus declarations
BONUS kf01 // for Flamethrower
BONUS kf02 // for Tank

// Make subroutines available to THREAD_TRIGGER
FORWARD do_kf01: // for Flamethrower
FORWARD do_kf02: // for Tank

// THREAD_TRIGGER for KFs
THREAD_TRIGGER thread_kf01 = THREAD_WAIT_FOR_CHAR_IN_AREA (player1, 127.0,127.0,255.0, 1.0,1.0, do_kf01:) // for Flamethrower
THREAD_TRIGGER thread_kf01 = THREAD_WAIT_FOR_CHAR_IN_AREA (player1, 129.0,129.0,255.0, 1.0,1.0, do_kf01:) // for Tank

// Subroutines for THREAD_TRIGGER
// Kill 20 people in 60 seconds with a flame thrower! Reward is $10,000.
do_kf01:
 START_BASIC_KF_TEMPLATE (thread_kf01, 6138, kf01_icon, player1, FLAME_THROWER)
 kf01 = START_BONUS_CHECK (NO_ZONE, 1800, 20, 0, CHAR, NOT_EXCLUSIVE, BY_FLAMETHROWER, NONE, NO_OCCUPATION)
 DO_BASIC_KF_TEMPLATE (kf01, kf_timer, 60, kf_counter, kf_counter_total, 20, 6138, player1, SCORE, 10000)
RETURN

// Destroy 10 cop cars with the tank in 120 seconds! Reward is 1 Extra Life Bonus.
do_kf02:
 START_BASIC_KF_TEMPLATE (thread_kf02, 6136, kf02_tank, player1, TANK_GUN)
 kf02 = START_BONUS_CHECK (NO_ZONE, 3600, 10, 0, CAR, NOT_EXCLUSIVE, BY_ROCKET_LAUNCHER, TANK, COPCAR)
 DO_BASIC_FK_REMPLATE (kf02, kf_timer, 120, kf_counter, kf_counter_total, 10, 6136, 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.)