Aha. After correcting everything, the cruiser no longer gives an error, but gives the same result as the VAN and SUV, saying L1 == 0, L2 is good.
Edit: Something I just noticed, when I get the L1==0 and L2 is good, the vehicles don't move, but the biggest thing: The bluelights stay on. This must have a hint in it somewhere, but I can't figure out how.
Edit2: Never mind that dumb notice, that's just a scripting error on my behalf
Another thing I found:
The to policestation script has a command to set Priority to 110 when transporting criminals, and set it to 0 when not. This should't have anything to do with it, but it raised my suspicion.
------------------
Allright, so I've made some changes to the script to test some things, like changing l1 and l2 to l11 and l12, since l1 was already in use.
Here's the new version: Click , or below.
Spoiler
//****************************************************************************************** // #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_TOPOLICESTATION[] = "VcmdToPoliceStation"; const char CMD_PATROL[] = "VcmdPatrol"; const char CMD_STANDBY_ON[] = "VcmdStandbyOn"; const char CMD_STANDBY_OFF[] = "VcmdStandbyOff"; const char OBJ_VAN[] = "mod:Prototypes/Vehicles/03 LA Police/lasd_van.e4p"; const char OBJ_SUV[] = "mod:Prototypes/Vehicles/03 LA Police/suv_lapd.e4p"; const char OBJ_CRUISER01[] = "mod:Prototypes/Vehicles/03 LA Police/cv_lapd.e4p"; const char OBJ_CRUISER04[] = "mod:Prototypes/Vehicles/03 LA Police/dodge_charger_chp.e4p"; const char DUMMY_DISABLE[] = "DummyDisableSiren"; const char DUMMY_HASSIREN[] = "DummyHasSiren"; const char DUMMY_GOHOME[] = "DummyGoHome"; const char DUMMY_PATROL[] = "DummyPatrol"; const char OBJ_HELIPAD[] = "policestation_helipad"; const char VO_ENTRY[] = "policestation_entry"; const char VO_ENTRY_HELIPAD[] = "policestation_entry2"; const char VO_TURNTO[] = "policestation_turnto"; const char VO_FRONT01[] = "policestation_park01"; const char VO_FRONT02[] = "policestation_park02"; const char VO_FRONT03[] = "policestation_park03"; const char VO_BACK01[] = "policestation_park04"; const char VO_BACK02[] = "policestation_park05"; const char VO_BACK03[] = "policestation_park06"; const char VO_BACK04[] = "policestation_park07"; const char VO_DONUT01[] = "policestation_donut01"; const char VO_DONUT02[] = "policestation_donut02"; const char VO_HELI[] = "policestation_heli"; const char VO_SPAWN[] = "policestation_spawn"; const char VO_SPAWN_FRONT[] = "policestation_spawn"; const char VO_SPAWN_BACK[] = "spawn_police1"; const char VO_SPAWN_DONUT[] = "policestation_spawn2"; const char VO_MOVETO_FRONT[] = "policestation_moveto1"; const char VO_MOVETO_BACK[] = "spawn_police1r"; const char VO_MOVETO_DONUT[] = "policestation_moveto2"; const char VO_SQUAD01[] = "police_squad01"; const char VO_SQUAD02[] = "police_squad02"; const char VO_SQUAD03[] = "police_squad03"; const char VO_BACK01TT[] = "policestation_back04tt"; const char VO_BACK02TT[] = "policestation_back05tt"; const char VO_BACK03TT[] = "policestation_back06tt"; const char VO_BACK04TT[] = "policestation_back07tt"; const char VO_DONUT01TT[] = "policestation_donut01tt"; const char VO_DONUT02TT[] = "policestation_donut02tt"; const char SND_TOSTATION[] = "mod:Audio/FX/radio/1019.wav"; const char HINT_HELICOPTER[] = "Another helicopter is blocking the helipad! The helicopter will return to base!"; const char HINT_NOTVALID[] = "This vehicle doesn't belong in the police station!"; const char HINT_NOSPACE[] = "No space at the police station, vehicle starts a patrol."; const char PROTO_CV_LAPD[] = "mod:Prototypes/Vehicles/03 LA Police/cv_lapd.e4p"; 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; Vehicle v(Caller); if (v.IsCollidingWithVirtualObject(VO_HELI) || v.IsCollidingWithVirtualObject(VO_BACK01) || v.IsCollidingWithVirtualObject(VO_BACK02) || v.IsCollidingWithVirtualObject(VO_BACK03) || v.IsCollidingWithVirtualObject(VO_BACK04)) return false; ActorList l1 = Game::GetActors(VO_FRONT01); if (l1.GetNumActors() == 0) 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); if (v.GetVehicleType() != VT_POLICE_PHC && v.GetPrototypeFileName() != OBJ_VAN && v.GetPrototypeFileName() != OBJ_SUV && v.GetPrototypeFileName() != OBJ_CRUISER04 && v.GetPrototypeFileName() != OBJ_CRUISER01) { bool ParkinglotFound = false; ActorList l1; if (!ParkinglotFound) { GameObjectList l2; Game::CollectObstaclesOnVirtualObject(VO_FRONT01, l2, ACTOR_VEHICLE); if(l2.GetNumObjects() == 0) { l1 = Game::GetActors(VO_FRONT01); ParkinglotFound = true; } } if (!ParkinglotFound) { GameObjectList l3; Game::CollectObstaclesOnVirtualObject(VO_FRONT02, l3, ACTOR_VEHICLE); if(l3.GetNumObjects() == 0) { l1 = Game::GetActors(VO_FRONT02); ParkinglotFound = true; } } if (!ParkinglotFound) { GameObjectList l4; Game::CollectObstaclesOnVirtualObject(VO_FRONT03, l4, ACTOR_VEHICLE); if(l4.GetNumObjects() == 0) { l1 = Game::GetActors(VO_FRONT03); ParkinglotFound = true; } } if (!ParkinglotFound) { v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false); return; } else { Vector PD = l1.GetActor(0)->GetPosition(); Vector PD2 = l1.GetActor(0)->GetPosition() + Vector(280,-280,0); ActorList l8 = Game::GetActors(VO_TURNTO); Vector TurnTo = l8.GetActor(0)->GetPosition(); Game::FindFreePosition(Caller, PD); Audio::PlaySample3D(SND_TOSTATION, v.GetPosition()); v.PushActionMove(ACTION_NEWLIST, PD); v.PushActionTurnTo(ACTION_APPEND, TurnTo); v.PushActionWait(ACTION_APPEND, 1.5f); v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 2, false); PersonList transports = v.GetTransports(); if (transports.GetNumPersons() > 0) v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false); } } else if(StrCompare(v.GetPrototypeFileName(), OBJ_VAN) == 0) { GameObjectList l99; Game::CollectObstaclesOnVirtualObject(VO_BACK03, l99, ACTOR_VEHICLE); if(l99.GetNumObjects() > 0) { v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false); return; } else { ActorList l11 = Game::GetActors(VO_BACK03TT); ActorList l12 = Game::GetActors(VO_BACK03); } } else if(StrCompare(v.GetPrototypeFileName(), OBJ_SUV) == 0) { GameObjectList l99; Game::CollectObstaclesOnVirtualObject(VO_BACK04, l99, ACTOR_VEHICLE); if(l99.GetNumObjects() > 0) { v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false); return; } else { ActorList l11 = Game::GetActors(VO_BACK04TT); ActorList l12 = Game::GetActors(VO_BACK04); } } else if(StrCompare(v.GetPrototypeFileName(), OBJ_CRUISER01) == 0) { GameObjectList l99; Game::CollectObstaclesOnVirtualObject(VO_DONUT01, l99, ACTOR_VEHICLE); if(l99.GetNumObjects() > 0) { Game::CollectObstaclesOnVirtualObject(VO_DONUT02, l99, ACTOR_VEHICLE); if(l99.GetNumObjects() > 0) { v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false); return; } else { ActorList l11 = Game::GetActors(VO_DONUT02TT); ActorList l12 = Game::GetActors(VO_DONUT02); } } else { ActorList l11 = Game::GetActors(VO_DONUT01TT); ActorList l12 = Game::GetActors(VO_DONUT01); } } else if(StrCompare(v.GetPrototypeFileName(), OBJ_CRUISER04) == 0) { GameObjectList l99; Game::CollectObstaclesOnVirtualObject(VO_BACK01, l99, ACTOR_VEHICLE); if(l99.GetNumObjects() > 0) { Game::CollectObstaclesOnVirtualObject(VO_BACK02, l99, ACTOR_VEHICLE); if(l99.GetNumObjects() > 0) { v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_PATROL, Caller, 0, false); return; } else { ActorList l11 = Game::GetActors(VO_BACK02TT); ActorList l12 = Game::GetActors(VO_BACK02); } } else { ActorList l11 = Game::GetActors(VO_BACK01TT); ActorList l12 = Game::GetActors(VO_BACK01); } } else { Mission::PlayHint(HINT_NOTVALID); return; } if(l11.GetNumActors() > 0) { Vector TurnTo = l11.GetActor(0)->GetPosition(); Mission::PlayHint("L11 is good!"); } else { Mission::PlayHint("L11 is bad!"); return; } if(l12.GetNumActors() > 0) { Vector Park = l12.GetActor(0)->GetPosition(); Mission::PlayHint("L12 is good!"); } else { Mission::PlayHint("L2 is bad!"); return; } Audio::PlaySample3D(SND_TOSTATION, Caller->GetPosition()); v.PushActionMove(ACTION_NEWLIST, TurnTo); v.PushActionTurnTo(ACTION_APPEND, Park); v.PushActionWait(ACTION_APPEND, 1.0f); v.PushActionMove(ACTION_APPEND, Park); v.PushActionTurnTo(ACTION_APPEND, TurnTo); Mission::PlayHint("Going to park bitches!") } if(ChildID == 1) { if (v.GetVehicleType() != VT_POLICE_PHC) { ActorList l1 = Game::GetActors(VO_SPAWN_FRONT); if (l1.GetNumActors() > 0) Vector TargetPos = l1.GetActor(0)->GetPosition(); PersonList transports = v.GetTransports(); for(int i = 0; i < transports.GetNumPersons(); i++) { transports.GetPerson(i)->PushActionLeaveCar(ACTION_NEWLIST, Caller); if(transports.GetPerson(i)->GetRole() == ROLE_GANGSTER) { transports.GetPerson(i)->SetRole(ROLE_CIVILIAN); transports.GetPerson(i)->SetBehaviour(BEHAVIOUR_CIVILIAN_NORMAL); } transports.GetPerson(i)->PushActionWait(ACTION_APPEND, 0.5f); transports.GetPerson(i)->PushActionMove(ACTION_APPEND, TargetPos, true); transports.GetPerson(i)->PushActionDeleteOwner(ACTION_APPEND); } } else { ActorList l1 = Game::GetActors(VO_ENTRY_HELIPAD); if (l1.GetNumActors() > 0) Vector TargetPos = l1.GetActor(0)->GetPosition(); PersonList transports = v.GetTransports(); for(int i = 0; i < transports.GetNumPersons(); i++) { transports.GetPerson(i)->PushActionLeaveCar(ACTION_NEWLIST, Caller); if(transports.GetPerson(i)->GetRole() == ROLE_GANGSTER) { transports.GetPerson(i)->SetRole(ROLE_CIVILIAN); transports.GetPerson(i)->SetBehaviour(BEHAVIOUR_CIVILIAN_NORMAL); } transports.GetPerson(i)->PushActionWait(ACTION_APPEND, 0.5f); transports.GetPerson(i)->PushActionMove(ACTION_APPEND, TargetPos, true); transports.GetPerson(i)->PushActionDeleteOwner(ACTION_APPEND); } } } if(ChildID == 2) { Vehicle v(Caller); v.EnableBlinker(BLT_NONE); bool ToPoliceStation = false; if (v.IsCollidingWithVirtualObject(VO_FRONT01)) return; else ToPoliceStation = true; if (v.IsCollidingWithVirtualObject(VO_FRONT02)) return; else ToPoliceStation = true; if (v.IsCollidingWithVirtualObject(VO_FRONT03)) return; else ToPoliceStation = true; if (v.IsCollidingWithVirtualObject(VO_BACK01)) return; else ToPoliceStation = true; if (v.IsCollidingWithVirtualObject(VO_BACK02)) return; else ToPoliceStation = true; if (v.IsCollidingWithVirtualObject(VO_BACK03)) return; else ToPoliceStation = true; if (v.IsCollidingWithVirtualObject(VO_BACK04)) return; else ToPoliceStation = true; if (v.IsCollidingWithVirtualObject(VO_DONUT01)) return; else ToPoliceStation = true; if (v.IsCollidingWithVirtualObject(VO_DONUT02)) return; else ToPoliceStation = true; if(ToPoliceStation) v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_TOPOLICESTATION, Caller, 0, false); } } };
Of course, with new scripting, there's new errors:
?(_LAToPoliceStationa8392): Error: Symbol l11 is not defined in current scope
?(_LAToPoliceStationa8392): FILE:mod:/scripts/game/command/LAToPoliceStation.scripta8392 LINE:297
?(_LAToPoliceStationa8392): Error: Failed to evaluate l11.GetNumActors()
?(_LAToPoliceStationa8392): Possible candidates are...
?(_LAToPoliceStationa8392): filename line:size busy function type and name
I don't get why symbol l11 wouldn't be defined at that point.. any idea's?
---------------------
Breaktrough!
The CRUISER01 just parked, in its own parking space, saying l1 and l2 are good! Going to check what's going on!
Edit:
Well, I'm really stumped.
CRUISER01 works fine, every single time, parks like a charm, but the VAN, SUV and CRUISER04 just don't work. They still give an L11 error.
The only difference between those point that I can think of, is that the turnto vo's of the CRUISER01 are outside of the "squad" VO that is used in the PSStart script, and the turnto vo's of the other cars are inside their own squad vo.
Could this be of any influence? I can barely imagine that it would be, but it's all I can think of.
Edit2:
So I just ran a test.. That's the problem. The turnto VO's inside the other VO.
Not very logical, since the logic states 'more than 0'. Two is more then zero right?
But at least I know how to fix it now. Thank god.
----------------------
Alright, some final questions so I can finish this:
v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);
Above statement should direct to the command ToPoliceStation, ChildID==1 right?