Multiple cars in the game

Stark3000

First time out of the vault
Hi,
I've got to use cars in a mode - three cars to be precise.
From the script sources it seems that using one car is pretty simple - all you have to do is add a few lines to mapscript for each location where the car's supposed to be.
I thought that in order to add another car there I'd just have to modify some of the functions and perhaps add a GVAR or two.
Unfortunatelly it seems that the car_current_town value (which returns the town area where the car is) is hardcoded into the game and it's not editable.
This is how it's definition looks:
Code:
#define car_current_town     metarule(METARULE_CAR_CURRENT_TOWN, 0)

I didn't find the metarule definition anywhere and so I expect that it's some internal function that cannot be edited. The same seems to be true for the car_give_to_party and the car_give_gas(AMOUNT) functions.
So basically I'm asking whether anyone here has any experience with adding an additional car into the game or how would you suggest to do so.
Of course, it's possible to write the whole car thing from the scratch using the script only, but I'd rather avoid that - it would take long (I guess) and it could introduce new bugs into the game - and I thing there's enough of them there without me adding some more :) .

If you have any idea how to do this while using as much of the original game as possible then please let me know :wink: .
 
You're right about the metarules, it's pretty much hardcoded with no option of adding additional features.

Scripting is the way to go, I'd say. You probably won't screw up anything, as long as the script affects the vehicle only.

The only problem about this method is leaving car in desert - it will be lost forever, because only one car instance (Corvega's instance) will be recognised by the engine and marked properly on the worldmap (Car out of Fuel circle).

Right now I got an idea...

You can try using only one instance of car in the game (Corvega), changing it's appearance through the scripts - the "fid" commands like obj_art_fid could help you...

I don't know if you got this right, if not let me know and I'll try explaining it in details.
 
lisac2k: thanks for confirming the metarules.

You can try using only one instance of car in the game (Corvega), changing it's appearance through the scripts - the "fid" commands like obj_art_fid could help you...

I've thought of that but the problem is that it should be possible to have all three cars in one location at the same time.
Though come to think about it, this approach still may prove useful. I'll give that some thought.
Another problem might be with the car trunks and car fuel - these values must be separate for each car.
But it still might be possible with only minor changes and not scripting a whole new car solution (as I'm rather lazy and busy I'd really like to avoid that :) ).

Thank you very much for your answer!
 
I wouldn't care much about the fuel or the trunk of the cars. It would work like Resident Evil's item box, same items on all boxes. Ok a bit irrealistic i know..

About the idea: i like it a lot.
I had an idea about a garage, some time, ago about building cars with various car junk/metal junk/other junk that you would find in the random enconters and bring it to a hidden (at first, like sierra army depot) chop shop. You could then build cars there for sale like smithy. You could also hire someone to make it profitable and sell some goods. So having 3 controlable cars with be very nice.

The idea came down because i aint a modder. I could easily do the normal mapping with the already ingame graphics but the ones i tried to add were always in the wrong angle and lightning, didn't look good. Also i didn't even knew how to script all the things this would involve, etc.

Anyway, just to say that it would be good if you could manage to make 3 cars available :P
 
Stark3000 said:
I've thought of that but the problem is that it should be possible to have all three cars in one location at the same time.
It is possible. But only one will be active at the moment, others will be scenery and can be activated through scripts, making the current car inactive.

Stark3000 said:
Another problem might be with the car trunks and car fuel - these values must be separate for each car.
Do they? Think of it this way - when you switch the car, all fuel and trunk content from the old car will be automatically brought into the new car. You know, stealing fuel and robbing car trunks is a common thing in the wasteland.

It can be explained by advancing time for an hour and displaying a message like this: You spend some time to transfer all of your valuable items and fuel to the new car.

Imagination, you know?

EDIT: And something for you, Demonslayer...
 
Demonslayer said:
lisac2k said:
EDIT: And something for you, Demonslayer...

Well the idea came much before that when i talked to MIB88 and later on with Lich.

Yeah, I saved our conversations about that. It is not something I have given up on...I do plan on adding something like this someday. :wink:
 
