Jump to content
timmiej93

Adding hose conn. to a truck like the HES.

Recommended Posts

Its pretty easy imo. On the script side you need to edit:

attachfirehose.script - I think its self explanatory. This will enable your truck to have hose connections.

LARapidDeployment.script - You dont have to edit this one, but I imagine you want rapid deploy to work so edit this.

In the editor, I cant recall exactly how its done, but something along these lines. Edit the children for the object and add the hose connector. This is a bit tricky to line it up right. Then you have to apply a name to the children(hose connectors). Just look at any of the engines on how to do this.

May not be to detailed but i think you can get the concept on your own based on what I said. ;)

Link to comment
Share on other sites

Use the edit button. ;)

I wasnt in the editor but i am now so I checked. Click on any of the ALS Engine. Click Edit Children, then go to Edit Childs(its next to cancel and okay buttons). The connectors are in there. The USFS truck is set p a slight bit different, so I would stick with the ALS Engine set up to be safe when doing your new unit.

Link to comment
Share on other sites

ok, i managed to get the hose conn's on and they stay in position as long as i dont hit the rapid deploy button. didn't try just connecting i remember now.

But when i do hit the rapid deploy button, this happens:

post-6840-0-61939900-1290095903.jpg

I know this is a script error, but i just dont know where.

this is the attachthose script.

//******************************************************************************************

// #Version 1.2#

//

// Changes: - Modified to combine hose connections with water cannon.

// - Watercannon will be disabled.

//

//******************************************************************************************

const char DUMMY_EQUIPMENT[] = "DummyEquipmentCommands";

const char DUMMY_HOSESON[] = "DummyHosesAreOn";

const char VO_SQUAD[] = "fire_station_squad";

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

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

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

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

const char OBJ_ENGINE_CONN[] = "mod:Prototypes/Vehicles/06 Objects/fire_engine_hose_connections.e4p";

const char OBJ_HES_CONN[] = "mod:Prototypes/Vehicles/06 Objects/fire_engine_hose_connections.e4p";

const char OBJ_WATERTENDER_CONN[] = "mod:Prototypes/Vehicles/06 Objects/water_tender_hose_connections.e4p";

const char NAME_CONNECTORS[] = "PumpConnector";

const char HINT_NOTVALID[] = "This vehicle doesn't support hose connections!";

const char CMD_AUTOSIREN_OFF[] = "VcmdAutoSirenOff";

const char CMD_STANDBY_ON[] = "VcmdStandbyOn";

const char CMD_STANDBY_OFF[] = "VcmdStandbyOff";

const char CMD_WATER_OFF[] = "VcmdWaterOff";

const char DUMMY_DISABLE[] = "DummyDisableSiren";

const char DUMMY_HASSIREN[] = "DummyHasSiren";

int DummyGroup = 29;

object AttachFireHose : CommandScript

{

AttachFireHose()

{

SetValidTargets(ACTOR_OBJECT | ACTOR_VEHICLE);

SetGroupID(CGROUP_FIREHOSE);

SetGroupLeader(true);

SetPossibleCallers(ACTOR_PERSON);

SetPossibleEquipment(EQUIP_FIREHOSE);

SetPriority(220);

}

//bool CheckPossible(GameObject *Caller)

//{

// if(!Caller->IsValid() || Caller->GetType() != ACTOR_PERSON)

// return false;

//if(Target->GetType() == ACTOR_OBJECT)

//{

// SetPossibleExists(CPE_FREE_HOSE_CONNECTION);

// SetNeedsConnectedHose(CFN_FAIL);

// SetRestrictions2(RESTRICT2_ISHYDRANT);

//}

//if(Target->GetType() == ACTOR_VEHICLE)

//{

//}

//return true;

// return Caller->GetFirehoseID() == 0 && Caller->GetEquipment()==EQUIP_FIREHOSE && Game::ExistsFreeHoseConnection();

//}

bool CheckGroupVisibility(GameObject *Caller)

{

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

return false;

return Caller->GetFirehoseID() == 0;

}

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

{

if(!Caller->IsValid() || !Target->IsValid() || (Caller->GetID()==Target->GetID()))

return false;

if(Caller->GetFirehoseID())

return false;

if(Caller->GetType()!=ACTOR_PERSON)

return false;

Person p(Caller);

if (p.GetEnteredCarID() != -1)

return false;

if(Caller->GetEquipment()==EQUIP_FIREHOSE && Target->GetType() == ACTOR_VEHICLE)

{

Vehicle v(Target);

if((StrCompare(v.GetPrototypeFileName(), PROTO_HES) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE01) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE02) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_WATERTENDER) == 0 || v.GetVehicleType() == VT_FIREFIGHTERS_GTF) && v.GetEnergy() > 0.1f * v.GetMaxEnergy())

