TheAxeMan33 Posted August 24, 2015 Report Share Posted August 24, 2015 I went in the Editor and cloned the original parking spots for NYC 1.01, I renamed them all so that they were not matching and put them in a good accessible parking spot. Once I got all the spots in a good position I double-checked the names to save myself some headache if it was misnamed, all was correct. after that I edited NYCToPoliceStation and edited it accordingly, but when I have a unit return to station, it gives me a error saying that it's assigned to 19. I'm not sure if I edited the file properly so I'l paste a copy in here below. //******************************************************************************************// #Version 1.5#//// Includes: To police station command.//// - VcmdToPoliceStation//// Script by Hoppah// // Usage of this script in other mods is NOT allowed without permission of Hoppah////******************************************************************************************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_GOHOME[] = "GoHome";const char CMD_PATROL[] = "VcmdPatrol";const char CMD_STANDBY_ON[] = "VcmdStandbyOn";const char CMD_STANDBY_OFF[] = "VcmdStandbyOff";const char DUMMY_DISABLE[] = "DummyDisableSiren";const char DUMMY_HASSIREN[] = "DummyHasSiren";const char DUMMY_GOHOME[] = "DummyGoHome";const char DUMMY_PATROL[] = "DummyPatrol";const char VO_ENTRY[] = "police_entry";const char VO_POLICE01[] = "police_park01";const char VO_POLICE02[] = "police_park02";const char VO_POLICE03[] = "police_park03";const char VO_POLICE04[] = "police_park04";const char VO_POLICE05[] = "police_park05";const char VO_POLICE06[] = "police_park06";const char VO_POLICE07[] = "police_park07";const char VO_POLICE08[] = "police_park08";const char VO_POLICE_FP1[] = "police_fp01";const char VO_POLICE09[] = "police_park09";const char VO_POLICE10[] = "police_park10";const char VO_POLICE11[] = "police_park11";const char VO_POLICE12[] = "police_park12";const char VO_POLICE13[] = "police_park13";const char VO_POLICE14[] = "police_park14";const char VO_POLICE15[] = "police_park15";const char VO_POLICE16[] = "police_park16";const char VO_POLICE17[] = "police_park17";const char VO_POLICE18[] = "police_park18"; const char HINT_NOSPACE[] = "No free parking spaces! Vehicle will start patrolling!"; int DummyGroup = 32;object VcmdToPoliceStation : CommandScript{ VcmdToPoliceStation() { SetCursor("topolicestation"); SetIcon("topolicestation"); SetGroupID(DummyGroup); SetGroupLeader(true); SetRestrictions(RESTRICT_SELFEXECUTE); } bool CheckPossible(GameObject *Caller) { if (!Caller->IsValid()) return false; if (!Game::IsFreeplay() && !Game::IsMultiplayer()) return false; return true; } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { if (!Caller->IsValid() || !Target->IsValid() || (Caller->GetID() != Target->GetID())) return false; Vehicle v(Caller); SetPriority(0); if (v.GetNumTransported() > 0) SetPriority(110); return true; } void PushActions(GameObject *Caller, Actor *Target, int ChildID) { Vehicle v(Caller); if(ChildID == 0) { if (v.IsBlueLightEnabled()) v.EnableBlueLights(false); //if (v.HasCommand("DummyFollow")) // v.RemoveCommand("DummyFollow"); 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); } if (v.HasObjectPath(NULL)) Game::ExecuteCommand(DUMMY_PATROL, &v, &v); if (v.HasCommand(DUMMY_HASSIREN) && v.HasCommand(CMD_AUTOSIREN_OFF)) Game::ExecuteCommand(DUMMY_DISABLE, &v, &v); bool ParkinglotFound = false; GameObjectList l1, l2, l3, l4, l5, l6, l7, l8, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29; ActorList list1, list2; if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE01, l1, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE01); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE02, l2, ACTOR_VEHICLE); if(l2.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE02); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE03, l3, ACTOR_VEHICLE); if(l3.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE03); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE04, l4, ACTOR_VEHICLE); if(l4.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE04); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE05, l5, ACTOR_VEHICLE); if(l5.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE05); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE06, l6, ACTOR_VEHICLE); if(l6.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE06); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE07, l7, ACTOR_VEHICLE); if(l7.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE07); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE08, l8, ACTOR_VEHICLE); if(l8.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE08); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE09, l9, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE09); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE10, 20, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE10); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE11, 21, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE11); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE12, 22, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE12); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE13, 23, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE13); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE14, 24, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE13); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE15, 25, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE14); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE15, 26, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE15); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE16, 27, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE16); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE17, 28, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE17); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Game::CollectObstaclesOnVirtualObject(VO_POLICE18, 29, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0) { list1 = Game::GetActors(VO_POLICE18); list2 = Game::GetActors(VO_POLICE_FP1); ParkinglotFound = true; } } if (!ParkinglotFound) { Mission::PlayHint(HINT_NOSPACE); v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false); return; } else if (ParkinglotFound) { Vector Pos = list1.GetActor(0)->GetPosition(); Vector TurnTo = list2.GetActor(0)->GetPosition(); v.PushActionMove(ACTION_NEWLIST, Pos); v.PushActionTurnTo(ACTION_APPEND, TurnTo); v.PushActionWait(ACTION_APPEND, 0.1f); if (v.GetNumTransported() >= 1) v.PushActionExecuteCommand(ACTION_APPEND, "VcmdToPoliceStation", Caller, 1, false); v.PushActionExecuteCommand(ACTION_APPEND, "VcmdToPoliceStation", Caller, 2, false); } } if(ChildID == 1) { ActorList pos = Game::GetActors(VO_ENTRY); Vector TargetPos = pos.GetActor(0)->GetPosition(); PersonList l1 = v.GetTransports(); for(int i = 0; i < l1.GetNumPersons(); i++) { l1.GetPerson(i)->PushActionLeaveCar(ACTION_NEWLIST, Caller); if(l1.GetPerson(i)->GetRole() == ROLE_GANGSTER) { l1.GetPerson(i)->SetRole(ROLE_CIVILIAN); l1.GetPerson(i)->SetBehaviour(BEHAVIOUR_CIVILIAN_NORMAL); } l1.GetPerson(i)->PushActionWait(ACTION_APPEND, 0.5f); l1.GetPerson(i)->PushActionMove(ACTION_APPEND, TargetPos, true); l1.GetPerson(i)->PushActionDeleteOwner(ACTION_APPEND); } } if(ChildID == 2) { Vehicle v(Caller); v.EnableBlinker(BLT_NONE); bool ToPoliceStation = false; if (v.IsCollidingWithVirtualObject(VO_POLICE01)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE02)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE03)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE04)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE05)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE06)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE07)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE08)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE09)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE10)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE11)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE12)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE12)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE13)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE14)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE15)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE16)) return; else if (v.IsCollidingWithVirtualObject(VO_POLICE17)) return; else (v.IsCollidingWithVirtualObject(VO_POLICE18)) return; ToPoliceStation = true; if(ToPoliceStation) v.PushActionExecuteCommand(ACTION_NEWLIST, "VcmdToPoliceStation", Caller, 0, false); } }}; Note : It comes with 8 parking spots originally, I added #9-#18 Quote Link to comment Share on other sites More sharing options...
itchboy Posted August 24, 2015 Report Share Posted August 24, 2015 else if (v.IsCollidingWithVirtualObject(VO_POLICE18)) return; else ToPoliceStation = true;This is the correction of your code. You made one mistake at the final condition for the 18th VO. Among other things, yourGame::CollectObstaclesOnVirtualObject(VO_POLICE14, 24, ACTOR_VEHICLE); if(l1.GetNumObjects() == 0)is wrong because the condition does not check the GameObjectLIst 24 but l1. Quote Link to comment Share on other sites More sharing options...