ENG51INE Posted July 9, 2014 Report Share Posted July 9, 2014 I currently have two separate scripts in my mod to dispatch a 2nd Alarm and 3rd Alarm each consisting of three off map units. The scripts work and the units come onto the map, however, they come to the same spawn point at the same time and end up in a pig pile on top of each other making it impossible to move any of them. Does anyone know how to change the spawn location for each of the vehicles? object PcmdCall2ndAlarm : CommandScript{PcmdCall2ndAlarm(){SetIcon("call2nd");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_CHIEF) == 0)Audio::PlaySample3D(SND_BATLIGHTFORCE, Caller->GetPosition());else if(StrCompare(Caller->GetPrototypeFileName(), OBJ_CAPTAIN) == 0)Audio::PlaySample3D(SND_BATLIGHTFORCE, Caller->GetPosition()); Vehicle *theCar = NULL;float bestCar = 0.;VehicleList patrolCars(VT_FIREFIGHTERS_TLF, VT_FIREFIGHTERS_TLF);for (int i = 0; i < patrolCars.GetNumVehicles(); i++) {Vehicle *aCar = patrolCars.GetVehicle(i);if (StrCompare(aCar->GetPrototypeFileName(), OBJ_ENGINE11) == 0 && aCar->GetPlayerMP() == Caller->GetPlayerMP() && !aCar->HasCommand(DUMMY_VCALLED) && !aCar->HasCommand(DUMMY_HOSESON) && (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)){bool Engine04 = false;if (!VehicleCalled){GameObjectList l1; Game::CollectObstaclesOnVirtualObject(VO_ENGINE11, l1, ACTOR_VEHICLE);if(l1.GetNumObjects() > 0){Vehicle v = l1.GetObject(0);if (!v.HasCommand(DUMMY_VCALLED)){v.AssignCommand(DUMMY_VCALLED);VehicleCalled = true;} elseEngine04 = true;} elseEngine04 = true; } if (!VehicleCalled && Engine11){GameObjectList l1; Game::CollectObstaclesOnVirtualObject(VO_ENGINE11, l1, ACTOR_VEHICLE);if(l1.GetNumObjects() > 0){Vehicle v = l1.GetObject(0);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 gate05a = Game::GetGameObjects(OBJ_GATE05A); for(int i=0; i < gate05a.GetNumObjects(); i++)GameObject *gate = gate05a.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.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);v.PushActionExecuteCommand(ACTION_APPEND, DUMMY_CALLCREW, Caller, 3, false);v.PushActionWait(ACTION_APPEND, 7.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 = 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);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);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_AMBU);ActorList l4 = Game::GetActors(VO_SPAWN_ALLR);ActorList l5 = Game::GetActors(VO_SPAWN_FDR);ActorList l6 = Game::GetActors(VO_SPAWN_AMBUR);if(l1.GetNumActors() > 0){Spawn = l1.GetActor(0)->GetPosition();Rotate = l4.GetActor(0)->GetPosition();}else if(l2.GetNumActors() > 0){Spawn = l2.GetActor(0)->GetPosition();Rotate = l5.GetActor(0)->GetPosition();}else if(l3.GetNumActors() > 0){Spawn = l3.GetActor(0)->GetPosition();Rotate = l6.GetActor(0)->GetPosition();}else{Mission::PlayHint(HINT_NOENGINE);return;}System::Log("Buy BLS engine");int Money = Mission::GetMoneyLeft();if (Money <= 0){Mission::PlayHint(HINT_NOENGINE);return;}int NewMoney = Money - 0;Mission::SetMoney(NewMoney);Vehicle n;Person p1;Person p2;Person p3;Person p4;n = Game::CreateVehicle(OBJ_ENGINE3, UNNAMED);n.SetSpeed(9.0f);p1 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);p2 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);p3 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);p4 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);n.SetPlayerMP(Caller->GetPlayerMP());p1.SetPlayerMP(Caller->GetPlayerMP());p2.SetPlayerMP(Caller->GetPlayerMP());p3.SetPlayerMP(Caller->GetPlayerMP());p4.SetPlayerMP(Caller->GetPlayerMP());p1.SetUpgradeLevel(3);p2.SetUpgradeLevel(3);p3.SetUpgradeLevel(3);p4.SetUpgradeLevel(3);n.SetMaxPassengers(6);n.SetMaxTransports(0);n.AddPassenger(&p1);n.AddPassenger(&p2);n.AddPassenger(&p3);n.AddPassenger(&p4); n.SetPosition(Spawn); n.UpdatePlacement();n.Hide();n.PushActionTurnTo(ACTION_NEWLIST, Rotate);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);Vehicle m;Person p5;Person p6;Person p7;Person p8;m = Game::CreateVehicle(OBJ_ENGINE5, UNNAMED);m.SetSpeed(9.0f);p5 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);p6 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);p7 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);p8 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);m.SetPlayerMP(Caller->GetPlayerMP());p5.SetPlayerMP(Caller->GetPlayerMP());p6.SetPlayerMP(Caller->GetPlayerMP());p7.SetPlayerMP(Caller->GetPlayerMP());p8.SetPlayerMP(Caller->GetPlayerMP());p5.SetUpgradeLevel(3);p6.SetUpgradeLevel(3);p7.SetUpgradeLevel(3);p8.SetUpgradeLevel(3);m.SetMaxPassengers(6);m.SetMaxTransports(0);m.AddPassenger(&p5);m.AddPassenger(&p6);m.AddPassenger(&p7);m.AddPassenger(&p8); m.SetPosition(Spawn); m.UpdatePlacement();m.Hide();m.PushActionTurnTo(ACTION_NEWLIST, Rotate);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);Vehicle o;Person p9;Person p10;Person p11;Person p12;o = Game::CreateVehicle(OBJ_TRUCK6, UNNAMED);o.SetSpeed(9.0f);p9 = Game::CreatePerson(OBJ_CAPTAIN, UNNAMED);p10 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);p11 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);p12 = Game::CreatePerson(OBJ_FF_SCBA, UNNAMED);o.SetPlayerMP(Caller->GetPlayerMP());p9.SetPlayerMP(Caller->GetPlayerMP());p10.SetPlayerMP(Caller->GetPlayerMP());p11.SetPlayerMP(Caller->GetPlayerMP());p12.SetPlayerMP(Caller->GetPlayerMP());p9.SetUpgradeLevel(3);p10.SetUpgradeLevel(3);p11.SetUpgradeLevel(3);p12.SetUpgradeLevel(3);o.SetMaxPassengers(6);o.SetMaxTransports(0);o.AddPassenger(&p9);o.AddPassenger(&p10);o.AddPassenger(&p11);o.AddPassenger(&p12); o.SetPosition(Spawn); o.UpdatePlacement();o.Hide();o.PushActionTurnTo(ACTION_NEWLIST, Rotate);o.PushActionShowHide(ACTION_APPEND, false);o.PushActionMove(ACTION_APPEND, CmdPos);if (Game::IsMission())o.RemoveCommand("VcmdToFireStation"); if (!o.HasCommand(DUMMY_HASSIREN) && o.HasCommand(CMD_AUTOSIREN_OFF) && !Input::LShiftPressed() && !Input::RShiftPressed())Game::ExecuteCommand(CMD_SIREN, &o, &o); Mission::PlayHint(HINT_BLSENGINEBOUGHT);}}; Quote Link to comment Share on other sites More sharing options...
bma Posted July 9, 2014 Report Share Posted July 9, 2014 Try making the spawn area bigger Quote Link to comment Share on other sites More sharing options...
ENG51INE Posted July 9, 2014 Author Report Share Posted July 9, 2014 Try making the spawn area biggerTried it, didn't work. Not sure what the issue is. Quote Link to comment Share on other sites More sharing options...
ENG51INE Posted July 9, 2014 Author Report Share Posted July 9, 2014 Is there a way with the above script to change the spawn location of each of the vehicles? Quote Link to comment Share on other sites More sharing options...
The Loot Posted July 9, 2014 Report Share Posted July 9, 2014 Easiest thing would be to put a "PushActionWait" before the "PushActionShowHide" for the second and third vehicles. If you delay that for a couple seconds each, the other vehicles should clear the spawn point before the next appears. Quote Link to comment Share on other sites More sharing options...
ENG51INE Posted July 10, 2014 Author Report Share Posted July 10, 2014 Easiest thing would be to put a "PushActionWait" before the "PushActionShowHide" for the second and third vehicles. If you delay that for a couple seconds each, the other vehicles should clear the spawn point before the next appears.That worked! Thank you so much! Quote Link to comment Share on other sites More sharing options...