return true;

if((StrCompare(v.GetPrototypeFileName(), PROTO_HES) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE01) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE02) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_WATERTENDER) == 0) && v.HasCommand(DUMMY_HOSESON))

{

int UnitID = v.GetID();

VehicleList list(NAME_CONNECTORS);

for(int i = 0; i < list.GetNumVehicles(); i++)

{

Vehicle *obj = list.GetVehicle(i);

if (obj->GetUserData() == UnitID)

{

if (!obj->IsConnectorFree())

{

return false;

}

}

}

}

}

else if(Caller->GetEquipment()==EQUIP_FIREHOSE && Target->GetType() == ACTOR_OBJECT)

{

GameObject obj(Target);

if(obj.IsHydrant() && !obj.IsHydrantInUse())

return true;

return false;

}

return false;

}

void PushActions(GameObject *Caller, Actor *Target, int childID)

{

Person p(Caller);

Vehicle v(Target);

if (v.HasCommand(DUMMY_HASSIREN) && v.HasCommand(CMD_AUTOSIREN_OFF))

Game::ExecuteCommand(DUMMY_DISABLE, &v, &v);

if (childID == 0) //Initiate command

{

if (Target->GetType() == ACTOR_OBJECT)

{

p.PushActionmove(ACTION_NEWLIST, Target, TARGET_FREE_CONNECTOR);

p.PushActionUseEquipment(ACTION_APPEND, Target, childID, 1.0f);

}

else if (v.GetVehicleType() == VT_FIREFIGHTERS_GTF && (v.HasCommand("EmptyCar") || v.HasName("wye")))

{

p.PushActionmove(ACTION_NEWLIST, Target, TARGET_FREE_CONNECTOR);

p.PushActionCheckFreeConnector(ACTION_APPEND, Target);

p.PushActionUseEquipment(ACTION_APPEND, Target, childID, 1.0f);

}

else if (v.GetVehicleType() != VT_FIREFIGHTERS_GTF && !v.HasCommand(DUMMY_HOSESON))

{

Vector TargetPos = v.GetChildPosition("pump1");

v.PushActionWait(ACTION_NEWLIST, 0.1f);

p.PushActionmove(ACTION_NEWLIST, TargetPos);

p.PushActionExecuteCommand(ACTION_APPEND, "AttachFireHose", Target, 1, false);

}

else if (v.GetVehicleType() != VT_FIREFIGHTERS_GTF && v.HasCommand(DUMMY_HOSESON))

{

p.PushActionExecuteCommand(ACTION_NEWLIST, "AttachFireHose", Target, 2, false);

}

}

if (childID == 1) //Install hose connections

{

if (!v.HasCommand(DUMMY_HOSESON))

{

v.PushActionWait(ACTION_NEWLIST, 0.1f);

Vector CarPos = v.GetPosition();

float r[9];

v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);

if (StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE01) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE02) == 0)

Vehicle o = Game::CreateVehicle(OBJ_ENGINE_CONN, NAME_CONNECTORS);

else if (StrCompare(v.GetPrototypeFileName(), PROTO_WATERTENDER) == 0)

Vehicle o = Game::CreateVehicle(OBJ_WATERTENDER_CONN, NAME_CONNECTORS);

else if (StrCompare(v.GetPrototypeFileName(), PROTO_HES) == 0)

Vehicle o = Game::CreateVehicle(OBJ_HES_CONN, NAME_CONNECTORS);

else

{

Mission::PlayHint(HINT_NOTVALID);

return;

}

if (o.IsValid())

{

o.SetPosition(CarPos);

o.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]);

o.UpdatePlacement();

o.SetSelectable(false);

o.SetUserData(v.GetID());

v.SetUserData(v.GetID());

o.SetPlayerMP(v.GetPlayerMP());

o.AssignCommand(DUMMY_HOSESON);

v.AssignCommand(DUMMY_HOSESON);

