Jump to content
eyespy900

help with a script

Recommended Posts

some time ago i had permission to use the lawye script from hoopah.

i had encountered several problems with it, one was that the fireman would disappear once the wye was placed and would not reappear, i have not solved that.

the probelm i now have is that once the fire is out i start to pack all hoses away, when it comes to picing up the way, i get to change in icon and cannot pick it up, if i tell the unit to auto park at station the hose walks on its own and then when it gets to fire engine the whole game crashes.

if someone who knows scripts cna help that would be great

here is what i have so far

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

**********

// #Version 1.0#

//

// Includes: Includes command to install a gated wye

//

// - PcmdWye

//

// Script by Hoppah

//

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

//

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

**********

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

const char NAME_WYE[] = "wye";

const char OBJ_EMT[] = "mod:Prototypes/Persons/Fire Department/firefighternorm_upgraded2.e4p";

const char OBJ_EMT_SCBA[] = "mod:Prototypes/Persons/Fire Department/firefightermask_upgraded2.e4p";

const char OBJ_PM[] = "mod:Prototypes/Persons/01 LA Ambulance/ff_paramedic.e4p";

const char OBJ_PM_SCBA[] = "mod:Prototypes/Persons/01 LA Ambulance/ff_paramedic_scba.e4p";

const char OBJ_USFS_FF[] = "mod:Prototypes/Persons/Fire Department/firefighternorm_upgraded2.e4p";

const char OBJ_USFS_FF_SCBA[] = "mod:Prototypes/Persons/Fire Department/firefightermask_upgraded2.e4p";

const char OBJ_USAR_FF[] = "mod:Prototypes/Persons/Fire Department/firefighternorm_upgraded2.e4p";

const char CMD_WYE[] = "PcmdWye";

object PcmdWye : CommandScript

{

PcmdWye()

{

SetIcon("wye");

SetCursor("wye");

SetRestrictions(RESTRICT_SELFEXECUTE);

//SetRestrictions2(RESTRICT2_ISHYDRANTORSELF);

}

bool CheckPossible(GameObject *Caller)

{

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

return false;

GameObject o = Caller->GetHydrant();

if (o.HasName(NAME_WYE))

return false;

return Caller->GetFirehoseID() != 0;

}

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

{

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

return false;

if (Caller->GetEquipment()==EQUIP_FIREHOSE && Caller->GetType() == ACTOR_PERSON && Caller->GetFirehoseID() != 0)

{

if (Caller->GetID()==Target->GetID())

return true;

}

return false;

}

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

{

Person p(Caller);

if (childID == 0)

{

p.PushActionSwitchAnim(ACTION_NEWLIST, "kneeldown");

p.PushActionWait(ACTION_APPEND, 2.5f);

p.PushActionExecuteCommand(ACTION_APPEND, CMD_WYE, Target, 1, false);

p.SetCommandable(false);

Vector Pos = p.GetPosition();

float r[9];

float childr[9];

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

Vehicle m = Game::CreateVehicle(OBJ_WYE, NAME_WYE);

float dx = 15.f, dy = -24.f, dz = 14.f;

Math::RotateVector(dx, dy, dz, r);

Math::EulerToMatrix(20.0f, 0.f, 0.f, childr);

Math::MultiplyMatrices(childr, r);

Pos = Pos + Vector(dx, dy, dz);

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

m.SetPosition(Pos);

m.UpdatePlacement();

m.SetPlayerMP(p.GetPlayerMP());

m.SetUserData(p.GetID());

m.PushActionWait(ACTION_NEWLIST, 2.5f);

m.PushActionShowHide(ACTION_APPEND, false);

m.SetSelectable(false);

Vector PerPos = p.GetPosition();

if(StrCompare(p.GetPrototypeFileName(), OBJ_EMT) == 0)

Person n = Game::CreatePerson(OBJ_EMT, Caller->GetName());

else if(StrCompare(p.GetPrototypeFileName(), OBJ_EMT_SCBA) == 0)

Person n = Game::CreatePerson(OBJ_EMT_SCBA, Caller->GetName());

else if(StrCompare(p.GetPrototypeFileName(), OBJ_PM) == 0)

{

Person n = Game::CreatePerson(OBJ_PM, Caller->GetName());

n.RemoveCommand("Heal");

n.RemoveCommand("RemoveEquipment");

n.AssignCommand("PcmdHeal");

}

else if(StrCompare(p.GetPrototypeFileName(), OBJ_PM_SCBA) == 0)

Person n = Game::CreatePerson(OBJ_PM_SCBA, Caller->GetName());

else if(StrCompare(p.GetPrototypeFileName(), OBJ_USFS_FF) == 0)

Person n = Game::CreatePerson(OBJ_USFS_FF, Caller->GetName());

else if(StrCompare(p.GetPrototypeFileName(), OBJ_USFS_FF_SCBA) == 0)

Person n = Game::CreatePerson(OBJ_USFS_FF_SCBA, Caller->GetName());

else if(StrCompare(p.GetPrototypeFileName(), OBJ_USAR_FF) == 0)

Person n = Game::CreatePerson(OBJ_USAR_FF, Caller->GetName());

else

return;

if (n.IsValid()) && Game::FindFreePosition(&n, PerPos))

{

float dx = -30.f, dy = -20.f, dz = 0.f;

Math::RotateVector(dx, dy, dz, r);

Math::EulerToMatrix(0.0f, 0.f, 0.f, childr);

Math::MultiplyMatrices(childr, r);

PerPos = PerPos + Vector(dx, dy, dz);

n.SetPosition(PerPos);

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

n.Hide();

n.PushActionWait(ACTION_APPEND, 2.5f);

n.PushActionShowHide(ACTION_APPEND, false);

n.SetPlayerMP(p.GetPlayerMP());

n.SetHealth(p.GetHealth());

n.SetUpgradeLevel(3);

}

}

if (childID == 1)

{

p.SetUserData(p.GetID());

p.EnableAutoTarget(false);

if (p.IsSelected())

p.Deselect();

if (!p.IsFlagSet(OF_HIDDEN))

p.SetFlag(OF_HIDDEN);

p.SetCommandable(true);

p.SetResistance(INJUREREASON_UNKNOWN, 100000.0f);

//p.SetResistance(INJUREREASON_FIRE, 10000000.0f);

//p.SetResistance(INJUREREASON_SHOT, 10000000.0f);

//p.SetResistance(INJUREREASON_ENERGY, 10000000.0f);

p.SetResistance(INJUREREASON_CONTAM_ATOM, 100000.0f);

p.SetResistance(INJUREREASON_CONTAM_CHEM, 100000.0f);

p.SetResistance(INJUREREASON_CONTAM_BIO, 100000.0f);

}

if (childID == 2)

{

Vehicle v(Target);

if(!v.IsInstalled())

{

int VID = v.GetUserData();

PersonList list = Game::GetFirefighters();

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

{

if (list.GetPerson(i)->GetUserData() == VID)

{

Person *n = list.GetPerson(i);

n->ClearFlag(OF_HIDDEN);

n->PushActionSwitchAnim(ACTION_NEWLIST, "idle");

if (p.IsSelected())

n->Select();

n->EnableAutoTarget(true);

n->SetResistance(INJUREREASON_UNKNOWN, 0.0f);

n->SetResistance(INJUREREASON_CONTAM_ATOM, 0.0f);

n->SetResistance(INJUREREASON_CONTAM_CHEM, 0.0f);

n->SetResistance(INJUREREASON_CONTAM_BIO, 0.0f);

v.PushActionDeleteOwner(ACTION_NEWLIST);

p.PushActionDeleteOwner(ACTION_NEWLIST);

} else

{

v.PushActionDeleteOwner(ACTION_NEWLIST);

}

} else

{

v.PushActionDeleteOwner(ACTION_NEWLIST);

}

} else

return;

}

}

};

