Forum Mod Bakery Docs

L4M2 - Wanting To Separate Dump Stage Into Parts

Posted in Support
Please login to contribute to the conversation.
I'm looking into L4M2, where you follow Cletus around and collect the things falling out of his truck. I'm looking to separate the stage so you get three collectibles and it follows into a new stage when finished, returns to the next collectibles, and so on. At the moment, how I have it, once the three collectibles are picked up, Cletus stops dropping items. I've tried multiple combinations of the "BindCollectableTo" function so I thought it's probably easier just to ask the forums how it's done.

SelectMission("m2");

SetMissionResetPlayerInCar("m2_carstart");
SetDynaLoadData("l4z7.p3d;l4r6.p3d;l4r7.p3d;");

UsePedGroup(6);

AddStage(0);
	RESET_TO_HERE();
	SetMaxTraffic(3); 
	SetStageMessageIndex(24);
	SetHUDIcon( "cletus_v" );
	AddStageVehicle("cletu_v","m2_cletustruck_sd","NULL","Missions\level04\M2chase.con","cletus");
	AddStageCharacter("marge", "", "", "current", "m2_carstart" );
	AddStageWaypoint( "m2_waypoint1" );
	AddStageWaypoint( "m2_waypoint1b" );
	AddStageWaypoint( "m2_waypoint2" );
	AddStageWaypoint( "m2_waypoint2a" );
	AddStageWaypoint( "m2_waypoint3" );
	AddStageWaypoint( "m2_waypoint4" );
	AddStageWaypoint( "m2_waypoint5" );
	AddStageWaypoint( "m2_waypoint6" );
	StartCountdown("count");
		AddToCountdownSequence( "3", 1000 ); // duration time in milliseconds
		AddToCountdownSequence( "2", 1000 ); // duration time in milliseconds
		AddToCountdownSequence( "1", 1000 ); // duration time in milliseconds
		AddToCountdownSequence( "GO", 400 ); // duration time in milliseconds
	AddObjective("dump", "neither");
		ActivateVehicle("cletu_v","m2_cletustruck_sd","evade");
		SetVehicleAIParams( "cletu_v", 10, 20 );   // random shortcuts
		AddNPC("cletus","cletus_hide");
		SetObjTargetVehicle("cletu_v");
		AddCollectible("m2_stuff1","cola");
		AddCollectible("m2_stuff1b","tomat");
		AddCollectible("m2_stuff2","donut");
		BindCollectibleTo(0, 0);
		BindCollectibleTo(1, 1);
		BindCollectibleTo(2, 2);
	CloseObjective();
	AddCondition("followdistance");
		SetFollowDistances(0,200);
		SetCondTargetVehicle("cletu_v");
	CloseCondition();
CloseStage();

AddStage(0);
	SetMaxTraffic(3); 
	SetStageMessageIndex(24);
	SetHUDIcon( "cletus_v" );
	AddStageWaypoint( "m2_waypoint6" );
	AddObjective("dump", "neither");
		ActivateVehicle("cletu_v","NULL","evade");
		SetVehicleAIParams( "cletu_v", 10, 20 );   // random shortcuts
		SetObjTargetVehicle("cletu_v");
		AddCollectible("m2_stuff3","wplanks");
		AddCollectible("m2_stuff4","lwnchair");
		BindCollectibleTo(3, 3);
		BindCollectibleTo(4, 4);
	CloseObjective();
	AddCondition("followdistance");
		SetFollowDistances(0,200);
		SetCondTargetVehicle("cletu_v");
	CloseCondition();
CloseStage();

AddStage(0);
	SetMaxTraffic(3); 
	SetStageMessageIndex(24);
	SetHUDIcon( "cletus_v" );
	AddStageWaypoint( "m2_waypoint6" );
	AddObjective("dump", "neither");
		ActivateVehicle("cletu_v","NULL","evade");
		SetVehicleAIParams( "cletu_v", 10, 20 );   // random shortcuts
		SetObjTargetVehicle("cletu_v");
		AddCollectible("m2_stuff5","cola");
		AddCollectible("m2_stuff6","donut");
		BindCollectibleTo(5, 5);
		BindCollectibleTo(6, 6);
	CloseObjective();
	AddCondition("followdistance");
		SetFollowDistances(0,200);
		SetCondTargetVehicle("cletu_v");
	CloseCondition();
	SetIrisWipe( 0.1 );
CloseStage();


AddStage("final"); // gets Marge out of the Cra ready for dialogue in M3
	AddObjective("timer");
		AddStageCharacter("marge", "m2_marge_2", "", "current", "m2_marge_car2" );
		AddNPC("cletus","m2_cletus_2");
		RemoveDriver("cletus");
		AddStageVehicle("cletu_v","m2_cletustruck_2","NULL","Missions\level04\M2chase.con");
		SetDurationTime(1);
	CloseObjective();
CloseStage();


CloseMission();

[deleted user]
5 yrs ago (Statistics)
Well, first off, you shouldn't bind one collectible to itself (0 to 0, 1 to 1, etc), instead, bind them to the next one (0 to 1, 1 to 2)
Next, game doesn't remembers the collectible number if it's moved to the next stage, i.e. you should start from (0, 1) in every stage
And the collectible amount should match the waypoint amount(with waypoint locator and collectible locator being relocated to the same place) (I'm probably incorrect here)

That should be it, hope it helps!
Thanks, Gordon! Turned out to be a waypoint problem. I'm not sure what you mean about the Bind Collectable, since it's the same numbers in the original scripts for the game. But adding the right amount of waypoints fixed it!
[deleted user]
5 yrs ago (Statistics)
It looks like this in one of my old mods
		BindCollectibleTo(0, 1);
		BindCollectibleTo(1, 2);
		BindCollectibleTo(2, 3);
		BindCollectibleTo(3, 4);
		BindCollectibleTo(4, 5);
		BindCollectibleTo(5, 6);
Now I'm not sure what is right and what is not (I'll deal with this later)

At least it works, glad I helped!