v.SetChildEnabled("pump1", false);

v.SetChildEnabled("pump2", false);

v.SetChildEnabled("pump3", false);

v.SetChildEnabled("pump4", false);

if (v.HasCommand(CMD_STANDBY_OFF))

{

v.RemoveCommand(CMD_STANDBY_OFF);

v.AssignCommand(CMD_STANDBY_ON);

}

p.PushActionmove(ACTION_NEWLIST, &o, TARGET_FREE_CONNECTOR);

//p.PushActionCheckFreeConnector(ACTION_APPEND, &o);

p.PushActionUseEquipment(ACTION_APPEND, &o, childID, 1.0f);

//if (v.HasCommand("Extinguish") && v.HasCommand("Cool") && v.HasCommand(CMD_WATER_OFF))

// v.PushActionExecuteCommand(ACTION_APPEND, CMD_WATER_OFF, Caller, 0, false);

}

} else

p.PushActionExecuteCommand(ACTION_NEWLIST, "AttachFireHose", Target, 2, false);

}

if (childID == 2) //Attach hose to installed hose conncetions

{

v.PushActionWait(ACTION_NEWLIST, 0.1f);

int UnitID = Target->GetID();

VehicleList list(NAME_CONNECTORS);

for(int i = 0; i < list.GetNumVehicles(); i++)

{

if (list.GetVehicle(i)->GetUserData() == UnitID)

{

Vehicle c = list.GetVehicle(i);

p.PushActionmove(ACTION_NEWLIST, &c, TARGET_FREE_CONNECTOR);

//p.PushActionCheckFreeConnector(ACTION_APPEND, &c);

p.PushActionUseEquipment(ACTION_APPEND, &c, childID, 1.0f);

}

}

}

if (childID == 3) //A check if the hose connections are being used.

{

if(!v.IsInstalled())

{

int UnitID = v.GetUserData();

VehicleList list(VT_FIREFIGHTERS_RW, VT_FIREFIGHTERS_TLF);

for(int i = 0; i < list.GetNumVehicles(); i++)

{

if (list.GetVehicle(i)->GetUserData() == UnitID)

{

list.GetVehicle(i)->RemoveCommand(DUMMY_HOSESON);

list.GetVehicle(i)->SetChildEnabled("pump1", true);

list.GetVehicle(i)->SetChildEnabled("pump2", true);

list.GetVehicle(i)->SetChildEnabled("pump3", true);

list.GetVehicle(i)->SetChildEnabled("pump4", true);

}

}

v.PushActionWait(ACTION_NEWLIST, 0.1f);

v.PushActionDeleteOwner(ACTION_APPEND);

} else

return;

}

}

};

object DummyHosesAreOn : CommandScript

{

DummyHosesAreOn()

{

SetGroupID(DummyGroup);

}

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

{

return false;

}

void PushActions(GameObject *Caller, Actor *Target, int childID)

{

}

};

Pastebin for those who like that better.

LaRapidDeployment.script

//******************************************************************************************

// #Version 1.3#

//

// Includes: All command to attach hoses to vehicle automaticly.

//

// - VcmdRapidDeployment

//

// Script by Hoppah

//

// Usage of this script in other mods is NOT allowed without permission of Hoppah

//

//******************************************************************************************

const char DUMMY_EQUIPMENT[] = "DummyEquipmentCommands";

const char DUMMY_HOSESON[] = "DummyHosesAreOn";

const char VO_SQUAD01[] = "fs_squad01";

const char VO_SQUAD02[] = "fs_squad02";

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

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

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

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

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

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

const char NAME_CONNECTORS[] = "PumpConnector";

int DummyGroup = 29;

object VcmdRapidDeployment : CommandScript

{

int MAXCONNECTORS;

VcmdRapidDeployment()

{

SetIcon("rapiddeployment");

SetCursor("rapiddeployment");

SetGroupID(DummyGroup);

SetGroupLeader(true);

SetRestrictions(RESTRICT_SELFEXECUTE);

SetPriority(90);

}

bool CheckPossible(GameObject *Caller)

{

if (!Caller->IsValid())

return false;

if (Caller->GetType()==ACTOR_VEHICLE)

{

Vehicle v(Caller);

if(v.IsCollidingWithVirtualObject(VO_SQUAD01) || v.IsCollidingWithVirtualObject(VO_SQUAD02))

return false;

if(v.GetVehicleType() == VT_FIREFIGHTERS_GTF && v.GetNumPassengers() == 0 && !v.IsInstalled())

return false;

if(v.GetVehicleType() != VT_FIREFIGHTERS_GTF && v.GetNumPassengers() == 0 && !v.HasCommand(DUMMY_HOSESON))

return false;

}

return true;

}

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

{

if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID()))

