Forum Mod Bakery Docs

Making Follow Missions + Follow and Collect Missions

Posted in Support
Please login to contribute to the conversation.
[deleted user]
6 yrs ago (Statistics)
Hello, Community! Today, I'm gonna teach you, how to make follow and follow 'n collect missions. Let's get started!
Follow Mission, the basics
First, you'll need to set up your "mod", simply follow Legomariofanatic's tutorial.
Next, you will need to create mXi.mfk (X — mission's number). I'll be using one of my HA scripts as an example.
So, basically, you'll need to create "Getin" and "Goto" stages. Making "Getin" stage is very simple. You'll need to write 12'th message index and AddObjective "Getin". "Getin" stage should look like:

AddStage(0);
                RESET_TO_HERE();
	       SetStageMessageIndex(12);
	       AddObjective("getin");
		              SetObjTargetVehicle("current");
	       CloseObjective();
CloseStage();

(The "RESET_TO_HERE();" is optional)

Follow Mission, Goto stage

So, next you'll need to do, is "Goto" stage. At this stage we will spawn the needed vehicle. First, set up needed HUD icon and message index. Then you should add objective "Goto"

AddObjective("goto");

Next, you will need to spawn a vehicle, write next line below "AddObjective"

AddStageVehicle("cDuff","m0_truck","NULL","Missions\level01\M0dump.con");

Looks hard, eh? Let's sort it out.
"cDuff" is the name of the vehicle (The one name in the game files!)
"m0_truck" is the name of the locator in P3D file that vehicle appears in (Locator should be Type 3!)
"NULL" — currently, I don't know what is this
"Missions\level01\M0dump.con" — path to the .con file used in mission
"M0dump.com" — .con file used in mission
Then, you'll need to Set destination

SetDestination("m0_cola","carsphere");

"m0_cola" — name of the locator (which should be Type 0)
"carsphere" — name of the effect, that appears in the located place (can be either finish line, either carsphere, or some object)

Don't forget to close the objective when you finish

CloseObjective();

Then, you can add some conditions, like Adding time, or etc.

AddStageTime(0);
          AddCondition("timeout");
CloseCondition();

Then, you can add "ShowStageComplete();" line, to show message "TASK COMPLETE" at the end of the stage.

If you done everything correctly, stage should look like this:

AddStage(1);
	SetHUDIcon( "icecream" );
	SetStageMessageIndex(152);
	AddObjective("goto");
                AddStageVehicle("cDuff","m0_truck","NULL","Missions\level01\M0dump.con");
		SetDestination("m0_cola","carsphere");
	CloseObjective();
               AddStageTime(0);
               AddCondition("timeout");
               CloseCondition();
               ShowStageComplete();
CloseStage();

Follow Mission, follow stage

So, the next step — following the car, in this stage, car will be activated.
First, set HUD icons and message index (btw, it isn't that important)
Then you'll got to activate the vehicle by adding this line right below index and HUD icon both

	ActivateVehicle("cDuff","NULL","target");

"cDuff" — is the name of the vehicle in game files
"target" — purpose of the vehicle. Target is for dumping/destroying/following, Evade for escaping from it and Race is for racing.
Next, you will need to set vehicle's parameters. This will determine, will vehicle use shortcuts, or not.

SetVehicleAIParams( "cDuff", 50, 51 );

The higher the numbers, the more shortcuts will be used. "-10, -9" completely disables shortcuts.
Next is waypoints. Minimum amount of waypoints is 2 (I don't know maximum rn either)
Adding waypoint string should look like:

	AddStageWaypoint( "m5_duff_path1" );

"m5_duff_path1" is the name of the locator in p3d file, which should be Type 0.
Locator's name isn't important, you can name it as you want.
Waypoints go in order

	AddStageWaypoint( "m5_duff_path1" );
	AddStageWaypoint( "m5_duff_path2" );
	AddStageWaypoint( "m5_duff_path3" );

If you do like this, vehicle will drive to waypoint 1, then to waypoint 2, and then to waypoint 3

	AddStageWaypoint( "m5_duff_path1" );
	AddStageWaypoint( "m5_van_path3" );
	AddStageWaypoint( "m5_duff_path2" );

If you do like this, vehicle will drive to waypoint 1, then to waypoint 3, and then to waypoint 2

The next stage, is the objective. You will need to add "AddObjective" line, but instead of "getin" and "goto", you'll write "follow"

AddObjective("follow");

Then, below "AddObjective", you will need point, which car must be followed

SetObjTargetVehicle("cDuff");

And then you need to close the objective

"But, hey, mission goes well, and I can't lose the vehicle! What the?"
Don't worry, you just forgot to add follow condition!

	AddCondition("followdistance");
		SetFollowDistances(0, 250);
		SetCondTargetVehicle("cDuff");
	CloseCondition();

"SetFollowDistances" — sets distance, that player should keep in order to prevent mission's failure
"SetCondTargetVehicle" — applies the effect on selected vehicle
That should do it! If you made everything correct, stage should look like this:

AddStage(0);
	SetHUDIcon( "coolr" );
	SetStageMessageIndex(13);
	ActivateVehicle("cDuff","NULL","target");
	SetVehicleAIParams( "cDuff", 50, 51 );
	AddStageWaypoint( "m5_duff_path1" );
	AddStageWaypoint( "m5_duff_path2" );
	AddStageWaypoint( "m5_duff_path3");
	AddObjective("follow");
		SetObjTargetVehicle("cDuff");
	CloseObjective();
	AddCondition("followdistance");
		SetFollowDistances(0, 250);
		SetCondTargetVehicle("cDuff");
	CloseCondition();
CloseStage();

If you want this stage to be last, just simply change the number (0) in "AddStage(0);" to "final", so it will look like

AddStage("final");

Follow Mission, load and P3D files

Make sure, you loaded everything via mXl.mfk! Or the mission will not work!

LoadP3DFile("art\missions\level01\m0.p3d");

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

LoadP3DFile( "art\frontend\dynaload\images\msnicons\location\kwike.p3d" );
LoadP3DFile( "art\frontend\dynaload\images\msnicons\location\simpsons.p3d" );
LoadP3DFile( "art\frontend\dynaload\images\msnicons\object\icecream.p3d" );
LoadP3DFile( "art\frontend\dynaload\images\msnicons\object\cooler.p3d" );

"LoadP3DFile("art\missions\level01\m0.p3d");" — loads P3D file of the mission

"LoadDisposableCar("art\cars\cDuff.p3d","cDuff","AI");" — loads the vehicle P3D

"LoadP3DFile( "art\frontend\dynaload\images\msnicons\location\kwike.p3d" );" — loads HUD icon

Next stage is P3D file. Things are simple there.

Remember, that Locators with type 0 (objects, locations) should have trigger.
Locators with type 3 spawns vehicles/characters, so it doesn't need a trigger.

That's all about Follow mission, now, Follow 'n collect one

Follow and Collect Mission

The difference betwen Follow mission and Follow and Collect mission, is that you need objects, and their locators.

Instead of "AddObjective("follow");", you will need objective "dump"

Then, set the vehicle that will "lose" it's objects and it begins.

AddCollectible("m0_duff_1","cola");

"m0_duff_1" — locator of the place, where the object will be dropped (place this locator only at vehicle's path, or the item will not be dropped)
"cola" — name of composite drawable used in mission (You however still need to load it's P3D file via load file)

This string should be applied to every single collectible in stage.

"I did what you said, but when I losing one collectible, mission not fails, why?"

Because you need to write next string:

BindCollectibleTo(0, 1);

This will result in failure, when you lose one object. But this should be applied to every single object.

If you did everything right, strings below "AddObjective" should look like this:

	AddObjective("dump");
		SetObjTargetVehicle("cDuff");
//		AddCollectible("m0_duff_1","cola");
		AddCollectible("m0_duff_2","cola");
		AddCollectible("m0_duff_3","cola");
		AddCollectible("m0_duff_4","cola");
		AddCollectible("m0_duff_5","cola");
		AddCollectible("m0_duff_6","cola");
		BindCollectibleTo(0, 1);
		BindCollectibleTo(1, 2);
		BindCollectibleTo(2, 3);
		BindCollectibleTo(3, 4);
		BindCollectibleTo(4, 5);
		BindCollectibleTo(5, 6);

(Don't mind about that dummied 1 collectible)

Also, don't forget about load file! Insert next string to mXl.mfk:

LoadP3DFile("art\missions\level01\duffcrat.p3d");

Be sure, that you have needed P3D in level's folder, either game will not find it.

That's all, hope you enjoyed my tutorial!
I'll be glad, if I helped you with this.
Nice!
[deleted user]
6 yrs ago (Statistics)
Nice tutorial Gordon! I might actually try and contribute one of these myself sometime, though the two hardest ones are out of the way now.
Heads up: "NULL" IN the "AddStageVechile" means it does not appear on the radar/minimap. If set to like "evade" it'll appear in bright yellow, if "target" it'll appear dark orange and etc. Not sure what it means in the "ActivateVechile" tho.