Jump to content
helljumper51

Change vehicles around the station

Recommended Posts

ok so what i want to do is change the stations around a bit. I want to try to get the tiller in where the Aerial is located and switch the aerial with the hazmat, just becuase the hazmat is kinda useless. then i want to put the light equipment in for that ambulance in station 2. and to replace the heavy rescue, put in the usfs tanker. how would I go about doing this?

Link to comment
Share on other sites

ok so what i want to do is change the stations around a bit. I want to try to get the tiller in where the Aerial is located and switch the aerial with the hazmat, just becuase the hazmat is kinda useless. then i want to put the light equipment in for that ambulance in station 2. and to replace the heavy rescue, put in the usfs tanker. how would I go about doing this?

Hi Helljumper,

Here is a script which will change the tiller into the Ladder position at FS1 and the Ladder at Hazmat position in FS2. If you need the other changes done and Xplorer4x4 has not sorted it for you, then let me know.

Script_with_ladder.zip

If you get the chance, have alook at my submod - I have added a few things to it, in honour of your earlier work :cheers:

Take care

Shane

Link to comment
Share on other sites

take a look here.

Tiller

The LEV is currently in the additional units sub mob that has not been released yet, but it is in ShaneGreens submod of the LA Mod in the sub mods section.

LEV was released ages ago mate

Read the whole post there before you install it though, as it changes xml files, so if youve added other vehicle mods youd need to re-add.

Link to comment
Share on other sites

Guest 1shot1kill

Sorry for bumping this somewhat old topic, I didn't want to start a new topic for this.

I have been playing LA mod on and off for a couple of years and I recently started playing the latest version again. I have been using the script Shane posted above and it works great, the only thing I do not like is that if you call the light force the tiller is always called from station 1 while the aerial is available at station 2 even if station 2 is closer. Is there any way to change this so the Aerial at station 2 gets used when you call the light force? Even if it would require replacing the engine 1 at station 2 with an engine 2 I would be happy if somebody could tell me how or code the files for me as I have no experience coding however am quite experienced with computers and scripts. This one is puzzling me though.

Any help would be greatly appreciated.

Link to comment
Share on other sites

I havent checked shanes script to see exactly how he modified it, but try this. Open the script file in notepad, or better yet, notepad2(google it).

Find:

object PcmdCallLightForce : CommandScript

Now delete that line, and every line after it until you see:

object PcmdCallUSARSquad : CommandScript

Do not delete that line.

Now above the copy and paste this:

object PcmdCallLightForce : CommandScript
{
PcmdCallLightForce()
{
SetIcon("calllightforce");
SetCursor("callassistance");
SetValidTargets(ACTOR_FLOOR | ACTOR_VIRTUAL);
SetDeselectCaller(false);
SetSelfClickActivation(true);
SetHighlightingEnabled(false);
SetGroupID(CGROUP_GETEQUIPMENT);
SetGroupLeader(true);
}

bool CheckPossible(GameObject *Caller)
{
GameObjectList SelectPer = Game::GetSelectedGameObjects();
if (SelectPer.GetNumObjects() != 1)
return false;

Person p(Caller);
if(p.IsValid() && (p.IsLinkedWithPerson() || p.IsCarryingPerson() || p.IsEquipped() || p.IsPulling() || p.GetFirehoseID()!=0 || p.GetEnteredCarID() != -1))
return false;

if (p.IsCurrentAction("EActionTreatPerson"))
return false;

if (!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON)
return false;

return true;
}

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
if(!Caller->IsValid() || Caller->GetID() == Target->GetID())
return false;

if (Caller->GetType() != ACTOR_PERSON)
return false;

Person p(Caller);
if(p.IsValid() && (p.IsLinkedWithPerson() || p.IsCarryingPerson() || p.IsEquipped() || p.IsPulling() || p.GetFirehoseID()!=0 || p.GetEnteredCarID() != -1))
return false;

if (p.IsCurrentAction("EActionTreatPerson"))
return false;

return true;
}

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
Vector CmdPos = Game::GetCommandPos();
Caller->PushActionTurnTo(ACTION_NEWLIST, CmdPos);
Caller->PushActionSwitchAnim(ACTION_APPEND, "talkmike");
Caller->PushActionWait(ACTION_APPEND, 3.5f);
Caller->PushActionSwitchAnim(ACTION_APPEND, "idle");
if(StrCompare(Caller->GetPrototypeFileName(), OBJ_BATTALION_CHIEF) == 0)
Audio::PlaySample3D(SND_BATLIGHTFORCE, Caller->GetPosition());
else if(StrCompare(Caller->GetPrototypeFileName(), OBJ_EMS_CAPTAIN) == 0)
Audio::PlaySample3D(SND_EMSLIGHTFORCE, Caller->GetPosition());

