Jump to content
soulbody

VT tow truck

Recommended Posts

I'm busy with a back-up pack but there is one unit which does not work as it have to.

i'm trying to let police call back-up from a tow truck but then i got a error. according the log file the error is caused by line 121:

in search for line 121 and came to this:

		VehicleList patrolCars(VT_THW_ASF);

i know did is wrong but i also tried this

		VehicleList patrolCars(VT_FIREFIGHTERS_ASF);

can anybody tell me what i need to use for the tow truck, nothing seems to work here.

The hole script:

  Reveal hidden contents

Link to comment
Share on other sites

  On 6/3/2010 at 5:45 PM, Xplorer4x4 said:

Are you sure the tow truck is classified as VT_THW_ASF?

Perhaps its something to do with the word patrolCars?

If you can copy and paste a similar command here, like call police back up. Doesnt need to be the whole script, just the code for the command.

well according to this site: ''http://www.emergency...dex.php/Vehicle'' it need to be ''VT_FIREFIGHTERS_ASF'' i tried that but it crash with the same message behind it was standing ''TODO: ist jetzt THW''

so i tried ''VT_THW_ASF as well but either that make it crash, i used/edited this command for the army units, those units are units without the patrol command either and there it doesn't crash...

Error Logfile:

(_LACallTowTruck8b2e5): Error: Symbol VT_THW_ASF is not defined in current scope

Logfile:

  Reveal hidden contents

Link to comment
Share on other sites

In the editor its listed as firefighters_asf. Your trying to dispatch it based on the vehicle type, rather then a vehicle prototype. The script has to call a specific prototype.

SetIcon("callpatrolcar");

Ok first make sure you change this to something like calltowtruck.

Second, keep in mind you need to dispatch the tow truck by its prototype. Something like:

n = Game::CreateVehicle(PROTO_TOW, UNNAMED);

Then define proto_tow above.

Link to comment
Share on other sites

  On 6/3/2010 at 7:00 PM, Xplorer4x4 said:

In the editor its listed as firefighters_asf. Your trying to dispatch it based on the vehicle type, rather then a vehicle prototype. The script has to call a specific prototype.

SetIcon("callpatrolcar");

Ok first make sure you change this to something like calltowtruck.

Second, keep in mind you need to dispatch the tow truck by its prototype. Something like:

n = Game::CreateVehicle(PROTO_TOW, UNNAMED);

Then define proto_tow above.

well line 121 is according to back-up for units in the area on stand-by, patrol and at the station.

the seticon is temperorly (excuse my english) but can not cause the error, the icon is there in-game and there is nothing mentioned in the error message or logfile.

According to PROTO_TOW... this is already being done, i change everything needed to be done excactly like i did in the call humvee, army truck and blackhawk commands and those commands works.

Link to comment
Share on other sites

Im not saying the icon thing will cause an error, i just suggested that to make sure you use the right command because both this command and the call patrol car script/command will be using the same image.

Technically the error the game is spitting out says it wants VT_THW_ASF to be a constant, so more or less it wants:

const char VT_THW_ASF[] = "mod:Prototypes/Vehicles/04 LA Tech/roll_back.e4p";

Link to comment
Share on other sites

I was doing some searching and came across this. Soulbody, I know you paused the project but wanted to point out some stuff in this script:

You were using:

 VehicleList patrolCars(VT_FIREFIGHTERS_ASF);

Your trying to do dispatch based onaq vehichle type, but the way your code is written, it is written where VT_FIREFIGHTERS_ASF is a specific vehicle, not vehicle type.

If you are doing vehicle type, you want something like this:

if (v.GetVehicleType() == VT_FIREFIGHTERS_ASF)

You can also optimize the script. You have:

 int NewMoney = Money - 1000;