lisac2k said:
Stark3000 said:
Another problem might be with the car trunks and car fuel - these values must be separate for each car.
Do they? Think of it this way - when you switch the car, all fuel and trunk content from the old car will be automatically brought into the new car. You know, stealing fuel and robbing car trunks is a common thing in the wasteland.

It can be explained by advancing time for an hour and displaying a message like this: You spend some time to transfer all of your valuable items and fuel to the new car.

Well... I've never thought of that, but it's one hell of an idea :). I'm not sure how much the others will like it (I'm not the only part of the team) but this sounds logical and reasonable. I expect that player would probably want to have all the impotrant stuff with himself anyway and he would be really annoyed to having to transfer it all manually.
On the other hand this solution would be rather strange when the player leaves his "primary" car for some reason and moves to some other location where he sit into the second car. Then the items in the first trunk should be left alone but he should still be able to put another things into the new car. But then again... I think it would be possible to store three global trunk pointers and switch them accordingly, wouldn't it?

lisac2k said:
Imagination, you know?
And as for that one... I hope I do possess some of it (and sometimes I even put it to use :) ), but the nice part is that each one's imagination is a bit different, hence the reason (and fun) for posting questions and sharing ideas on forums such as this one :D
 
I think it would be possible to store three global trunk pointers and switch them accordingly, wouldn't it?
Yes, it would. You can add 3 lockers for each map and simulate the car trunks. This can't be done for the fuel.

On the other hand this solution would be rather strange when the player leaves his "primary" car for some reason and moves to some other location where he sit into the second car.
Yeah, this is the hardest part... With only one instance of "real" car, the other cars might get lost if not left in one of the "cities". If you leave a car in the desert and move on to a next one, the car in the desert will be gone forever. This can be explained again as "a theft", but you'll really have to think all through before the final implementation.
 
Demonslayer said:
The idea came down because i aint a modder. I could easily do the normal mapping with the already ingame graphics but the ones i tried to add were always in the wrong angle and lightning, didn't look good. Also i didn't even knew how to script all the things this would involve, etc.

Come on, Demon. I bet that many groups are looking for any creative/nimble/hard-working people - in other words, it´s definitely not only about art/script skills. :wink:
 
lisac2k said:
I think it would be possible to store three global trunk pointers and switch them accordingly, wouldn't it?
Yes, it would. You can add 3 lockers for each map and simulate the car trunks. This can't be done for the fuel.

Couldn't this issue just be handled just by adding them as new party members? I thougt this was how the game handled the trunk already. If you have vehicle x in your party and enter the map with said vehicle, then the trunk is created there and you have access to it.

On the other hand this solution would be rather strange when the player leaves his "primary" car for some reason and moves to some other location where he sit into the second car.
Yeah, this is the hardest part... With only one instance of "real" car, the other cars might get lost if not left in one of the "cities". If you leave a car in the desert and move on to a next one, the car in the desert will be gone forever. This can be explained again as "a theft", but you'll really have to think all through before the final implementation.

