How to add the car to a map.

Chris Parks

Vault Senior Citizen
Hi,

I've been looking recently at adding the car to my map. I've looked at ARBRIDGE.ssl as an example and I've also seen the car referenced in many header files, (for example, the start location of car)

Could anybody give me some help with how to do this exactly? Obviously when you enter EPA at the moment, the car disappears but I'd rather it worked properly,
 
Hi Chris Parks.
Here is an excerpt from Broken Hills map 1:

if ((map_var(MVAR_Made_Car) == 0) and (global_var(GVAR_PLAYER_GOT_CAR) != 0) and (car_current_town == AREA_BROKEN_HILLS)) then begin
set_map_var(MVAR_Made_Car,1);
Create_Car(CAR_BROKEN_HILLS_HEX,CAR_BROKEN_HILLS_ELEV)
end

else if ((map_var(MVAR_Made_Car) == 1) and (car_current_town != AREA_BROKEN_HILLS)) then begin
set_map_var(MVAR_Made_Car,0);
Dest_Car(CAR_BROKEN_HILLS_HEX,CAR_BROKEN_HILLS_ELEV)
end

Create a map header for you current map (Black isle/Fo2mapper/scripts/headers, open an existing one , copy/paste, rename, trim as needed).
Create a map.gam (same map header name, different extension, fallout2/data/maps, open an existing one...)
Include the header in your map script. Use FSE to register the map variable in the header. Currently if you try to register a map var in a non existing header, then FSE creates the header/map.gam, considers the var as registered, but there's actually no var in the files.
Next step is to define your EPA_HEX, AREA_EPA and CAR_EPA_ELEVATION.
HEX is defined in updatemaps.H
AREA is defined in maps.H
Sorry, I can't find where the elevation is defined: does anybody knows?
Make a backup copy of your headers, just in case.
If I manage to find the last file I'll edit this post.
Cheers.

EDIT: the elevation is defined in updatemaps.H again...
 
Thanks for the advice on the car problem.

However, I'm still having problems!! I followed your instructions closely and kept referencing ARBRIDGE as a working example but everytime I enter the map, the car still disappears. I've even started again from the beginning and redone everything but it still doesn't work.

Any thoughts?
 
Hi Chris Parks.
To tell the truth I haven't tinkered much with the car... I'm simply positive that the only scripts involved are the map ones.
I can only think about a code mistake or the fact that something slipped past my attention. The latter being probable... I got a look in scripts and headers again and found nothing new.
Please post your map script, I'll give it a try.
P.S. This is probably out of place at your current scripting ability, but... You did test everything in game, didn't you? Also remember that scripts are stored in savegames, so the only way to test a map script is to enter the map for the first time... Sorry, just evaluating stuff.
See you soon.
 
Yeah, I've been testing most things in game where necessary. It's annoying to start the game afresh so many times, but it's worth it overall.

Here's my map script,

/*
Name: EPA
Location: EPA
Description: This is the Map Script for the EPA

Log:
Please note any changes that have been made to the file in Updated. Then comment
the code which you have changed/altered/commented out. Please, do not delete any
code which was written.

Created: MAY 2006

Updated:

/* Include Files */

#include "..\headers\define.h"
#include "..\headers\epax.h"
#include "..\headers\updatmap.h"


#define NAME SCRIPT_EPA1

#include "..\headers\command.h"



procedure start;
procedure map_exit_p_proc;
procedure map_enter_p_proc;
procedure map_update_p_proc;

procedure start
begin
end

procedure map_enter_p_proc begin
if (map_first_run) then begin
display_msg(message_str(1354, 100));
end

if ((map_var(MVAR_Made_Car) == 0) and (global_var(GVAR_PLAYER_GOT_CAR) != 0) and (car_current_town == AREA_EPA)) then begin
set_map_var(MVAR_Made_Car,1);
Create_Car(CAR_EPA_HEX,CAR_EPA_ELEV)
end

else if ((map_var(MVAR_Made_Car) == 1) and (car_current_town == AREA_EPA)) then begin
set_map_var(MVAR_Made_Car,0);
Dest_Car(CAR_EPA_HEX,CAR_EPA_ELEV)
end