Vehicle *theCar = NULL;
float bestCar = 0.;
VehicleList patrolCars(VT_FIREFIGHTERS_DLK, VT_FIREFIGHTERS_RW);
for (int i = 0; i < patrolCars.GetNumVehicles(); i++)
{
Vehicle *aCar = patrolCars.GetVehicle(i);
if ((StrCompare(aCar->GetPrototypeFileName(), OBJ_LADDER) == 0 || StrCompare(aCar->GetPrototypeFileName(), OBJ_TILLER) == 0) && aCar->GetPlayerMP() == Caller->GetPlayerMP() && !aCar->HasCommand(DUMMY_VCALLED) && !aCar->IsInstalled() && (aCar->HasCommand(CMD_STANDBY_OFF) || aCar->IsCollidingWithVirtualObject(VO_SQUAD01)))
{
float distCurrCar = Math::dist(CmdPos.x, CmdPos.y, aCar->GetPosition().x, aCar->GetPosition().y);
if (distCurrCar < bestCar || bestCar == 0.)
{
theCar = aCar;
bestCar = distCurrCar;
}
}
}
if (theCar)
{
bool VehicleCalled = false;
if (theCar->HasCommand(CMD_STANDBY_OFF))
{
theCar->PushActionWait(ACTION_NEWLIST, 0.3f);
theCar->PushActionMove(ACTION_APPEND, CmdPos);
if (!theCar->HasCommand(DUMMY_HASSIREN) && theCar->HasCommand(CMD_AUTOSIREN_OFF) && !Input::LShiftPressed() && !Input::RShiftPressed())
Game::ExecuteCommand(CMD_SIREN, theCar, theCar);
if (theCar->HasCommand(CMD_STANDBY_OFF))
{
theCar->RemoveCommand(CMD_STANDBY_OFF);
theCar->AssignCommand(CMD_STANDBY_ON);
}
if (theCar->HasCommand(CMD_WARNINGLIGHTS_OFF))
{
theCar->EnableBlinker(BLT_NONE);
theCar->RemoveCommand(CMD_WARNINGLIGHTS_OFF);
theCar->AssignCommand(CMD_WARNINGLIGHTS_ON);
}
if (theCar->HasCommand(CMD_FLOODLIGHTS_OFF))
{
theCar->EnableSpecialLights(false);
theCar->RemoveCommand(CMD_FLOODLIGHTS_OFF);
theCar->AssignCommand(CMD_FLOODLIGHTS_ON);
}
Mission::PlayHint(HINT_DISPATCHED);
return;
}
else if (theCar->IsCollidingWithVirtualObject(VO_SQUAD01))
{
GameObjectList ppc;
Game::CollectObstaclesOnVirtualObject(VO_TILLER, ppc, ACTOR_VEHICLE);
for (int i = 0; i < ppc.GetNumObjects(); i++)
{
Vehicle v = ppc.GetObject(i);
if (!v.HasCommand(DUMMY_VCALLED))
{
v.AssignCommand(DUMMY_VCALLED);
VehicleCalled = true;
}
}
}
if (VehicleCalled)
{
if (v.IsBlueLightEnabled() && (Input::LShiftPressed() || Input::RShiftPressed()))
v.EnableBlueLights(false);
else if (!v.IsBlueLightEnabled() && !Input::LShiftPressed() && !Input::RShiftPressed())
v.EnableBlueLights(true);
GameObjectList gate03a = Game::GetGameObjects(OBJ_GATE03A);
for(int i=0; i < gate03a.GetNumObjects(); i++)
GameObject *gate = gate03a.GetObject(i);

PersonList passengers = v.GetPassengers();
if (passengers.GetNumPersons() == 0)
{
v.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 3, false);
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
v.PushActionWait(ACTION_APPEND, 10.f);
}
if (gate->GetUserData() == 0)
{
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 5, false);
Vector Move = v.GetPosition();
float r[9];
float childr[9];
v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
float dx = 750.f, dy = 0.f, dz = 0.f;
Math::RotateVector(dx, dy, dz, r);
Math::EulerToMatrix(0.0f, 0.f, 0.f, childr);
Math::MultiplyMatrices(childr, r);
Move = Move + Vector(dx, dy, 0);
v.PushActionWait(ACTION_APPEND, 1.2f);
if (!v.HasCommand(DUMMY_HASSIREN) && v.HasCommand(CMD_AUTOSIREN_OFF) && !Input::LShiftPressed() && !Input::RShiftPressed())
v.PushActionExecuteCommand(ACTION_APPEND, CMD_SIREN, Caller, 0, false);
v.PushActionMove(ACTION_APPEND, Move);
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 5, false);
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_VCALLED, Caller, 0, false);
v.PushActionMove(ACTION_APPEND, CmdPos);
} else
{
if (!v.HasCommand(DUMMY_HASSIREN) && v.HasCommand(CMD_AUTOSIREN_OFF) && !Input::LShiftPressed() && !Input::RShiftPressed())
v.PushActionExecuteCommand(ACTION_APPEND, CMD_SIREN, Caller, 0, false);
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_VCALLED, Caller, 0, false);
v.PushActionMove(ACTION_APPEND, CmdPos);
}
if (v.HasCommand(CMD_STANDBY_OFF))
{
v.RemoveCommand(CMD_STANDBY_OFF);
v.AssignCommand(CMD_STANDBY_ON);
}
if (v.HasCommand(CMD_WARNINGLIGHTS_OFF))
{
v.EnableBlinker(BLT_NONE);
v.RemoveCommand(CMD_WARNINGLIGHTS_OFF);
v.AssignCommand(CMD_WARNINGLIGHTS_ON);
}
if (v.HasCommand(CMD_FLOODLIGHTS_OFF))
{
v.EnableSpecialLights(false);
v.RemoveCommand(CMD_FLOODLIGHTS_OFF);
v.AssignCommand(CMD_FLOODLIGHTS_ON);
}
Mission::PlayHint(HINT_DISPATCHED);