Well, the car already disappears if you just leave it on any random encounter/map. The only problem is how to handle the "Car outta power" issue. At first I considered this: like the part about "spending some time transfering the contents of the trunk," you could spend time transfering fuel. Then the game would only have to keep track of one fuel level at a time. However, I am pretty sure this would cause a problem if you left car x in one location (maybe even the Car outta power map), then went and got car y, fuel would be added to each. The best way then, I think, is to just go ahead and use either new global or even just a local variable (which is what I use to keep track of Skynet's rocket and 5mm ammo). However, I have no idea how fuel would be used up in each case.
 
MIB88 said:
Couldn't this issue just be handled just by adding them as new party members? I thougt this was how the game handled the trunk already. If you have vehicle x in your party and enter the map with said vehicle, then the trunk is created there and you have access to it.
Good point. Though the team members free slots will suffer, but that can be changed somehow, I believe - probably by fixing it in the EXE, there was some mod which removes the party limit here @NMA, so...

Well, the car already disappears if you just leave it on any random encounter/map. The only problem is how to handle the "Car outta power" issue.
Yes, that's what I meant. Just didn't write it, however I stated it in my first post.

The best way then, I think, is to just go ahead and use either new global or even just a local variable (which is what I use to keep track of Skynet's rocket and 5mm ammo). However, I have no idea how fuel would be used up in each case.
I think this won't work. The fuel can't be added, removed or in any other way manipulated by scripts. Adding fuel function is hard-coded, the fuel spending function too. Emptying the tank is impossible. Simply, it's very hard to manipulate fuel.
 
lisac2k said:
MIB88 said:
Couldn't this issue just be handled just by adding them as new party members? I thougt this was how the game handled the trunk already. If you have vehicle x in your party and enter the map with said vehicle, then the trunk is created there and you have access to it.
Good point. Though the team members free slots will suffer, but that can be changed somehow, I believe - probably by fixing it in the EXE, there was some mod which removes the party limit here @NMA, so...

NPC slots wouldn't be a problem. The unlimited party members mod could be used, or the individual NPC scripts could be altered to ignore the various trunks being in the party. I think it would have to do something like this now for the existing trunk.

The best way then, I think, is to just go ahead and use either new global or even just a local variable (which is what I use to keep track of Skynet's rocket and 5mm ammo). However, I have no idea how fuel would be used up in each case.
I think this won't work. The fuel can't be added, removed or in any other way manipulated by scripts. Adding fuel function is hard-coded, the fuel spending function too. Emptying the tank is impossible. Simply, it's very hard to manipulate fuel.

I was afraid you were going to say that. Back to the drawing board then. :)
 
lisac2k said:
The fuel can't be added, removed or in any other way manipulated by scripts. Adding fuel function is hard-coded, the fuel spending function too. Emptying the tank is impossible. Simply, it's very hard to manipulate fuel.

It's possible to add some fuel to the car from a script (it's done via the metarule function, there must be a macro defined to use it). To remove some fuel, I think you can use a negative value. But I don't know of any way to get the fuel level from a script.
 
ravachol said:
It's possible to add some fuel to the car from a script (it's done via the metarule function, there must be a macro defined to use it).
Found it, thanks for the pointer!
Code:
METARULE_GIVE_CAR_GAS
there's even the macro for it, including amount:
Code:
car_give_gas(AMOUNT)     metarule(METARULE_GIVE_CAR_GAS, AMOUNT)

ravachol said:
To remove some fuel, I think you can use a negative value.
Grgnrkmnmgnrh. Most of the functions doesn't work with negative values. But it doesn't harm trying.

But I don't know of any way to get the fuel level from a script.
Global Vars would be way to go, but all of this is just a theory... It'd be nice if Stark3000 would let us know about his progress.
 
To keep the original gameplay, it seems necessary to make use of the engine. Unfortunately, you don't have access to some data that seem essential (r/w access to the fuel level and location of the car). Creating a new car system from script isn't a bad idea but I'm not sure how you would handle travelling since you can't execute scripts on the worldmap (I had made a small hack to execute scripts on the worldmap - http://www.nma-fallout.com/forum/viewtopic.php?t=19755 - but it was just experimental stuff and shouldn't be used except by someone knowing what he's doing)

My idea if I had to do this would be to have a set of gvars for each car and load these gvars in the engine when the player uses a car. To avoid losing a car when you are out of fuel, I think it would be possible to add a location in city.txt for each car and configure its coordinates and show it on the worldmap when required (maybe it could even be extended to random encounters).

It shouldn't be too hard to extend fallout scripting (I think the best would be to extend the metarule or metarule3 function: it wouldn't require any compiler hack and scripts would be - more or less - still compatibles with fallout - it wouldn't crash like with an unknown opcode) to add support for accessing this kind of data. The problem would be to find some time to do it (I could easily find some time to begin but I'm not sure if I could finish it).
 
Thans a lot folks, there's been some interesting ideas and I'm going to try and see if any of it really works :D

lisac2k said:
But I don't know of any way to get the fuel level from a script.
Global Vars would be way to go, but all of this is just a theory... It'd be nice if Stark3000 would let us know about his progress.
As for this... I've been away from my computer till now so there's no real progress on my side. But I'm going to start now and of course I'll let you know about everything I find out.
 
Back
Top