Mission::SetMoney(NewMoney);
Vehicle n;
Person p1;
Person p2;
Person p(Caller);
if(StrCompare(p.GetPrototypeFileName(), OBJ_BATTALION_CHIEF) == 0)
{
if(l1.GetNumActors() == 0 && l2.GetNumActors() > 0)
{
Spawn = l3.GetActor(0)->GetPosition();
Rotate = l6.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_CHARGER_LAPD, UNNAMED);
n.SetSpeed(8.0f);

}
else if(StrCompare(p.GetPrototypeFileName(), OBJ_OFFICER_LASD) == 0 || StrCompare(p.GetPrototypeFileName(), OBJ_TRAFFIC_OFFICER_LASD) == 0)
{
if(l1.GetNumActors() == 0 && l3.GetNumActors() > 0)
{
Spawn = l3.GetActor(0)->GetPosition();
Rotate = l6.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_CV_LASD, UNNAMED);
n.SetSpeed(8.0f);
}
else if(StrCompare(p.GetPrototypeFileName(), OBJ_OFFICER_CHP) == 0 || StrCompare(p.GetPrototypeFileName(), OBJ_TRAFFIC_OFFICER_CHP) == 0)
{
if(l1.GetNumActors() == 0 && l3.GetNumActors() > 0)
{
Spawn = l3.GetActor(0)->GetPosition();
Rotate = l6.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_CV_CHP, UNNAMED);
n.SetSpeed(8.0f);

}
else
{
if(l1.GetNumActors() == 0 && l2.GetNumActors() > 0)
{
Spawn = l2.GetActor(0)->GetPosition();
Rotate = l5.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_CV_LAPD, UNNAMED);
n.SetSpeed(8.0f);
}

Most of this code is not needed. The code is written so if the BC calls for a patrol car a LAPD Charger is bought and dispatched. If an LASD officer calls for a patrol car, then an LASD CV shows up, and if CHP call for back up CHP Charger shows up. However in your case there calling a tow truck, so theres no need for that.

First delete:

Person p1;
Person p2;
Person p(Caller);

Your not spawning people so no need for that.

Secondly any one that calls the tow truck is calling the same unit, thw tow truck, so no point in the extra checks, and I would do it like this...first define PROTO_TOW_TRUCK as a constant at the top of the script, then do this:

if(StrCompare(p.GetPrototypeFileName(), OBJ_BATTALION_CHIEF) == 0)
{
if(l1.GetNumActors() == 0 && l2.GetNumActors() > 0)
{
Spawn = l3.GetActor(0)->GetPosition();
Rotate = l6.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_TOW_TRUCK, UNNAMED);
n.SetSpeed(8.0f);

}
else
{
if(l1.GetNumActors() == 0 && l2.GetNumActors() > 0)
{
Spawn = l2.GetActor(0)->GetPosition();
Rotate = l5.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_TOW_TRUCK, UNNAMED);
n.SetSpeed(8.0f);
}

This way there is less code and less if/else checks. No point in checking all those things when there all calling the same unit. If you want to use my call tow truck script instead, let me know. It is in game and working.

Link to comment
Share on other sites

Guest nbrown8568
  On 7/26/2010 at 8:04 PM, Xplorer4x4 said:

This way there is less code and less if/else checks. No point in checking all those things when there all calling the same unit. If you want to use my call tow truck script instead, let me know. It is in game and working.

Hey Xplorer,

Is this available in your submod. I have wanted this since playing LA Mod.

Norm,

Hey Stan can you link this to Xplorer's Submod. Thanx.

Link to comment
Share on other sites

Guest nbrown8568
  On 8/25/2010 at 1:33 AM, Xplorer4x4 said:

It will be included in the submod I am working on. Its almsot done on the scripting side. The 2 things I am waiting on right now are models and lights(the lights have to be moved a bit since I used NNICOs Crown Vic rather then the original LA Mod CV). More info here:

It would be great that the officer on scene could call dispatch for the tow truck

Link to comment
Share on other sites

