Jump to content
Quincy

[Released]Call Coroner Script and Call Tow Truck Script

Recommended Posts

Here are the first two scripts I have created, CallTow and CallCoroner. They currently call from off the map and WILL NOT dispatch a unit from the map. Like if you have a coroners van already parked on the map and you hit the dispatch command it wont dispatch that unit, it will call a new one off the map.

Download Link is below video!!

Credits: Hoppah for the scripts for which i made these from and Myself (Quincy) for doing the edits.

Instructions:

  1. Add .script files to Scripts\Game\Command directory
  2. Open Editor
  3. Add Commands to the units you want.

WARNING: DO TO A TECHNICAL LIMITATION ONLY 11 EQUIPMENT COMMANDS CAN BE ASSIGNED TO A SINGLE UNIT. THIS IS NOT SCRIPT RELATED IT IS A HARDCODED GAME LIMITATION.

Try my new Command Post Script!! http://forum.emergen...d-post-scripts/

Fixed the Coroner Van issue.

Command_scripts.zip

Link to comment
Share on other sites

The command post thing is going to be the last thing I make, and yes in the video I'm using ysb's 4x4 sub mod edit in the video but the script can run on any version of the LA Mod as long as the directory for the prototype for the van hasn't been changed. As of right now the script is set to always call a unit from off the map, I'm working on making it so if you have a van or truck on the map in standby it will call that unit instead of dispatching the unit from of the map. I just got permission from Hoppah to release the scripts I have made, I'll edit the topic and release the scripts when I get home.

Link to comment
Share on other sites

Anything command that has the "SetGroupID(CGROUP_GETEQUIPMENT);" in it. Meaning it gets put in the secondary "Get Equipment Category.

Ah, where is that set? I'd like to stick the Get Stretcher and Get EMT Bag into the main command group; I remember the SG submod had both of those like that. I wonder if the limit for that is just space on the UI, or if it has a number limit.

I tried to modify a script to call the SWR truck on YSBs map, but I never could get it to actually call the vehicle. If you plan to try to whip up scripts to call the other vehicles on the map, that'd be awesome. At least a script to call the Chief and Captain vehicles. Oh, could you take a look at the Hazmat script? It won't buy a vehicle from off map, even after re-enabled it.

Link to comment
Share on other sites

Just open up the command script and its the first loop

like the second to last line in this snippet, remove

SetGroupID(CGROUP_GETEQUIPMENT);

and it will make it appear in the main section of commands.


PostCallAmbulance1()
{
SetIcon("callambulance1");
SetCursor("callassistance");
SetValidTargets(ACTOR_FLOOR | ACTOR_VIRTUAL);
SetDeselectCaller(false);
SetSelfClickActivation(true);
SetHighlightingEnabled(false);
SetGroupID(CGROUP_GETEQUIPMENT);
SetGroupLeader(true);
}

I'm currently making the command post script but after that I will make the SWR and Chief ones for you. And I will look at the hazmat script for you and see what's wrong with it (i have an idea of what the issue probably is). Also good news I am about 80% done with the command post script. And do you still need help with the medical bag and police barricade thing you mention in your signature?

Link to comment
Share on other sites

Ah, there's the SetGroupID.

The Command Post sounds interesting. I'd ask for some details, but I think it'll be worth waiting for a video of it in action.

As for the medical bag and barricade issue, I was told it is script controlled and nothing the editor controls, but as to how to change things, not sure.

Link to comment
Share on other sites

Yeah, that's what it seemed like, I just wasn't sure how to find what the exact names were for each vehicle. I assume it's the same for changing into a diver and back.

Now that I'm thinking of it, I wanted to do the same with the ALS/BLS engines (and also the Light Forces) that I did with the Ambulances, e.g. that it would find the nearest engine, no matter the type, and just change crew depending on the script used. It looked a bit daunting since there wasn't a base script that called all engines like the police EMS call.

Edit: So, commenting out the "SetGroupID(CGROUP_GETEQUIPMENT);" line with "//" sends the commands to the first list of them, and it opens up more space in the normal equipment commands. I've got 13 commands in total for the EMS Captain now, with no glitch for the command list.