if (Input::LCtrlPressed() || Input::RCtrlPressed())
return;

bool Vehicle2Called = false;
bool Engine04 = false;
if (!Vehicle2Called)
{
GameObjectList l1;
Game::CollectObstaclesOnVirtualObject(VO_ENGINE02, l1, ACTOR_VEHICLE);
if(l1.GetNumObjects() > 0)
{
Vehicle e = l1.GetObject(0);
if (!e.HasCommand(DUMMY_VCALLED))
{
e.AssignCommand(DUMMY_VCALLED);
Vehicle2Called = true;
} else
Engine04 = true;
} else
Engine04 = true;
}
if (!Vehicle2Called && Engine04)
{
GameObjectList l1;
Game::CollectObstaclesOnVirtualObject(VO_ENGINE04, l1, ACTOR_VEHICLE);
if(l1.GetNumObjects() > 0)
{
Vehicle e = l1.GetObject(0);
if (!e.HasCommand(DUMMY_VCALLED))
{
e.AssignCommand(DUMMY_VCALLED);
Vehicle2Called = true;
}
}
}
if (!Vehicle2Called && Engine04)
{
Mission::PlayHint(HINT_NOENGINE);
return;
}
if (Vehicle2Called)
{
if (e.IsBlueLightEnabled() && (Input::LShiftPressed() || Input::RShiftPressed()))
e.EnableBlueLights(false);
else if (!e.IsBlueLightEnabled() && !Input::LShiftPressed() && !Input::RShiftPressed())
e.EnableBlueLights(true);

GameObjectList gate05a = Game::GetGameObjects(OBJ_GATE05A);
for(int i=0; i < gate05a.GetNumObjects(); i++)
GameObject *gate = gate05a.GetObject(i);

PersonList passengers = e.GetPassengers();
if (passengers.GetNumPersons() == 0)
{
e.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_CALLCREW, Caller, 3, false);
e.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
e.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
e.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);
e.PushActionWait(ACTION_APPEND, 7.f);
}
if (gate->GetUserData() == 0)
{
e.PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 5, false);
Vector Move = e.GetPosition();
float r[9];
float childr[9];
e.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);
float dx = 1050.f, dy = 0.f, dz = 0.f;
Math::RotateVector(dx, dy, dz, r);
Math::EulerToMatrix(0.0f, 0.f, 0.f, childr);
Math::MultiplyMatrices(childr, r);
Move = Move + Vector(dx, dy, 0);
e.PushActionWait(ACTION_APPEND, 1.2f);
if (!e.HasCommand(DUMMY_HASSIREN) && e.HasCommand(CMD_AUTOSIREN_OFF) && !Input::LShiftPressed() && !Input::RShiftPressed())
e.PushActionExecuteCommand(ACTION_APPEND, CMD_SIREN, Caller, 0, false);
e.PushActionMove(ACTION_APPEND, Move);
e.PushActionExecuteCommand(ACTION_APPEND, DUMMY_GATES, Caller, 5, false);
e.PushActionExecuteCommand(ACTION_APPEND, DUMMY_VCALLED, Caller, 0, false);
e.PushActionMove(ACTION_APPEND, CmdPos);
} else
{
if (!e.HasCommand(DUMMY_HASSIREN) && e.HasCommand(CMD_AUTOSIREN_OFF) && !Input::LShiftPressed() && !Input::RShiftPressed())
e.PushActionExecuteCommand(ACTION_APPEND, CMD_SIREN, Caller, 0, false);
e.PushActionExecuteCommand(ACTION_APPEND, DUMMY_VCALLED, Caller, 0, false);
e.PushActionMove(ACTION_APPEND, CmdPos);
}
if (e.HasCommand(CMD_STANDBY_OFF))
{
e.RemoveCommand(CMD_STANDBY_OFF);
e.AssignCommand(CMD_STANDBY_ON);
}
if (e.HasCommand(CMD_WARNINGLIGHTS_OFF))
{
e.EnableBlinker(BLT_NONE);
e.RemoveCommand(CMD_WARNINGLIGHTS_OFF);
e.AssignCommand(CMD_WARNINGLIGHTS_ON);
}
if (e.HasCommand(CMD_FLOODLIGHTS_OFF))
{
e.EnableSpecialLights(false);
e.RemoveCommand(CMD_FLOODLIGHTS_OFF);
e.AssignCommand(CMD_FLOODLIGHTS_ON);
}
return;
}
}
}
Vector Spawn;
Vector Rotate;
ActorList l1 = Game::GetActors(VO_SPAWN_ALL);
ActorList l2 = Game::GetActors(VO_SPAWN_FD);
ActorList l3 = Game::GetActors(VO_SPAWN_ALLR);
ActorList l4 = Game::GetActors(VO_SPAWN_FDR);
if(l1.GetNumActors() > 0)
{
Spawn = l1.GetActor(0)->GetPosition();
Rotate = l3.GetActor(0)->GetPosition();
}
else if(l2.GetNumActors() > 0)
{
Spawn = l2.GetActor(0)->GetPosition();
Rotate = l4.GetActor(0)->GetPosition();
}
else
{
Mission::PlayHint(HINT_NOLADDER);
return;
}