return false;

if (Caller->GetType()==ACTOR_VEHICLE)

{

Vehicle v(Caller);

if(StrCompare(v.GetPrototypeFileName(), PROTO_HES) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE01) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_ENGINE02) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_WATERTENDER) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_USFS_ENGINE) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_BRUSH) == 0)

return true;

}

return false;

}

void PushActions(GameObject *Caller, Actor *Target, int childID)

{

Vehicle v(Caller);

v.PushActionWait(ACTION_NEWLIST, 0.1f);

if (v.GetVehicleType() != VT_FIREFIGHTERS_GTF && !v.HasCommand(DUMMY_HOSESON))

{

int Pcnt = 0;

PersonList passengers = v.GetPassengers();

if (passengers.GetNumPersons() > 0)

{

for(int i=0; i<passengers.GetNumPersons(); i++)

{

if (Pcnt < 4)

{

Person *p = passengers.GetPerson(i);

if (p->HasCommand("Extinguish"))

{

TargetPoint targetPoint;

targetPoint = TARGET_EQUIPMENTDOOR;

p->PushActionLeaveCar(ACTION_NEWLIST, &v);

if(p->GetEquipment() != EQUIP_FIREHOSE)

{

p->PushActionmove(ACTION_APPEND, &v, targetPoint);

p->PushActionTurnTo(ACTION_APPEND, &v);

p->PushActionGetEquipment(ACTION_APPEND, &v, EQUIP_FIREHOSE);

p->PushActionExecuteCommand(ACTION_APPEND, DUMMY_EQUIPMENT, Caller, 3, false);

}

if (!v.HasCommand(DUMMY_HOSESON))

{

Vector TargetPos = v.GetChildPosition("pump1");

p->PushActionmove(ACTION_APPEND, TargetPos);

p->PushActionExecuteCommand(ACTION_APPEND, "AttachFireHose", Caller, 1, false);

} else

p->PushActionExecuteCommand(ACTION_APPEND, "AttachFireHose", Caller, 2, false);

//p->PushActionmove(ACTION_NEWLIST, &obj, TARGET_FREE_CONNECTOR);

//p->PushActionCheckFreeConnector(ACTION_APPEND, &obj);

//p->PushActionUseEquipment(ACTION_APPEND, &obj, childID, 1.0f);

Pcnt++;

}

}

}

}

}

else if (v.GetVehicleType() != VT_FIREFIGHTERS_GTF && v.HasCommand(DUMMY_HOSESON))

{

//v.PushActionWait(ACTION_NEWLIST, 0.1f);

int UnitID = v.GetID();

VehicleList list(NAME_CONNECTORS);

for(int i = 0; i < list.GetNumVehicles(); i++)

{

Vehicle *obj = list.GetVehicle(i);

if (obj->GetUserData() == UnitID)

{

if (obj->IsInstalled())

{

PersonList Pconnected(ROLE_SQUAD);

for(int i = 0; i < Pconnected.GetNumPersons(); i++)

{

if (Pconnected.GetPerson(i)->GetEquipment() == EQUIP_FIREHOSE && Pconnected.GetPerson(i)->GetType() == ACTOR_PERSON && Pconnected.GetPerson(i)->GetFirehoseID() != 0 && !Pconnected.GetPerson(i)->IsFlagSet(OF_HIDDEN) && !Pconnected.GetPerson(i)->IsCurrentAnimation("kneeldown"))

{

Vector TargetPos;

GameObject Phydrant = Pconnected.GetPerson(i)->GetHydrant();

if (Phydrant.GetID() == obj->GetID())

{

Person p(Pconnected.GetPerson(i));

if (!obj->GetUsedConnectorPosition(&p, TargetPos))

{

return;

} else

{

Pconnected.GetPerson(i)->PushActionmoveWithHose(ACTION_NEWLIST, TargetPos);

Pconnected.GetPerson(i)->PushActionUseEquipment(ACTION_APPEND, &Phydrant, childID, 10.0f);

Pconnected.GetPerson(i)->PushActionExecuteCommand(ACTION_APPEND, "AttachFireHose", &Phydrant, 3, false);

Pconnected.GetPerson(i)->PushActionExecuteCommand(ACTION_APPEND, "EnterCar", &v, childID, false);

}

}

}

}

} else

{

v.RemoveCommand(DUMMY_HOSESON);

v.SetChildEnabled("pump1", true);

v.SetChildEnabled("pump2", true);

v.SetChildEnabled("pump3", true);

v.SetChildEnabled("pump4", true);

obj->PushActionDeleteOwner(ACTION_APPEND);

}

}

}

}

else if (v.GetVehicleType() == VT_FIREFIGHTERS_GTF && !v.IsInstalled())

{

int Pcnt = 0;

PersonList passengers = v.GetPassengers();

if (passengers.GetNumPersons() > 0)

{

for(int i=0; i<passengers.GetNumPersons(); i++)

{

if (StrCompare(v.GetPrototypeFileName(), PROTO_BRUSH) == 0)

MAXCONNECTORS = 1;

else

MAXCONNECTORS = 4;

if (Pcnt < MAXCONNECTORS)

{

Person *p = passengers.GetPerson(i);

TargetPoint targetPoint;

targetPoint = TARGET_EQUIPMENTDOOR;

p->PushActionLeaveCar(ACTION_NEWLIST, &v);

if(p->GetEquipment() != EQUIP_FIREHOSE)

{

p->PushActionmove(ACTION_APPEND, &v, targetPoint);

p->PushActionTurnTo(ACTION_APPEND, &v);

p->PushActionGetEquipment(ACTION_APPEND, &v, EQUIP_FIREHOSE);

p->PushActionExecuteCommand(ACTION_APPEND, DUMMY_EQUIPMENT, Caller, 3, false);

}

p->PushActionmove(ACTION_NEWLIST, &v, TARGET_FREE_CONNECTOR);

p->PushActionCheckFreeConnector(ACTION_APPEND, &v);

p->PushActionUseEquipment(ACTION_APPEND, &v, childID, 1.0f);

Pcnt++;

}

}

}

}

else if (v.GetVehicleType() == VT_FIREFIGHTERS_GTF && v.IsInstalled())

{

PersonList Pconnected(ROLE_SQUAD);

for(int i = 0; i < Pconnected.GetNumPersons(); i++)

{

if (Pconnected.GetPerson(i)->GetEquipment() == EQUIP_FIREHOSE && Pconnected.GetPerson(i)->GetType() == ACTOR_PERSON && Pconnected.GetPerson(i)->GetFirehoseID() != 0 && !Pconnected.GetPerson(i)->IsFlagSet(OF_HIDDEN))

{

Vector TargetPos;

GameObject Phydrant = Pconnected.GetPerson(i)->GetHydrant();

if (Phydrant.GetID() == v.GetID())

{

Person p(Pconnected.GetPerson(i));

if (!v.GetUsedConnectorPosition(&p, TargetPos))

{

return;

} else

{

Pconnected.GetPerson(i)->PushActionmoveWithHose(ACTION_NEWLIST, TargetPos);

Pconnected.GetPerson(i)->PushActionUseEquipment(ACTION_APPEND, &Phydrant, childID, 10.0f);

Pconnected.GetPerson(i)->PushActionExecuteCommand(ACTION_APPEND, "EnterCar", &v, childID, false);

}

}

}

}

}

}

};

Again PasteBin for those people.

Link to comment
Share on other sites

This is purely a guess, so dont be to surprised if it does not work.

On the USFS Truck the hose connections have a different name then on the engines, and it has 2 connections in the rear and 2 on the side. My guess is the script says if the connectors are labeled(just examples) connection1,connection2, etc, the connectors have to be right next to each other on the sides of the truck. However if there named hconnection1,hconnection2,etc, then connect two on the sides and two in the rear. You can try naming the connectors hconnection1,hconnection2, and this may work. If the USFS Truck connectors on the rear are labeled 3 and 4, then you can try using the same names for the 2 rear connections, but assuming the rear connects on the USFS are 3 and 4, you may get an error if 1 and 2 arent available.

Another option may be to look at the brush truck and see how its done.

Again just guess work.

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