Jump to content
The Loot

Adding Battalion Chief Call Commands?

Recommended Posts

Currently using YSB's version of Xplorer's LA submod, and I'm trying to change a few things like the title says.

First, I'm looking to call the Foam Tender at FS2, plus the Brush Truck, I'd also like to add commands for the Swift Water Rescue, Heavy Rescue Crane, and the Heavy Equipment Squad. I'm hoping it's somewhat along the lines of copy-pasting other call lines and changing the vehicle type, but I'm not holding my breath. Any help would be appreciated.

Update 1: For the SWR, I've copied the LRA script, changed every instance of the LRA to SWR, added "const char" values for SWR to the lists at the top of the script.

const char HINT_NOSWR[] = "No Swift Water Rescue squad available!";

const char VO_SWR[] = "fs_swr";

const char OBJ_SWR[] = "mod:Prototypes/Vehicles/02 LA Fire Department/swr_truck.e4p";

object PcmdCallSWR : CommandScript
{
PcmdCallSWR()
{
SetIcon("callusar");
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_BATUSAR, Caller->GetPosition());
else if(StrCompare(Caller->GetPrototypeFileName(), OBJ_EMS_CAPTAIN) == 0)
Audio::PlaySample3D(SND_EMSUSAR, Caller->GetPosition());
//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage1", Caller, 0, false); // ///////////

Vehicle *theCar = NULL;
float bestCar = 0.;
VehicleList patrolCars(VT_FIREFIGHTERS_TLF, VT_FIREFIGHTERS_TLF);
//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage2", Caller, 0, false); // //////
//Mission::PlayHint("Num Vehicles " + patrolCars.GetNumVehicles()); // /////////////
for (int i = 0; i < patrolCars.GetNumVehicles(); i++)
{
Vehicle *aCar = patrolCars.GetVehicle(i);
//Mission::PlayHint(aCar->GetPrototypeFileName()); // /////////////
if (StrCompare(aCar->GetPrototypeFileName(), OBJ_SWR) == 0 && aCar->GetPlayerMP() == Caller->GetPlayerMP() && !aCar->HasCommand(DUMMY_VCALLED) && (aCar->HasCommand(CMD_STANDBY_OFF) || aCar->IsCollidingWithVirtualObject(VO_SWR)))
{
//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage4", Caller, 0, false); // //////
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)
{
//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage5", Caller, 0, false); // //////
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_SWR))
{
//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage6", Caller, 0, false); // //////
GameObjectList ppc;
Game::CollectObstaclesOnVirtualObject(VO_SWR, 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);
PersonList passengers = v.GetPassengers();
if (passengers.GetNumPersons() == 0)
{
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 6, false);
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 6, false);
v.PushActionWait(ACTION_APPEND, 13.0f);
}
//{
//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);
//.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);
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_NOSWR);
return;
}
System::Log("Buy Rescue 7");
int Money = Mission::GetMoneyLeft();
if 1 //(Money <= 600)
{
Mission::PlayHint(HINT_NOSWR);
return;
}
int NewMoney = Money - 600;
Mission::SetMoney(NewMoney);
Vehicle n;
Person p1;
Person p2;
n = Game::CreateVehicle(OBJ_RESCUE7, UNNAMED);
n.SetSpeed(9.0f);
p1 = Game::CreatePerson(OBJ_PM, UNNAMED);
p2 = Game::CreatePerson(OBJ_PM, UNNAMED);
n.SetPlayerMP(Caller->GetPlayerMP());
p1.SetPlayerMP(Caller->GetPlayerMP());
p2.SetPlayerMP(Caller->GetPlayerMP());
p1.SetUpgradeLevel(3);
p2.SetUpgradeLevel(3);
n.SetMaxPassengers(5);
n.SetMaxTransports(2);
n.AddPassenger(&p1);
n.AddPassenger(&p2);
n.SetPosition(Spawn);
n.UpdatePlacement();
n.Hide();
n.PushActionTurnTo(ACTION_NEWLIST, Rotate);
n.PushActionWait(ACTION_APPEND, 2.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);

Mission::PlayHint(HINT_USARBOUGHT);
}
};

Update 2: The command shows up to be added in the editor, but in-game it has the command name is CMDCALLSWR, and though it shows the not availible message at the top of the screen, it's not working in game. Also, it messes up the Paramedic Captain's commands and ends up overlapping his "Get Equipment" icon. That may just be when I added the command in his list, but I had moved it to with the other call commands.

If I can get this one to work correctly, setting up the others shouldn't be hard at all. I'm not sure where things are going wrong, so I'm stuck.

Link to comment
Share on other sites

My first solution is a simple one!

