Forum Mod Bakery Docs

Creating Missions: Destroy Mission

Posted in Support
Please login to contribute to the conversation.
[deleted user]
6 yrs ago (Statistics)
Hello there, my name is Gordon, and welcome to another lame tutorial from me! In this tutorial, we will be making a destroy mission
Let's begin!

The Basics
First, you're gonna make a basic mission script, just simply follow the legomariofanatic's tutorial

Files wanted
(X - mission number, Y - level number)
In order to proceed, you need the following files: mXi.mfk, mXl.mfk, mX.p3d, VehicleName.con and VehicleName.p3d
Place mfk files to CustomFiles/scripts/missions/level0Y
Con files to CustomFiles/scripts/cars/Missions/level0Y
mX,p3d to CustomFiles/art/missions/level0Y
VehicleName.p3d to CustomFiles/art/cars AND to CustomFiles/art/frontend/dynaload/cars

Adding a vehicle, Goto stage
Ok, now, when we have all the required files, let's get started!

First, add the following line to mXl.mfk

LoadDisposableCar("art\cars\cSedan.p3d","cSedan","AI");

Looks fishy? Don't worry, I'll explain!
("art\cars\cSedan.p3d" is a path to vehicle's model, we're using chase sedan in our tutorial, vehicle uses "cSedan" name in the game files
"AI" - "Thing", that will control the vehicle. Can be two variations here: "AI", is for game's AI engine, and "Other", which can be used in stages, where you need to drive another than your own vehicle (Locked car stages, like Alien Auto-topsy missions from original game)

After you've added this line to mXl.mfk, let's slowly move to mXi.mfk

Let's say, you have a goto stage

AddStage(0);
	DisableHitAndRun();
	SetStageMessageIndex(166);
	SetHUDIcon( "bowlera" );
	AddObjective("goto");
		SetDestination("m5_bowling", "carsphere");
		SetCollectibleEffect("wrench_collect");
	CloseObjective();
	AddCondition( "damage" );
		SetCondMinHealth( 0.0 );
		SetCondTargetVehicle( "current" );
	CloseCondition();
	SetStageTime(60);
	AddCondition("timeout");
		//SetHitNRun();
	CloseCondition();
	ShowStageComplete();
CloseStage();

You need to add one line under the AddObjective(); line

	    AddStageVehicle("cSedan","m5_sedan","NULL","Missions\level03\M5dest.con");
Let me explain

You alredy know what "cSedan" is, let's move to the next one
"m5_sedan" is the vehicle's locator. Locators must be present in mX.p3d, in order to succesfully launch the mission. Remember, that goto locators, item locators, etc MUST be type 0, while character's and car's placements MUST be type 3(character's waypoints are also must type 3, but, vehicle's should be type 0)
"NULL" hides the vehicle from the radar. If you set "target" instead, it will be shown
"Missions\level03\M5dest.con" location of vehicle's parameter file.

The stage should look like this now
AddStage(0);
	DisableHitAndRun();
	SetStageMessageIndex(166);
	SetHUDIcon( "bowlera" );
	AddObjective("goto");
	        AddStageVehicle("cSedan","m5_sedan","NULL","Missions\level03\M5dest.con");
		SetDestination("m5_bowling", "carsphere");
		SetCollectibleEffect("wrench_collect");
	CloseObjective();
	AddCondition( "damage" );
		SetCondMinHealth( 0.0 );
		SetCondTargetVehicle( "current" );
	CloseCondition();
	SetStageTime(60);
	AddCondition("timeout");
		//SetHitNRun();
	CloseCondition();
	ShowStageComplete();
CloseStage();

Activating the vehicle, Destroy stage

In the next stage, we're going to activate the vehicle
I'll show you, how the stage's gonna look like, and then I will explain everything

AddStage(0);
	SetHUDIcon( "fbi" );
	SetStageMessageIndex(116);
	ActivateVehicle("cSedan","NULL","target");
	SetVehicleAIParams( "cSedan", 50, 51 );
	AddStageWaypoint( "sedan_path1" );
	AddStageWaypoint( "sedan_path2" );
    AddObjective("destroy");
		SetObjTargetVehicle("cSedan");
	CloseObjective();
	SetStageTime(95);
	AddCondition("timeout");
	CloseCondition();
	AddCondition( "damage" );
		SetCondMinHealth( 0.0 );
		SetCondTargetVehicle( "current" );
	CloseCondition();
	ShowStageComplete();
CloseStage();

ActivateVehicle("cSedan","NULL","target");
Activates the vehicle

SetVehicleAIParams( "cSedan", 50, 51 );
Sets parameters for vehicle (i.e. will it use shortcuts or not/etcetera)
If the params are -9, -10, then vehicle will try to avoid any of the shortcuts

	AddStageWaypoint( "sedan_path1" );
	AddStageWaypoint( "sedan_path2" );
Sets locators, vehicle will move to them in specific order (Note: Those locators ARE MUST be type 0, or the game will crash!)

For example, the vehicle will ride to "sedan_path1" and then to "sedan_path2", but, if I swap their places

	AddStageWaypoint( "sedan_path2" );
	AddStageWaypoint( "sedan_path1" );

Vehicle will drive to "sedan_path2" first, and only then to "sedan_path1"
If the vehicle reaches final waypoint in the "waypoint list", it will return to the beggining of the "list"

    AddObjective("destroy");
		SetObjTargetVehicle("cSedan");
	CloseObjective();
This adds an objective to destroy the vehicle, so it won't just drive in circles while you're waiting for timer to end

	SetStageTime(95);
	AddCondition("timeout");
	CloseCondition();
This adds a little "challenge" to the stage. It won't be cool, if you had infinite time to destroy a vehicle, right?

	AddCondition( "damage" );
		SetCondMinHealth( 0.0 );
		SetCondTargetVehicle( "current" );
	CloseCondition();
This also adds more "challenge" to the mission. Mission's gonna be very easy, if you had an opportunity to quickly jump into one of the traffic cars to continue pursuit, right?

Finishing mission, locators and con file

Every mission needs locators and con files(if there's a vehicle in that mission)
Locators' names in mXi.mfk and in mX.p3d must be the same, otherwise, the game will crash
Also, some locators should have different types
For example, we have a couple of locators
  • m5_bowling
  • m5_sedan
  • sedan_path1
  • sedan_path2
m5_bowling - is a location locator. It must be type 0, i.e. have a locator and trigger. Both of them must be placed via game, using "From Game" button. Locator - is a car sphere/item that will appear in the level graphically, and trigger - is a place, that you need to visit to complete your task. You can place them separately, but, it would be eaiser for players to drive to the carsphere, completing the goal, instead of searching where the trigger is.
m5_sedan - is a vehicle's locator, which must be type 3. It has only one option, that also should be edited via game using "From Game" button. It justs spawns the vehicle in desired place.
sedan_path1 and sedan_path2 are same as m5_bowling, the only difference, is that you don't need to drive to them, instead, AI car is doing that

Con file sets special parameters for the vehicle, like, mass, speed, etc
The main parameter is: hitpoints
The more hitpoints, the tougher car will be to destroy

For example
SetHitPoints(2.5);

This is gonna set vehicle's toughness to 2.5, which is a little weaker than normal one
Note: do not set enormous hitpoints like 50, it's hard to destroy even a 10 hitpoint car. 2-3-4 will be just fine.

I hope I helped you with this tutorial, good luck with modding!
What is "fbi" meant to be?
And isn't it meant to be "M4_dest" not "M5_dest"?

'fbi' is a custom HUD icon name used in the mod
M5dest.con is also a custom CON file name used in the mod
You can replace these two with any other HUD icon and CON file you want, the names don't matter as long as they're internally the same
what do you have to do, when you have to destroy a car in the middle of to the goto.
[deleted user]
4 yrs ago (Statistics)
You can't, you need to have either a goto stage or a destroy stage. You can't combine stages at least yet
how can i change the vehicle toughness with con?
[deleted user]
4 yrs ago (Statistics)
You edit the hitpoint value
SetHitPoints(X1.X2);
(The first X is an integer, the second X is a decimal)
ok, last question, how can i edit the car that appear at the phonebooth, like i only want 6 different cars in the phonebooth in one level, how can i do it?