sfall-team / sfall

sfall - Engine modifications for Fallout 2
https://sfall-team.github.io/sfall/
GNU General Public License v3.0
338 stars 40 forks source link

Car given to the player even when it shouldn't #538

Open blackpaulillyria opened 2 months ago

blackpaulillyria commented 2 months ago

I discovered an odd bug regarding the car.

Let's say you remove the function car_give_to_party from the map_exit_p_proc that fires on a map script for a random encounter.

If you exit that map on a brown exit grid, you will continue traveling the world map on foot as expected. However, if you do the exact same thing while the combat is initialized, you will continue traveling in the car even though car_give_to_party was never called.

This only happens in a random encounter while combat is initialized when you hit the brown exit grid. I looked a little bit through the source code and believe that the issue is with wmGenData.isInCar not being set to false.

Lexx2k commented 2 months ago

Leaving an encounter map without the car would mean that it gets deleted. So the real question is, why would you even want to do that.

blackpaulillyria commented 2 months ago

Leaving an encounter map without the car would mean that it gets deleted. So the real question is, why would you even want to do that.

I am developing a driving system for Fallout Yesterday where you can drive, abandon or switch between 7 different vehicles. This is the last bug that I have for the system to be finished and I can't find a proper workaround for it.

Also, I see now that the car is given to the player even if the combat has ended on a random encounter.

blackpaulillyria commented 2 months ago

OK, I found some kind of a workaround, it's not perfect but it might do for now. When the player abandons the car on a random encounter and exits, I set fuel to 0. This then makes the engine set wmGenData.isInCar to false as soon as I start to travel which fixes my issue and I continue traveling on foot.

Side effect is that "Car Outta Gas" area also gets displayed because of this, which I don't want, but I can handle that using global scripts.