Jump to content
HDMods

Vehicle parking

Recommended Posts

PD? FD? EMS? Which are you on about here? Each script is pretty different, but they're all down to the LAToFirestation/PoliceStation/Hospital scripts, they're pretty complicated at first but once you understand basic script it's easy to follow.

 

If you simply want to substitute one vehicle into a designated parking space editing the const chars at the top of the script will usually do the job - e.g changing BAY#1 from the prototype of one unit to another. 

 

However changing the way in which units park, for example getting PD to park in individual parking spots rather than just all facing the same direction, or creating new parking bays is where it becomes tricky and requires some knowledge.

 

 

This was a really quick overview on how these things work so hopefully it gives you an idea.

Link to comment
Share on other sites

Dyson is right. However, the scripting basics are essentially similar for FD, PD and EMS vehicles.

Each script makes use of at least 2 virtual objects on the map:

1 to define the actual parking space (in a fire station bay, on the streets or on a parking lot)

and 1 virtual object that is used as reference or rotation point (to turn the vehicle in the right direction when it's parked for example)

Each parking script (in my own mods) is build around that principle. Things may get complicated when you want to add:

- specifics such as opening/closing garage doors

- parking spaces for specific vehicles (like how LAFD Engine 1 can only park in bay 1 and not the other 4).

- battalion chief compatibility (when u want to call a vehicle from a parking space using a seperate command script)

Also, keep in mind that a vehicle need plenty of space to park and cannot interfere with other vehicles or parking spaces when parking. Otherwise the script can become glitchy. Getting that to work properly can sometimes take more time than building the actual script. In most cases you need additional virtual objects (to block a bay's sides for example) and streets (which improves pathfinding to the parking space) to get a parking script to work properly.

Link to comment
Share on other sites

I understand most of what the above comments said, My only issue is that I have edited the units in a modification and seeing as the new units are bigger they do not park the same way/ wont return to station.

 

Let me know what I need to do, also im assuming to say have a FD chief park on the side of the road where would i go to do that? EM4 editor and into map or somewhere in the mod file?

 

Thanks. K

Link to comment
Share on other sites

You will need to go into the editor and make the parking space you are using for the tower ladder just slightly bigger then the model or it will give you the no space at station message or park weird. It will also help auto staff it when the alarm is raised. I think the parking spaces are under virtual objects in the editor, you just need to go through them until you find the one for the ladder truck.

Link to comment
Share on other sites

I'm New to adding parking spaces/Making them This is what I want to do:

 

1,use a Station lets say Fire station 2 or 3 and have it staffed with some ambulances... what do i need to do step by step?

 

2,I dont care about making the gates move up and down at this point just want to have 2 ambulances lets say staffed from the start

 

Thanks for all your help guys really appreciated.

Link to comment
Share on other sites

I'm New to adding parking spaces/Making them This is what I want to do:

 

1,use a Station lets say Fire station 2 or 3 and have it staffed with some ambulances... what do i need to do step by step?

 

2,I dont care about making the gates move up and down at this point just want to have 2 ambulances lets say staffed from the start

 

Thanks for all your help guys really appreciated.

 

There's two steps to adding a new vehicle into the FS commands.

 

1. Spawning on start up

First you'll need to open up the FS start script, there'll be a section of code that dictates where a unit will spawn I'll explain what each bit means. You'll want to add a new section of this code between existing units spawning or at the end of the spawn list.

		ActorList l1 = Game::GetActors(VIRTUAL PARKING SPACE HERE);		for(int i=0; i < l1.GetNumActors(); i++)		{			Vector Pos = l1.GetActor(0)->GetPosition();			Vehicle m = Game::CreateVehicle(VEHICLE PROTO, UNNAMED);			m.PushActionRotateTarget(ACTION_NEWLIST, &m, 0, DIRECTION (0,45,90,180 etc), 0, 0.1f);			m.EnableBlueLights(false);                        m.SetPosition(Pos);                        m.UpdatePlacement();			m.SetMaxPassengers(2);			m.SetMaxTransports(0);			m.SetSpeed(12.0f);			m.PushActionWait(ACTION_APPEND, 1.f);			m.PushActionExecuteCommand(ACTION_APPEND, "VcmdStartStaffing", &m, TYPE OF STAFFING, false);	//0 = bat chiefs staffing, 1 = engines staffing, 2 = usar staffing upon start	(NOT SURE IF THESE STAFFING IDS ARE THE SAME AS LA)

This will now spawn the vehicle on start up on your VO in the direction you wish and with the load out you require.

 

2. Return to station

For this you need to edit these lines of the Return to station command (which is just as simple)

		else if(StrCompare(v.GetPrototypeFileName(), VEHICLE PROTO) == 0)		{ 			Game::CollectObstaclesOnVirtualObject(VIRTUAL PARKING OBJECT, l3, ACTOR_VEHICLE);			if(l3.GetNumObjects() > 0) //IF THERE'S ALREADY A UNIT PARKED			{				Mission::PlayHint(HINT_NOSPACE);				v.PushActionReturnToBase(ACTION_NEWLIST);				return;			} else			{				l1 = Game::GetActors(VO UNIT WILL TURN TO);				l2 = Game::GetActors(VO UNIT WILL PARK ON);			}		}

Now this doesn't include setting up gates etc as I've taken these codes from my personal edits of the FS script which has removed the LA gate system, but hopefully it gives you an idea of what each line means and what to edit. Also don't forget to add and new VOs or vehicles to the constant characters list at the top.

 

Hope it helps and sorry if I've missed anything

 

x

Link to comment
Share on other sites

Alot of that is greek to me but I will do the best I can with it, thanks for the tips though,

 

1, Ill start by putting the station in editor and creating some virutal objects

2, ill go into my scripts and copy and past a script but then edit the VO, Prototype name, and those kinds of things ( Correct way to do it)??

Link to comment
Share on other sites

Hey guys, sorry for replying to such an old topic, but this topic completely addresses the same problems as I have. 

 

I've been trying to rotate the spawning cars in both ways, described by hoppah and by Dyson. 

 

Hoppah's method is a little unclear to me when I look into the LAFireStationStart scripts. I do understand the cars rotate to a VO reference, which is stated in 'm.SetRotation()'. The only part I'm completely confused about is how the parameter works. In the script it constantly states a gate, like 'gate1'. So far, so good. The only problem for me is understanding where this 'gate1' get's defined. I can't find out where gate1 is defined.

 

Could someone give me a hand?

 

Tim

Link to comment
Share on other sites

Hey Tim the trick is to always look above where your question. So lets say you want to redefine gate 1 and you are looking at this:

 

        ActorList l7 = Game::GetActors(VO_AMBULANCE01);
        for(int i=0; i < l7.GetNumActors(); i++)
        {
            Vector Ambulance01 = l7.GetActor(0)->GetPosition();
            Vehicle m = Game::CreateVehicle(OBJ_AMBULANCE02, UNNAMED);
            m.EnableBlueLights(false);
            m.SetPosition(Ambulance01);
            m.SetRotation(gate1);
            m.UpdatePlacement();
            m.SetMaxPassengers(2);
            m.SetMaxTransports(1);
            m.SetSpeed(12.0f);
            m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 1, false);
            m.PushActionWait(ACTION_APPEND, 0.5f);
            m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 2, false);
        }

If you go up just a couple lines you will find a series of these lines

        GameObjectList gate01a = Game::GetGameObjects(NAME_GATE01A);
        for(int i=0; i < gate01a.GetNumObjects(); i++)
            GameObject *gate1 = gate01a.GetObject(i);

If you need to mess with more stuff just keep looking up to find things

        GameObjectList gate01a = Game::GetGameObjects(NAME_GATE01A);
        for(int i=0; i < gate01a.GetNumObjects(); i++)
            GameObject *gate1 = gate01a.GetObject(i);

 

const char NAME_GATE01A[]                = "fs_gate01a";

 

fs_gate01a in this case references an object on the map specifically the fire station gate with the name fs_gate01a under its properties it will show in red on the map.

 

 

In code you always have to define a method first before you can call it later. Hope that helped kinda long winded but I wanted to explain the best way I could.

Link to comment
Share on other sites

Hey Sniper,

Thanks for explaining, I figured something like this should do the trick. I did try messing with those values myself, but I got som errors. Maybe those where from different things, and not from the gates. I'll give it another go when I'm back home and I'll let you know if it worked.

Tim
 
--------
 
Just noticed I've somehow switched over to my old account I couldn't get access to the last time I tried. This is the same person as Tim Derks posted above.
 
Again, now I've added those lines you stated, I'm getting all kinds of errors. It's even so bad right now that placing the LAPoliceStation and LAPoliceStationStart scripts in the Scripts folder results in 2 empty firehouses with the roofs on and gates closed, and no vehicles at the policestation. 
 
That part of the log is stated below:

Freeplay: car accident attachment found
Freeplay: car accident attachment found
Freeplay: car accident attachment found
Freeplay: car accident attachment found
|Vision Core: Resized memory for Entities to 3513 kB.

?(_LAPoliceStationStart9e126c): Error: Symbol front is not defined in current scope
?(_LAPoliceStationStart9e126c): FILE:mod:/scripts/game/command/LAPoliceStationStart.script9e126c LINE:100
?(_LAPoliceStationStart9e126c): !!!Dictionary position rewound...
?(_LAPoliceStationStart9e126c): !!!Error recovered!!!
OpenGL vendor: NVIDIA Corporation
OpenGL renderer: GeForce GT 740M/PCIe/SSE2
renderer-string: NVIDIA;GF;GFN
OpenGL vendor: NVIDIA Corporation
OpenGL renderer: GeForce GT 740M/PCIe/SSE2
renderer-string: NVIDIA;GF;GFN
OpenGL vendor: NVIDIA Corporation
OpenGL renderer: GeForce GT 740M/PCIe/SSE2
renderer-string: NVIDIA;GF;GFN
|Vision Core: Resized memory for Entities to 3531 kB.

--- load time profile begin ---
--- load time profile end ---
Destroy Network...
Deleting units...
Destroy XGUI...
Destroy Audio...
Destroy GameFramework...
Destroy GFX...
Destroy Vision...
|VisMain_cl::DeInit

|DeInitializing Object Data...

|DeInitializing World Data...

|DeInitializing Surface and Texture Data...

|Dump resources...

|...no resource leaks.

|Deallocated fast Geometry Buffer.

Destroy Input...
Destroy Scriptscheduler...
Destroy Timer...
Destroy Screen...
Destroy UpdateChain...
Destroy Console...
Destroy Filesystem...

 

 

The PoliceStationStart.script is stated here:

PoliceStationStart.script

 

I hope somebody can see what's wrong

 

Tim

Link to comment
Share on other sites

Hey guys, sorry to respond after my own post, but I'm afraid most people missed the text I added in the previous post. Hopefully this will bring attention to it. Again, sorry to double post.
 
-------------
 
Alright, so after some asking around, I found out it's not the VO a truck points towards on starting a freeplay game, it just points in the same direction as a stated object.
For the fire stations, these are the actual front gates. If you'd turn a gate 90 degrees in the editor, the trucks behind that gate would make the same turn when starting a freeplay game.
 
You can make your own directional units when no FS gates are pointed in the right direction.
My tips: First, take a FS gate and check which side is the front. When you know what's the front, look in what direction it points after you selected it from the objects thingy.
Now you know what is "north". All objects you want to place in game will have their own "front side" pointing in that direction. So you can place a dumpster i.e., which will point it's front side in the same direction as your gate did. Turn the front side of this dumpster in the direction you want your vehicles to point in. Don't forget to name the dumpster, something like "turnto_dumpster".
 
Then go to your LAFSStart script and look for these lines: (don't forget to add the const char line at the top, and name the const char NAME_GATE<number><number><letter>)

		GameObjectList gate01a = Game::GetGameObjects(NAME_GATE01A);		for(int i=0; i < gate01a.GetNumObjects(); i++)			GameObject *gate1 = gate01a.GetObject(i);		GameObjectList gate02a = Game::GetGameObjects(NAME_GATE02A);		for(int i=0; i < gate02a.GetNumObjects(); i++)			GameObject *gate2 = gate02a.GetObject(i);				GameObjectList gate03a = Game::GetGameObjects(NAME_GATE03A);		for(int i=0; i < gate03a.GetNumObjects(); i++)			GameObject *gate3 = gate03a.GetObject(i);		GameObjectList gate04a = Game::GetGameObjects(NAME_GATE04A);		for(int i=0; i < gate04a.GetNumObjects(); i++)			GameObject *gate4 = gate04a.GetObject(i);		GameObjectList gate05a = Game::GetGameObjects(NAME_GATE05A);		for(int i=0; i < gate05a.GetNumObjects(); i++)			GameObject *gate5 = gate05a.GetObject(i);					GameObjectList gate06a = Game::GetGameObjects(NAME_GATE06A);		for(int i=0; i < gate06a.GetNumObjects(); i++)			GameObject *gate6 = gate06a.GetObject(i);		GameObjectList gate07a = Game::GetGameObjects(NAME_GATE07A);		for(int i=0; i < gate07a.GetNumObjects(); i++)			GameObject *gate7 = gate07a.GetObject(i);		GameObjectList gate08a = Game::GetGameObjects(NAME_GATE08A);		for(int i=0; i < gate08a.GetNumObjects(); i++)			GameObject *gate8 = gate08a.GetObject(i);

Copy over one of those lines and change it to fit your needs, like this:
 
GameObjectList gate<number><number><(small)letter> = Game::GetGameObjects(NAME_GATE<number><number><(capital)letter>);
for(int i=0; i < gate<number><number><(small)letter>.GetNumObjects(); i++)
      GameObject *gate<number><letter> gate<number><number><(small)letter>.GetObject(i);
 
You should keep the numbers and letter the same in the red and blue part. The orange part is the part you'll actually use. To keep this clear, use the same number(s) and letter as before, but don't use the first zero. So gate01a becomes gate1a. This is used as seen in the bit of code below. Hope this helps people.
 
 

		ActorList l7 = Game::GetActors(VO_AMBULANCE01);		for(int i=0; i < l7.GetNumActors(); i++)		{			Vector Ambulance01 = l7.GetActor(0)->GetPosition();			Vehicle m = Game::CreateVehicle(OBJ_AMBULANCE02, UNNAMED);			m.EnableBlueLights(false);			m.SetPosition(Ambulance01);			[color=#ffa500]m.SetRotation(gate1a);[/color]			m.UpdatePlacement();			m.SetMaxPassengers(2);			m.SetMaxTransports(1);			m.SetSpeed(12.0f);			m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 1, false);			m.PushActionWait(ACTION_APPEND, 0.5f);			m.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 2, false);		}
Link to comment
Share on other sites

hi all,

 

 

this may sound daft question but this is my first time editing a script and adding a new start up vehicle parking.

 

I am wanting to add another RRV in the welfordshire mod as I added an ambulance station in to it.

 

 

please can I know where to find the FS start script and what I need to add or change

 

 

thank you in advance

 

anthony

Link to comment
Share on other sites

Ok sorry for the double post. I've been trying to make a parking space at the hospital on v1 of the Montana mod. I have put the gate over by the hospital, but I cant figure out how to name it. Also no whenever the game starts it crashes to desktop and says something about can not find gate03. I tried to go ahead and put in the script which is why I think it crashes. Can someone help?

Link to comment
Share on other sites

Hi Hoppah, i'm having a problem when i try to move the 2 VOs of vehicle to park in the police station that i divide the place of one by one vehicle. But when the vehicle come to the first VO before another one and stop to check, then i run to park at another side...how to fix this ?  

Link to comment
Share on other sites

If anyone still wants to know how to change where vehicles park using existing parking spots, feel free to IM me to help you out. Even if it is a year after this comment still feel free to IM me. On the other hand, can anyone tell me how to add a new VO parking spot to the map?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...