System::Log("Buy light force engine");
bool BuyAerialOnly = false;
int Money = Mission::GetMoneyLeft();
if (Money <= 4000)
{
Mission::PlayHint(HINT_NOLADDER);
return;
}
else if (Input::LCtrlPressed() || Input::RCtrlPressed())
BuyAerialOnly = true;
else if (Money <= 8000)
BuyAerialOnly = true;
if (BuyAerialOnly)
int NewMoney = Money - 4000;
else
int NewMoney = Money - 8000;
Mission::SetMoney(NewMoney);

Vehicle n;
Person p1;
Person p2;
n = Game::CreateVehicle(OBJ_LADDER, UNNAMED);
n.SetSpeed(9.0f);
p1 = Game::CreatePerson(OBJ_EMT, UNNAMED);
p2 = Game::CreatePerson(OBJ_EMT, UNNAMED);
n.SetPlayerMP(Caller->GetPlayerMP());
p1.SetPlayerMP(Caller->GetPlayerMP());
p2.SetPlayerMP(Caller->GetPlayerMP());
p1.SetUpgradeLevel(3);
p2.SetUpgradeLevel(3);
n.SetMaxPassengers(6);
n.SetMaxTransports(0);
n.AddPassenger(&p1);
n.AddPassenger(&p2);
n.SetPosition(Spawn);
n.UpdatePlacement();
n.Hide();
n.PushActionTurnTo(ACTION_NEWLIST, Rotate);
n.PushActionWait(ACTION_APPEND, 3.5f);
n.PushActionShowHide(ACTION_APPEND, false);
n.PushActionMove(ACTION_APPEND, CmdPos);
if (Game::IsMission())
n.RemoveCommand("VcmdToFireStation");