Edit2: Still can't get my Water Rescue Truck script to work completely, but at least it calls a unit from off map. Don't know why it won't find the vehicle on the map. I've added on the correct "const char" entries and made sure to change them over.

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

Vehicle *theCar = NULL;
float bestCar = 0.;
VehicleList patrolCars(VT_FIREFIGHTERS_RW, VT_FIREFIGHTERS_RW);
for (int i = 0; i < patrolCars.GetNumVehicles(); i++)
{
Vehicle *aCar = patrolCars.GetVehicle(i);
if (StrCompare(aCar->GetPrototypeFileName(), OBJ_SWR) == 0 && aCar->GetPlayerMP() == Caller->GetPlayerMP() || aCar->IsCollidingWithVirtualObject(VO_SWR)))
// Before CollidingWith - && !aCar->HasCommand(DUMMY_VCALLED) && (aCar->HasCommand(CMD_STANDBY_OFF)

{
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_SWR))
{
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.PushActionWait(ACTION_APPEND, 1.0f);
v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 1, 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 SWR");
int Money = Mission::GetMoneyLeft();
if (Money <= 12050)
{
Mission::PlayHint(HINT_NOSWR);
return;
}
int NewMoney = Money - 12050;
Mission::SetMoney(NewMoney);
Vehicle n;
Person p1;
Person p2;
n = Game::CreateVehicle(OBJ_SWR, UNNAMED);
n.SetSpeed(9.0f);
p1 = Game::CreatePerson(OBJ_USARFF, 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(3);
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, 2.5f);
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_SWRBOUGHT);
}
};

I changed the "Audio::PlaySample3D" line, so you'd have to change it back to the normal line that your scripts use; I've done a lot of small tweaks.

Link to comment
Share on other sites

Un // this line "// Before CollidingWith - && !aCar->HasCommand(DUMMY_VCALLED) && (aCar->HasCommand(CMD_STANDBY_OFF)"

And im 90% done with the command post script, just working out a call command glitch where the commands to call the units dont show up on the post.

Link to comment
Share on other sites

Well I restored the line (I don't remember why I removed those):

if (StrCompare(aCar->GetPrototypeFileName(), OBJ_SWR) == 0 && aCar->GetPlayerMP() == Caller->GetPlayerMP() && !aCar->HasCommand(DUMMY_VCALLED) && (aCar->HasCommand(CMD_STANDBY_OFF) || aCar->IsCollidingWithVirtualObject(VO_SWR)))

But still no luck. Hopefully when you release the Chief and Captain I can do a quick change to those scripts for the other vehicles, as long as you get both station's command vehicles done.

Link to comment
Share on other sites

Well I restored the line (I don't remember why I removed those):

if (StrCompare(aCar->GetPrototypeFileName(), OBJ_SWR) == 0 && aCar->GetPlayerMP() == Caller->GetPlayerMP() && !aCar->HasCommand(DUMMY_VCALLED) && (aCar->HasCommand(CMD_STANDBY_OFF) || aCar->IsCollidingWithVirtualObject(VO_SWR)))

But still no luck. Hopefully when you release the Chief and Captain I can do a quick change to those scripts for the other vehicles, as long as you get both station's command vehicles done.

I'll work on the Call SWR, EMS Captain, Battalion Chief Commands during the week. In the mean while enjoy this. http://forum.emergen...d-post-scripts/ its the command post i've been working on for the last 36 hours. :D

Link to comment
Share on other sites

Thanks a bunch for doing this work. Kind of got discouraged when my tweaks weren't panning out, but hopefully using yours as a base should be more successful, I look forward to hopefully being able to finally call the SWR, HRC, Brush, Foam, and HES without needing to manually crew and send them.

Link to comment
Share on other sites

I have to edit the scripts to allow it to select the unit if its on standby. (Ill do that alter down the road.) and for a vehicle to call in a unit I would have to edit the command to allow vehicles to be the caller.

Link to comment
Share on other sites

I know a couple mods already have it but could you make it so the swat vehicles can be called in especially the command post 1 and large truck FBI would be cool 2 I know this is probs to much but I thought it was worth a shot :)

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