any thing with // remove!

Let the hole script run in the game! First off this // Means to block the code from runing so if somthing that is requiered for the script to run right may be accidently closed off.

Also Errors are not a bad thing! Read them! Generally they will get you extreamly close to the problem. From there solve one problem at a time!

Once you get the script to call the unit then worry about other things like icons!

Link to comment
Share on other sites

An update, finally.

I got the script to finally find the vehicle on the map, and to dispatch the crew from the station, but they don't enter the vehicle, nor does the vehicle move to the spot it's commanded to.

const char CMD_SIREN[] = "VcmdSiren";
const char CMD_AUTOSIREN_OFF[] = "VcmdAutoSirenOff";
const char CMD_WARNINGLIGHTS_OFF[] = "VcmdWarningLightsOff";
const char CMD_WARNINGLIGHTS_ON[] = "VcmdWarningLightsOn";
const char CMD_FLOODLIGHTS_OFF[] = "VcmdFloodLightsOff";
const char CMD_FLOODLIGHTS_ON[] = "VcmdFloodLightsOn";
const char CMD_STANDBY_ON[] = "VcmdStandbyOn";
const char CMD_STANDBY_OFF[] = "VcmdStandbyOff";

const char DUMMY_HASSIREN[] = "DummyHasSiren";
const char DUMMY_PATROL[] = "DummyPatrol";
const char DUMMY_CALLCREW[] = "DummyCallCREW";
const char DUMMY_GATES[] = "DummyGates";
const char DUMMY_ALARM[] = "DummyAlarm";
const char DUMMY_VCALLED[] = "DummyVehicleCalled";
const char DUMMY_CALLVEHICLE[] = "DummyCallVehicle";
const char DUMMY_HOSESON[] = "DummyHosesAreOn";

const char HINT_DISPATCHED[] = "Vehicle dispatched!";

const char HINT_NOSWR[] = "No Swift Water Rescue Squad available!";
const char HINT_SWR_BOUGHT[] = "Water Rescue Truck dispatched from nearby station!";

const char VO_SWR[] = "fs_swr";

const char OBJ_GATE01A[] = "fs_gate01a";
const char OBJ_GATE02A[] = "fs_gate02a";
const char OBJ_GATE03A[] = "fs_gate03a";
const char OBJ_GATE04A[] = "fs_gate04a";
const char OBJ_GATE05A[] = "fs_gate05a";
const char OBJ_GATE06A[] = "fs_gate06a";
const char OBJ_GATE07A[] = "fs_gate07a";
const char OBJ_GATE08A[] = "fs_gate08a";

const char PATH_PATROL01[] = "patrolpath01";
const char PATH_PATROL02[] = "patrolpath02";
const char PATH_PATROL03[] = "patrolpath03";

const char PROTO_SWR[] = "mod:Prototypes/Vehicles/02 LA Fire Department/swr_truck.e4p";
const char PROTO_SWR2[] = "mod:Prototypes/Vehicles/02 LA Fire Department/swr_truck2.e4p";

const char OBJ_PM[] = "mod:Prototypes/Persons/01 LA Ambulance/ff_paramedic.e4p";
const char OBJ_USAR[] = "mod:Prototypes/Persons/02 LA Fire Department/usar_ff.e4p";
const char OBJ_BATTALION_CHIEF[] = "mod:Prototypes/Persons/02 LA Fire Department/battalion_chief.e4p";
const char OBJ_EMS_CAPTAIN[] = "mod:Prototypes/Persons/01 LA Ambulance/ems_paramedic_captain.e4p";

const char SND_BATUSAR[] = "mod:Audio/FX/radio/bat_usar.wav";
const char SND_EMSUSAR[] = "mod:Audio/FX/radio/ems_usar.wav";
const char SND_USAR[] = "mod:Audio/FX/radio/gen_usar.wav";

const char NAME_CONTROLPANEL[] = "fire_station_controlpanel";
const char NAME_CONTROLPANEL2[] = "fire_station_controlpanel2";

const char VO_SQUAD01[] = "fs_squad01";
const char VO_SQUADFS2[] = "fs_squadFS2";
const char VO_SQUAD02[] = "fs_squad02";

const char VO_SPAWN_ALL[] = "spawn_all";
const char VO_SPAWN_ALLR[] = "spawn_allr";
const char VO_SPAWN_AMBU[] = "spawn_ambu";
const char VO_SPAWN_AMBUR[] = "spawn_ambur";
const char VO_SPAWN_FD[] = "spawn_firedept";
const char VO_SPAWN_FDR[] = "spawn_firedeptr";
const char VO_SPAWN_POLICE01[] = "spawn_police1";
const char VO_SPAWN_POLICE01R[] = "spawn_police1r";
const char VO_SPAWN_POLICE02[] = "spawn_police2";
const char VO_SPAWN_POLICE02R[] = "spawn_police2r";
const char UNNAMED[] = "Unnamed";