Link to comment
Share on other sites

some time ago i had permission to use the lawye script from hoopah.

i had encountered several problems with it, one was that the fireman would disappear once the wye was placed and would not reappear, i have not solved that.

the probelm i now have is that once the fire is out i start to pack all hoses away, when it comes to picing up the way, i get to change in icon and cannot pick it up, if i tell the unit to auto park at station the hose walks on its own and then when it gets to fire engine the whole game crashes.

if someone who knows scripts cna help that would be great

here is what i have so far

Are you using the LA MOD v1.8 gated wye script? In version 1.8 I never have problems with the fire fighter disappearing. The FF can only pick up the gated wye if he isn't carying anything else, so he has to drop the hose he's holding and then pick up the wye. I never had problems with the game crashing or something using this method.

Edited by pyrothijs
Link to comment
Share on other sites

Are you using the LA MOD v1.8 gated wye script? In version 1.8 I never have problems with the fire fighter disappearing. The FF can only pick up the gated wye if he isn't carying anything else, so he has to drop the hose he's holding and then pick up the wye. I never had problems with the game crashing or something using this method.

greetz,

hi the problem with the fireman disappearing was becuase the script was still getting the la fireman not my own fireman, have since fixed that, but the problem i now have is that the fireman that places the wye cannot pick it back up again, and he is empty handed but the mouse pointer dont change to let him pick it up again, as it does in the la mod.

another thing i want to do is be able to place another wye gate valve and the end of the 1st one, making the overall length of the hose even longer (triple the original standard hose length.

hope this explains things a bit better

***eyespy900***

Link to comment
Share on other sites

...but the problem i now have is that the fireman that places the wye cannot pick it back up again, and he is empty handed but the mouse pointer dont change to let him pick it up again, as it does in the la mod....

***eyespy900***

I have a very similar problem with the original LA Mod v1.8. I drop the hose i just had attached to the wye, and command the fire fighter to pick up the wye, he does, but the hose is not in his hand. there is a nozzle on the ground, and he's empty handed. There's no way to pick up the nozzle, and the Engine can't drive anywhere, because technically, there's a still line attached to the rig, therefore, my truck can not move, and is blocking the road. Pisses me right off.

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