Forum Mod Bakery Docs

Driver Appearing With No Car

Posted in Support
Please login to contribute to the conversation.
Hi,

I have mission where I want the player to avoid Krusty in a later stage. Krusty is instead appearing at the start of the mission with no car. The problems:
1. Krusty doesn't have a car and is driving nothing.
2. The waypoint he starts at doesn't exist in the p3d file so I don't know why he's showing up there.
3. The mxl file doesn't mention Krusty's character model so they couldn't have loaded him in by accident.
4. The "addriver" code line is in a later stage of the mission, so the game isn't just loading him in wrong.
SelectMission("m3");

SetMissionResetPlayerInCar("m3_apucarstart_sd");
SetDynaLoadData("l3z1.p3d;l3r1.p3d;l3r5.p3d;l3r5_dam.p3d;");
InitLevelPlayerVehicle("apu_v","m3_apucarstart_sd","OTHER");

SetNumValidFailureHints( 5 );

UsePedGroup(0);

SetForcedCar();

AddStage(16); 
	RESET_TO_HERE();
	SetMaxTraffic(5);
	SetStageMessageIndex(118);
	SetHUDIcon( "flatmeat" );
	AddStageVehicle("cletu_v","m3_cletus_carstart","target","Missions\level03\M3dump.con", "cletus");
	SetVehicleAIParams( "cletu_v", -10, -9 );   // very dumb - no shortcuts
	AddStageWaypoint( "m3_cletus_path5" );
	AddStageWaypoint( "m3_cletus_path9" );
	AddStageWaypoint( "m3_cletus_path1" );

	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");
		SetObjTargetVehicle("cletu_v");
		AddNPC("apu", "m3_apu_hide");
		AddCollectible("m3_flatmeat_1","roadkill");
		AddCollectible("m3_flatmeat_2","roadkill");
		AddCollectible("m3_flatmeat_3","roadkill");
		AddCollectible("m3_flatmeat_4","roadkill");
		AddCollectible("m3_flatmeat_5","roadkill");
		AddCollectible("m3_flatmeat_6","roadkill");
		AddCollectible("m3_flatmeat_7","roadkill");
		AddCollectible("m3_flatmeat_8","roadkill");
		AddCollectible("m3_flatmeat_9","roadkill");
		AddCollectible("m3_flatmeat_10","roadkill");
		AddCollectible("m3_flatmeat_11","roadkill");
		AddCollectible("m3_flatmeat_12","roadkill");
		AddCollectible("m3_flatmeat_13","roadkill");
		AddCollectible("m3_flatmeat_14","roadkill");
		AddCollectible("m3_flatmeat_15","roadkill");
	CloseObjective();
	SetStageTime(120);
	AddCondition("timeout");
	CloseCondition();
	AddCondition("outofvehicle");
		SetCondTime( 10000 );
	CloseCondition();
	AddCondition( "damage" );
		SetCondMinHealth( 0.0 );
		SetCondTargetVehicle( "apu_v" );
	CloseCondition();
	SetCompletionDialog("jerkwater","apu");
	ShowStageComplete();
CloseStage();

AddStage(0);
	SetMaxTraffic(5);
	SetStageMessageIndex(181);
	SetHUDIcon( "observ" );
	AddObjective("goto", "both");
		SetDestination("m3_observatory", "carsphere");
		SetCollectibleEffect("wrench_collect");
AddStageVehicle("cKlimo","m3_cKlimo_carstart","NULL","Missions\level07\M7Chase.con","krusty");
	CloseObjective();
	AddCondition("outofvehicle");
		SetCondTime( 10000 );
	CloseCondition();
	AddCondition( "damage" );
		SetCondMinHealth( 0.0 );
		SetCondTargetVehicle( "apu_v" );
	CloseCondition();
	SetStageTime(40);
	AddCondition("timeout");
	CloseCondition();
//AddDriver("krusty","cKlimo");
SetCompletionDialog("miss","krusty");
CloseStage();