if (global_var(GVAR_EPA_ELEVATORS)==4) then begin
override_map_start_hex(15684,2,0);
set_global_var(GVAR_EPA_ELEVATORS,0);
end

Lighting;

end

procedure map_update_p_proc begin
Lighting;
end

procedure map_exit_p_proc
begin

end

I've sat and puzzled a few hours over this but I still don't know what I'm doing wrong.

Hopefully one of you guys may know or see something I haven't

Thanks
 
Have you attempted to just use

Check_Create_Car(CAR_EPA_HEX, CAR_EPA_ELEV)

and made sure to define CAR_EPA_HEX and CAR_EPA_ELEV in the UPDATMAP header file?

I admit I have not looked thoroughly at what you did, but the way I describe should work just fine.
 
Well you made a mistake in the code:
Code:
 else if ((map_var(MVAR_Made_Car) == 1) and (car_current_town == AREA_EPA)) then begin 
set_map_var(MVAR_Made_Car,0);
it should be:
Code:
 else if ((map_var(MVAR_Made_Car) == 1) and (car_current_town != AREA_EPA)) then begin 
set_map_var(MVAR_Made_Car,0);
You have (car_current_town == AREA_EPA) instead of (car_current_town != AREA_EPA)
This if statement always deleted car if he was on map.
 
To killap

Thanks for the advice, I will try this and post results once it is done.

To Jargo,

Yeah, that was an error on my part that I noticed when i came offline. Unfortunately, when I altered it and recompiled, the car still didn't appear.
 
Car creating works just like that:

1 First it checks if car is not on map
Code:
(map_var(MVAR_Made_Car) == 0)
2 If player got this car at all
Code:
(global_var(GVAR_PLAYER_GOT_CAR) != 0)
3 If car is on current location (area from city.txt)
Code:
(car_current_town == AREA_EPA)

So you must have a car and drive it to EPA area.
AREA_APA is nb 19 from city.txt.


Code:
[Area 19]                ; Environmental Protection Agency 
area_name=EPA 
world_pos=621,970 
start_state=Off 
size=Large 
townmap_art_idx=-1 
townmap_label_art_idx=-1 
entrance_0=On,130,150,Desert Encounter 2,-1,-1,0

You must connect your map to this area.

It may look like that:
Code:
entrance_1=On,130,150,Epa_map_name,-1,-1,0

Where Epa_map_name is lookup_name of your map taken from maps.txt.

Code:
[Area 19]                ; Environmental Protection Agency 
area_name=EPA 
world_pos=621,970 
start_state=Off 
size=Large 
townmap_art_idx=-1 
townmap_label_art_idx=-1 
entrance_0=On,130,150,Desert Encounter 2,-1,-1,0
entrance_1=On,135,151,Epa_map_name,-1,-1,0
 
Thanks everyone for your help. The car problem has now been sorted and as far as I can see, it works as it should do now.
 
I know this is off-topic but this was the latest modding thread I could find. Im trying to learn scripting using FSE 1.5a, and im trying to see if I can get a new header file to work. This is what i did

Code:
#ifndef
#define TESTHE_H

#define NORTH                       (0)
#endif

in script
Code:
#include "..\headers\TESTHE.h"

Then I test the NORTH in a simple if statement, but the script will say NORTH is an undefined symbol when i compile it. I don't know what the problem is since if I put the same define NORTH in the define.h header it works fine. Is there anything else I must do to make sure the scripts read new header files besides #include?
Thanks a lot.

Nevermind, im an idiot. Bad inclusion guards (is that what they're called?)
 
Hi Yossarian.
If you include something in define.h, then you can always compile. The scripting engine takes it for macro, or an item, or anything you want. If you put it in a map header, then you're adding a map var which MUST be registered in two files: map.h and map.gam (same folder of maps files). Open an existing map.gam, copy&paste, rename, then use FSE to register the new map variable. After that simply include your map.h just like you did.
Don't get me wrong, next time you have such problems, please DO start a new thread: the subject's worth it and keeps things clear and ordered for other people who might be starting scripting.
If you have more questions please feel free to ask.
Cheers.
 
Back
Top