if (!n.HasCommand(DUMMY_HASSIREN) && n.HasCommand(CMD_AUTOSIREN_OFF) && !Input::LShiftPressed() && !Input::RShiftPressed())
Game::ExecuteCommand(CMD_SIREN, &n, &n);

if (BuyAerialOnly)
Mission::PlayHint(HINT_LADDERBOUGHT);
else if (!BuyAerialOnly)
{
Vehicle m;
Person p3;
Person p4;
Person p5;
Person p6;
m = Game::CreateVehicle(OBJ_ENGINE02, UNNAMED);
m.SetSpeed(9.0f);
p3 = Game::CreatePerson(OBJ_EMT, UNNAMED);
p4 = Game::CreatePerson(OBJ_EMT, UNNAMED);
p5 = Game::CreatePerson(OBJ_EMT, UNNAMED);
p6 = Game::CreatePerson(OBJ_EMT, UNNAMED);
m.SetPlayerMP(Caller->GetPlayerMP());
p3.SetPlayerMP(Caller->GetPlayerMP());
p4.SetPlayerMP(Caller->GetPlayerMP());
p5.SetPlayerMP(Caller->GetPlayerMP());
p6.SetPlayerMP(Caller->GetPlayerMP());
p3.SetUpgradeLevel(3);
p4.SetUpgradeLevel(3);
p5.SetUpgradeLevel(3);
p6.SetUpgradeLevel(3);
m.SetMaxPassengers(6);
m.SetMaxTransports(0);
m.AddPassenger(&p3);
m.AddPassenger(&p4);
m.AddPassenger(&p5);
m.AddPassenger(&p6);
m.SetPosition(Spawn);
m.UpdatePlacement();
m.Hide();
m.PushActionTurnTo(ACTION_NEWLIST, Rotate);
m.PushActionWait(ACTION_APPEND, 1.0f);
m.PushActionShowHide(ACTION_APPEND, false);
m.PushActionMove(ACTION_APPEND, CmdPos);
if (Game::IsMission())
m.RemoveCommand("VcmdToFireStation");

if (!m.HasCommand(DUMMY_HASSIREN) && m.HasCommand(CMD_AUTOSIREN_OFF) && !Input::LShiftPressed() && !Input::RShiftPressed())
Game::ExecuteCommand(CMD_SIREN, &m, &m);

Mission::PlayHint(HINT_LIGHTFORCEBOUGHT);
}
}
};

I cant promise this will work, so keep chances script handy just in case this gives you a script error.

Link to comment
Share on other sites

Guest 1shot1kill

Thanks for your effort but indeed it gave the following error when I called a light force in front of station 2:

(_LABattalionChief7d1e40): Error: Symbol VO_TILLER is not defined in current scope.

Link to comment
Share on other sites

sorry i was researching everything i needed to put tiller in fs1 and ladder in fs2, and to make sure they always went back to same stations. but i wanted to ask is there even a VO_tiller. VO's are created in the edior. not in script files. so the VO's or truck position in stations is VO_LADDER & VO_HAZMAT, right? so maybe you are thinking OBJ_tiller? i didnt read all the script because i dont understand it all, but that stuck out to me.

Link to comment
Share on other sites

EM4 la mod 2.0 i have tiller in as vo_ladder & ladder as vo_hazmat. and i changed differenct script files to compensate. but i didnt bother with the BC calling the units i dont ever use that. but it would seem like you can look at the file for battalion chief calling and look at the ones for obj_engine02 and the vo_engine02 and vo_engine05 they are the same obj_being called from 2 different stations and 2 different vo's

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