Forum Mod Bakery Docs

An error when spawning a 2nd drivable vehicle (not traffic) in a mission

Posted in Support
Please login to contribute to the conversation.
I managed to place a 2nd drivable vehicle in one of my challenges' P3D file like one of the bonus vehicles placed in a certain location in each level. To be specific, the 1st vehicle the player rides is a vehicle the player starts out with, replacing the vehicle the player already had before starting the challenge (the "SetForcedCar()" function isn't in my mission LUA file as it caused bigger problems). There are two problems with this.

1. The only time the 2nd vehicle actually spawns is when after I restart the mission at least once every time I begin the challenge.

2. Whenever I restart/cancel the challenge when still driving the 2nd vehicle, it doesn't spawn. I'd have to restart the challenge again in order for it to spawn.

Now, I'm not going to release my files publicly for obvious reasons. But, if none of you developers have a good solution (nor a good explanation why it won't ever work correctly) and it's requested, I'll privately give my files to whichever developer asked on Skype... that is if they tell me who they are on Skype, and I only know @Loren Goodwin's Skype name.
A bit of a late response, and probably not the one you want, but there really isn't an easy way without horribly corrupting the game to do what you want. I assume the answer to your first issue with the car not appearing until a reset is because the game reloads that Level Region when you reset, realizing you've added a car. The second issue I have no clue about. SetForcedCar() is really the only way to safely force the player to use a certain vehicle for a mission, unfortunately. Pretty clever idea though, but I don't think there's anyway to make it work without things going horribly screwy.

That being said, what issues is SetForcedCar() giving you? Is the game crashing when you try to swap the default car back in? If you'd like to discuss this privately, my Skype is daluigi208. 
Well, I'm glad I had my backup plan ready: Creating the original mission into two separate missions, with the 2nd part being unable to be replayed unless the 1st part is beaten again. 

Anyway, when driving the 2nd vehicle after canceling the challenge with SetForcedCar in the mission file...

1. The vehicle doesn't despawn like it does when SetForcedCar exists in the mission file (SetForcedCar() focuses on the vehicle listed in InitLevelPlayerVehicle)

2. The vehicle then despawns after a few seconds, and the character who was in the passenger seat floats in mid-air.

3. The vehicle can't be controlled after the former problem happens. I couldn't even exit the vehicle.

And about Skype, I was only going to add those who ask for my challenge files in case this problem is solvable, and this sounds like it definitely isn't. Since it can't be done the intended way, I guess I don't need to show you my files.
While it's excellent you have a backup plan, the case with SetForcedCar not working though is definitely pretty odd, and should be addressed though in case you make another missions that requires the player to used a forced car. I can't think of why the issues you're having are happening to begin with, and I'm actually having a bit of trouble understanding what happens.

- Are you sure the vehicle you want the player to be forced in is loaded in the lua load script as "OTHER"? (For example: "LoadDisposableCar("art\\cars\\carname.p3d","carname","OTHER")? 

- InitLevelPlayerVehicle("carname","carlocator","OTHER") is near the top of the script, correct?

- The SetMissionResetPlayerInCar function's locator also matches the car locator used for InitLevelPlaterVehicle, right?

- SetForcedCar() is after all of this? It's usually placed right after Radical sets what Pedestrian group to load.

Assuming all of that applies to your script, you shouldn't be having any issues. You mission script should look like this, and your mission load script should be loading the forced car the same way I mentioned above (it should look like this).

Please let me know if you have any more questions about SetForcedCar, and let me know if what I said above applies to your script.
Perhaps I didn't elucidate enough. When I said "The vehicle" when I was listing the issues regarding SetForcedCar, I mean the 2nd vehicle the player rides after riding the 1st vehicle, the vehicle the player starts with initially and is technically forced to use (because InitLevelPlayerVehicle is told to load the 1st vehicle, not the 2nd).

To those questions you asked me, the answer is "yes" to all of them. But remember, SetForcedCar is not the main issue. The main issue is that a vehicle the player is supposed to drive/ride after riding the 1st vehicle in an earlier part of a challenge doesn't spawn correctly. You already provided me a good explanation as to why it won't work the way it was meant to be. I only said that when SetForcedCar is existent in my mission file, it caused bigger issues.
Ah, that makes sense. Thank you for clarifying! I apologize you have to fall back on your back up plan, but I'm afraid there isn't a way to make this work with Bonus Cars.

However, you can have the player use a "forced" car for one section of the mission with SetForcedCar, and then use SwapInDefaultCar so the player is forced to use the Level's default car. I forget if this re-enables the Phone Booths (so the player can call another car from the phonebooth and use that), but I'm pretty sure it does and my L3M4 was designed to use this trick at one point (after you destroyed two sedans with Grampa, you had to go to the Gas Station and then were forced to use Lisa's car throughout the remainder of the mission). Thought that might be worth pointing out if you still think you can get your idea to work with this method. Do keep in mind that you can't swap back to the forced car, so you're stuck with your default one (or whatever your magical phone booth grants you) until the mission ends.

I can't wait to see what becomes of Some Challenge Mod! As somebody who finds SHAR painfully easy now, I'm looking forward to playing these rather brutal looking missions.