Guest nbrown8568
  On 7/26/2010 at 8:04 PM, Xplorer4x4 said:

I was doing some searching and came across this. Soulbody, I know you paused the project but wanted to point out some stuff in this script:

You were using:

 VehicleList patrolCars(VT_FIREFIGHTERS_ASF);

Your trying to do dispatch based onaq vehichle type, but the way your code is written, it is written where VT_FIREFIGHTERS_ASF is a specific vehicle, not vehicle type.

If you are doing vehicle type, you want something like this:

if (v.GetVehicleType() == VT_FIREFIGHTERS_ASF)

You can also optimize the script. You have:

 int NewMoney = Money - 1000;
Mission::SetMoney(NewMoney);
Vehicle n;
Person p1;
Person p2;
Person p(Caller);
if(StrCompare(p.GetPrototypeFileName(), OBJ_BATTALION_CHIEF) == 0)
{
if(l1.GetNumActors() == 0 && l2.GetNumActors() > 0)
{
Spawn = l3.GetActor(0)->GetPosition();
Rotate = l6.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_CHARGER_LAPD, UNNAMED);
n.SetSpeed(8.0f);

}
else if(StrCompare(p.GetPrototypeFileName(), OBJ_OFFICER_LASD) == 0 || StrCompare(p.GetPrototypeFileName(), OBJ_TRAFFIC_OFFICER_LASD) == 0)
{
if(l1.GetNumActors() == 0 && l3.GetNumActors() > 0)
{
Spawn = l3.GetActor(0)->GetPosition();
Rotate = l6.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_CV_LASD, UNNAMED);
n.SetSpeed(8.0f);
}
else if(StrCompare(p.GetPrototypeFileName(), OBJ_OFFICER_CHP) == 0 || StrCompare(p.GetPrototypeFileName(), OBJ_TRAFFIC_OFFICER_CHP) == 0)
{
if(l1.GetNumActors() == 0 && l3.GetNumActors() > 0)
{
Spawn = l3.GetActor(0)->GetPosition();
Rotate = l6.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_CV_CHP, UNNAMED);
n.SetSpeed(8.0f);

}
else
{
if(l1.GetNumActors() == 0 && l2.GetNumActors() > 0)
{
Spawn = l2.GetActor(0)->GetPosition();
Rotate = l5.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_CV_LAPD, UNNAMED);
n.SetSpeed(8.0f);
}

Most of this code is not needed. The code is written so if the BC calls for a patrol car a LAPD Charger is bought and dispatched. If an LASD officer calls for a patrol car, then an LASD CV shows up, and if CHP call for back up CHP Charger shows up. However in your case there calling a tow truck, so theres no need for that.

First delete:

Person p1;
Person p2;
Person p(Caller);

Your not spawning people so no need for that.

Secondly any one that calls the tow truck is calling the same unit, thw tow truck, so no point in the extra checks, and I would do it like this...first define PROTO_TOW_TRUCK as a constant at the top of the script, then do this:

if(StrCompare(p.GetPrototypeFileName(), OBJ_BATTALION_CHIEF) == 0)
{
if(l1.GetNumActors() == 0 && l2.GetNumActors() > 0)
{
Spawn = l3.GetActor(0)->GetPosition();
Rotate = l6.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_TOW_TRUCK, UNNAMED);
n.SetSpeed(8.0f);

}
else
{
if(l1.GetNumActors() == 0 && l2.GetNumActors() > 0)
{
Spawn = l2.GetActor(0)->GetPosition();
Rotate = l5.GetActor(0)->GetPosition();
}
n = Game::CreateVehicle(PROTO_TOW_TRUCK, UNNAMED);
n.SetSpeed(8.0f);
}

This way there is less code and less if/else checks. No point in checking all those things when there all calling the same unit. If you want to use my call tow truck script instead, let me know. It is in game and working.

I need to know where to paste this script and if this is all I need to do for the P.O. to call tow truck.

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...