object PcmdCallSWR : CommandScript
{
PcmdCallSWR()
{
SetIcon("calldiver");
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_BATUSAR, Caller->GetPosition());
else if(StrCompare(Caller->GetPrototypeFileName(), OBJ_EMS_CAPTAIN) == 0)
Audio::PlaySample3D(SND_EMSUSAR, Caller->GetPosition());
else
Audio::PlaySample3D(SND_USAR, Caller->GetPosition());

//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage1", Caller, 0, false); // ///////////

Vehicle *theCar = NULL;
float bestCar = 0.;
VehicleList patrolCars(VT_FIREFIGHTERS_TFMB, VT_FIREFIGHTERS_TFMB);
//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage2", Caller, 0, false); // //////
//Mission::PlayHint("Num Vehicles " + patrolCars.GetNumVehicles()); // /////////////
for (int i = 0; i < patrolCars.GetNumVehicles(); i++)
{
Vehicle *aCar = patrolCars.GetVehicle(i);
//Mission::PlayHint(aCar->GetPrototypeFileName()); // /////////////
if (StrCompare(aCar->GetPrototypeFileName(), PROTO_SWR) == 0 && aCar->GetPlayerMP() == Caller->GetPlayerMP() && !aCar->HasCommand(DUMMY_VCALLED) && (aCar->HasCommand(CMD_STANDBY_OFF) || aCar->IsCollidingWithVirtualObject(VO_SWR)))
{
//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage4", Caller, 0, false); // //////
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)
{
//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage5", Caller, 0, false); // //////
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_SWR))
{
//Caller->PushActionExecuteCommand(ACTION_APPEND, "ShowMessage6", Caller, 0, false); // //////
GameObjectList ppc;
Game::CollectObstaclesOnVirtualObject(VO_SWR, 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);
PersonList passengers = v.GetPassengers();
if (passengers.GetNumPersons() == 0)
{
v.PushActionWait(ACTION_NEWLIST, 5.f);
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 6, false);
v.PushActionWait(ACTION_APPEND, 1.f);
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, false);
v.PushActionWait(ACTION_APPEND, 10.0f);
}
//{
//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);
//.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);
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_NOSWR);
return;
}
System::Log("Buy SWR");
int Money = Mission::GetMoneyLeft();
if (Money <= 1250)
{
Mission::PlayHint(HINT_NOSWR);
return;
}
int NewMoney = Money - 1250;
Mission::SetMoney(NewMoney);
Vehicle n;
Person p1;
Person p2;
n = Game::CreateVehicle(PROTO_SWR2, UNNAMED);
n.SetSpeed(11.0f);
p1 = Game::CreatePerson(OBJ_PM, UNNAMED);
p2 = Game::CreatePerson(OBJ_USAR, UNNAMED);
p1.SetEquipment(EQUIP_EMERGENCY_CASE);
n.SetPlayerMP(Caller->GetPlayerMP());
p1.SetPlayerMP(Caller->GetPlayerMP());
p2.SetPlayerMP(Caller->GetPlayerMP());
p1.SetUpgradeLevel(3);
p2.SetUpgradeLevel(3);
n.SetMaxPassengers(4);
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, 35.0f);
n.PushActionShowHide(ACTION_APPEND, false);
n.PushActionmove(ACTION_APPEND, CmdPos);
n.RemoveCommand("VcmdToFireStation");

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

Mission::PlayHint(HINT_SWR_BOUGHT);
}
};

object DummyVehicleCalled : CommandScript
{
DummyVehicleCalled()
{
SetGroupID(20);
}

bool CheckTarget(GameObject *Caller, Actor *Target, int childID)
{
}

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
Vehicle v(Caller);
if (v.HasCommand(DUMMY_VCALLED))
v.RemoveCommand(DUMMY_VCALLED);
}
};

Out of the frying pan, and right into the next one. I almost shouted for joy when it said "Vehicle Dispatched" and the crew came out, but that joy didn't last long. If I could finally get it to work correctly, I could do the same for all the other vehicles I want to modify... *sigh*

Link to comment
Share on other sites

Well, some good news. I managed to successfully make call commands for the Equipment Squad (I replaced it with the LEV), the Water Tender, and the Brush Truck. The SWR Truck still has some unsolved errors that break the command, and the Crane is now at the same spot the SWR used to be (doesn't find the vehicle on map). I'll take the small victory!

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