AddStage(1);
SetMaxTraffic(5);
SetStageMessageIndex(21);
SetHUDIcon("krusty");
ActivateVehicle("cKlimo","NULL","chase");
SetVehicleAIParams("cKlimo",-10,-9);
AddObjective("losetail");
SetObjTargetVehicle("cKlimo");
SetObjDistance(200);
CloseObjective();
SetStageTime(60);
AddCondition("timeout");
CloseCondition();
ShowStageComplete();
CloseStage();

AddStage(2);
	SetMaxTraffic(5);
	SetStageMessageIndex(181);
	SetHUDIcon( "observ" );
	AddObjective("goto", "both");
		SetDestination("m3_observatory", "carsphere");
		SetCollectibleEffect("wrench_collect");
	CloseObjective();
	AddCondition("outofvehicle");
		SetCondTime( 10000 );
	CloseCondition();
	AddCondition( "damage" );
		SetCondMinHealth( 0.0 );
		SetCondTargetVehicle( "apu_v" );
	CloseCondition();
	SetStageTime(20);
	AddCondition("timeout");
	CloseCondition();
	SetFadeOut( 1.0 );
	SwapInDefaultCar();
	SetSwapDefaultCarLocator("m3_carend");
	SetSwapForcedCarLocator("m3_apu_carend");
	SetSwapPlayerLocator("m3_lisa_observatory");
	ShowStageComplete();
CloseStage();

AddStage(3);
	SetStageMessageIndex(182);
	SetHUDIcon( "observ" );
	AddObjective("interior");
		AddNPC("frink", "m3_frink");
		SetDestination("Observatory", "obsv_mission_doorstar");
	CloseObjective();
CloseStage();

AddStage(4);
	SetStageMessageIndex(66);
	SetHUDIcon( "frink" );
	AddObjective("talkto", "neither");
		AddNPC("frink", "m3_frink");
		AddObjectiveNPCWaypoint( "frink", "m3_frink_walk_1" );
		SetTalkToTarget("frink", 0, 0);
	CloseObjective();
CloseStage();

AddStage("final");
	AddObjective("dialogue");
		AmbientAnimationRandomize( 1, 0 );      // ( pc=0, npc=1) (nonrandom=0, random=1)
		AmbientAnimationRandomize( 0, 0 );
		SetConversationCam( 0, "pc_far" );
		SetConversationCam( 1, "npc_near" );
		SetConversationCam( 2, "pc_far" );
		AddAmbientNpcAnimation( "none" );
		AddAmbientPcAnimation( "dialogue_hands_in_air" );
		SetDialogueInfo("lisa","frink","conspiracy",0);
	CloseObjective();
CloseStage();

CloseMission();


That's nothing that's your fault, I'm afraid! It's an issue with how the seaside map was developed.

Basically, when an AI car is loaded to be used in a different stage, the driver of this car spawns at the origin of the world (0,0,0). The area right near the Krusty Burger is actually the origin of the world, and as a result, the character spawns here.

Radical is able to avoid this issue by having all of Level 3 (and Level 6)'s cars be loaded right at the start of the mission, or the AI cars in question lack any drivers (see the Black Sedan in Operation Hellfish and in Kang and Kodos Strike Back).

There is a simple solution though. While it occupies an AI car slot, you can use AddStageVehicle in the first stage to hide Krusty and his car elsewhere until you're ready to use him:

