Jump to content
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Sign in to follow this  
mtloya

LAToPoliceStation Coding For Specific Vehicles

Recommended Posts

Hi all,

First and foremost, I am making alterations to Hoppah's LA Mod.

What I am trying to do is create specific parking spaces in the parking lot of the police station, that a specific vehicle will go to, much like how the fire units work.
The vehicles in particular that I am trying to make spaces for are the Bomb Squad SUV, SWAT Truck 1 & 2, and the Tech Engineer's Van. I currently have VOs already made for each of them, but I'm not sure how to go about coding each specific vehicle to go to a certain parking spot.

I'm assuming I can use a bit of the ToPoliceStation code, particularly the Heli part, and just rename the VO_HELI to "VO_BOMBSQ" for instance... But then, I see there is a v.GetVehicleType function...

Can anyone give me a good starting place or any suggestions? Any help is appreciated!

Thanks in advance!!

Share this post


Link to post
Share on other sites

On my end, I copied the logic from the ToFireStation code. Here's my example.

Ignore the 'facingWest' variables becuase those are specific things I did for my mod.

StrCompare is the line where the game checks the prototype name of the vehicle.

ParkingLotFound is the variable that is checked to ensure that the virtual object is actually on the map.

The GameObjectList checks if the virtual object has any vehicle inside it.

"l1" acts as the ActorList for the specific virtual object assigned to the vehicle. Later down the script, the game decares 'l1' as a position (a Vector) in the game which is where vehicles will go to.

http://www.emergency-planet.com/uploads/monthly_2018_01/Untitled.thumb.png.967c8781f34e2ed5148cf1450b8f8908.png

Untitled.png

Share this post


Link to post
Share on other sites

Thanks for the reply and the explanations, Itchboy. I'll try piecing it together the next time I'm able to get around to coding. Quick additional question: is there any real difference for using the .GetNumObjects() vs the .ContainsSquad()? What exactly do both refer to?

Share this post


Link to post
Share on other sites

GetNumObjects()

This function counts the number of objects in the gameObject list regardless of type or usability.

ContainsSquad()

This checks if there are any playable units such as vehicles and personnel within the gameObject list.

ContainsSquad is faster because it checks fewer objects and therefore consumes less memory having to store fewer objects. Only use it if you're checking for squads (playable units) within the list. It wont count random props, buildings, and NPC's.

If you're gonna count all other objects, then you need to use GetNumObjects.

Share this post


Link to post
Share on other sites

Thanks again for your explanations, @itchboy. I'll poke around and see what I can come up with.

Edit:

Alright, so after a bit of troubleshooting, I got my code to work. Sort of. Added the commands to the proper vehicles and all that jazz, but whenever I get in game, spawn the vehicle and command it to park, it'll do so, but much like the issue I was having with my ToFireStation script, it won't park correctly in the spot. I've already moved all of the civilian vehicles out of the way, so there is nothing around the VOs except for the actual police station and the fence, as seen in the screenshot:

Spoiler

tBmeElV.png

Are the fence/police station objects causing this? Would I be better off moving the VOs to the middle rows of parking spaces?

 

Furthermore, I have an additional issue: After the vehicle is parked in it's spot, a second/tick will pass and then the command will run itself again, sending the vehicle either back to HQ or to a different parking spot. I have a feeling that when the vehicle moves to the spots I created, it isn't counting it as actually being parked there, causing the command to check again for another open spot.

Addl edit: Moving the VOs to the middle and switching the civ cars did nothing. Issue persists... Added my script file.

LAToPoliceStation.script

Edited by mtloya
Added script file, screenshot, more info.

Share this post


Link to post
Share on other sites

The command running itself again is check intended to 're park' the car if it gets stuck or misaligned. Its a feature, not a bug.

In order to stop the thing doing it over and over again, you need to add the new virtual objects to childID 2 of the police station code.

For parking, all of your vehicles need to be one slot away from each other for them to park correctly.

72hY6SF.png

http://www.emergency-planet.com/uploads/monthly_2018_01/Untitled.png.37705844b651712843271b64136e62b3.png

Untitled.png

Share this post


Link to post
Share on other sites

Alright, thanks once more for your help. Adding each new spot under the ChildID=2 section obviously helped. The vehicles still aren't parking normally however, even when spaced apart. I'll try to move the VOs to different locations and see if that helps at all.

Share this post


Link to post
Share on other sites

I know this is a little old, but one thing I had to make sure of, is that each VO was wide enough and long enough.

Norm,

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...