Jump to content
cops

ambulance say that they won't belong to the station

Recommended Posts

Hallo,

 

I am currently helping a friend by scripting a part for his mod, how ever... I got a small script problem

The ambulance I placed for the station won't return to there VO... They do spawn there and I don't get a script error or something similar

Only when I send the ambulance to a call and I want to let them return to the station it says "This vehicle don't belong to the station"

 

Can someone help me with this? 

 

it goes about 

VO_Ambulance01

VO_Ambulance02

VO_Ambulance03

 

both of the original units are replaced by AMBULANCE1

and for the second firestation the ambulance has been replaced by ALS1

In the spoiler you can find: 
LAFirestation
LAToFirestation

LAFirestationStart

 

  Reveal hidden contents
 

 

 

 

 

Link to comment
Share on other sites

There are a few problems I see. After a quick glance I've noticed that you reuse the same ambulance prototype in different constants.
 
If you want an ambulance to be considered different, it needs to have its own uniquely names prototype:
 
LAToFireStation.script

const char OBJ_AMBULANCE01[] = "mod:Prototypes/Vehicles/01Ambulance/AMBULANCE1.e4p";const char OBJ_AMBULANCE02[] = "mod:Prototypes/Vehicles/01Ambulance/AMBULANCE1.e4p";const char OBJ_AMBULANCE03[] = "mod:Prototypes/Vehicles/01Ambulance/AMBULANCE1.e4p";

As far as the game engine is concerned, AMBULANCE01, AMBULANCE02, and AMBULANCE03 are the same thing. The script uses the prototype to differentiate between vehicles:

if(StrCompare(m.GetPrototypeFileName(), OBJ_AMBULANCE01) == 0)

When returning to station, it's always going to trip on the first  if statement, meaning if you send ambulance03 back to station, it's always going to go OBJ_AMBULANCE01's spot, since OBJ_AMBULANCE03's prototype is the same as OBJ_AMBULANCE01. This is going to cause problems with most implementations.

 

I'd fix that first and see if that fixes the issue. There's probably more to fix but LA Mod based parking scripts are really hard to read, especially with no code formatting  :stupid:

Link to comment
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.



×
×
  • Create New...