Spoiler
AddStage(16); 
	RESET_TO_HERE();
	SetMaxTraffic(5);
	SetStageMessageIndex(118);
	SetHUDIcon( "flatmeat" );
	AddStageVehicle("cletu_v","m3_cletus_carstart","target","Missions\level03\M3dump.con", "cletus");

        AddStageVehicle("cKlimo","HIDE_KRUSTY_LOCATOR","NULL","Missions\level07\M7Chase.con","krusty");

	SetVehicleAIParams( "cletu_v", -10, -9 );   // very dumb - no shortcuts
	AddStageWaypoint( "m3_cletus_path5" );
	AddStageWaypoint( "m3_cletus_path9" );
	AddStageWaypoint( "m3_cletus_path1" );

	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");
		SetObjTargetVehicle("cletu_v");
		AddNPC("apu", "m3_apu_hide");
		AddCollectible("m3_flatmeat_1","roadkill");
		AddCollectible("m3_flatmeat_2","roadkill");
		AddCollectible("m3_flatmeat_3","roadkill");
		AddCollectible("m3_flatmeat_4","roadkill");
		AddCollectible("m3_flatmeat_5","roadkill");
		AddCollectible("m3_flatmeat_6","roadkill");
		AddCollectible("m3_flatmeat_7","roadkill");
		AddCollectible("m3_flatmeat_8","roadkill");
		AddCollectible("m3_flatmeat_9","roadkill");
		AddCollectible("m3_flatmeat_10","roadkill");
		AddCollectible("m3_flatmeat_11","roadkill");
		AddCollectible("m3_flatmeat_12","roadkill");
		AddCollectible("m3_flatmeat_13","roadkill");
		AddCollectible("m3_flatmeat_14","roadkill");
		AddCollectible("m3_flatmeat_15","roadkill");
	CloseObjective();
	SetStageTime(120);
	AddCondition("timeout");
	CloseCondition();
	AddCondition("outofvehicle");
		SetCondTime( 10000 );
	CloseCondition();
	AddCondition( "damage" );
		SetCondMinHealth( 0.0 );
		SetCondTargetVehicle( "apu_v" );
	CloseCondition();
	SetCompletionDialog("jerkwater","apu");
	ShowStageComplete();
CloseStage();

Once you're ready to use Krusty, you can use AddStageVehicle again and have him spawn at the intended location, just like you have it in your script.

If you need any further help, I can provide visual examples, but I hope this makes sense!
That's alright, Kenny! Brilliant stuff! Just comes to show it's always helpful to ask the forums.
Alas, didn't work. The car spawns in now at least. I'm just compromising and having him spawn there and keep him there the whole mission.
That's very bizarre. Apologies! I did something like this in L3M3 for Donut Mod and got a result where the 'bum' NPC character was hidden properly. While this was coded the lua script functionality enabled, it should achieve the exact same effect? Below is my code:

Spoiler
	Game.AddStage(16) Game.RESET_TO_HERE()
		Game.SetHUDIcon("flatmeat")
		Game.SetStageMessageIndex(({11,2})[Difficulty.Current])
		Game.SetStageTime(({50,40})[Difficulty.Current])
		Game.SetMaxTraffic(({2,3})[Difficulty.Current])
		
		Game.AddStageVehicle("cletu_v","m3_cletu_v_carstart".. tostring(Difficulty.Current),"NULL","missions\\l3m3\\cletu_v.con","cletus")
		Game.AddStageVehicle("cletu_vB","m3_cletu_vB_carstart","NULL","missions\\l3m3\\cletu_vB" .. tostring(Difficulty.Current) .. ".con","bum")

		Game.StartCountdown("count")
			--Game.AddToCountdownSequence("3",1000) 
			--Game.AddToCountdownSequence("2",1000) 
			--Game.AddToCountdownSequence("1",1000) 
			--Game.AddToCountdownSequence("GO",400) 
		
		if Difficulty.IsNormal then
			Game.AddObjective("goto")
				Game.AddNPC("apu","m3_apu_hide")
				Game.SetDestination ("m3_mtkb_nm", "carsphere")
				Game.SetCollectibleEffect("wrench_collect")
			Game.CloseObjective()
		else
			Game.AddObjective("delivery")
				Game.AddNPC("apu","m3_apu_hide")
				for i = 1, 17, 1 do
					Game.AddCollectible("m3_roadkill"..tostring(i), "roadkill")
				end
			Game.CloseObjective()
		end
		
		Game.AddCondition("timeout") Game.CloseCondition()
	Game.CloseStage()

And here's the end result in-game - You can't see the 'bum' character floating! I also tested this by changing the character NPC to Krusty just to make sure this was accurate:


Make sure the "HIDE_KRUSTY_LOCATOR" I put in my example is a valid locator. If it's invalid, the game will just default to spawning it in the origin of the world, which achieves the same effect! What you'd want to do is use cheat keys to clip outside of the Level, create a locator, and then use the 'From Game' button to create a new one. Change the script accordingly to match the name of the new locator created, and all should be good?

Lemme know if this works.
Oh, I thought the "HIDE_KRUSTY_LOCATOR" was an actual thing. Sure, that makes sense.