Jump to content


Photo

How to add extra parking to police station


  • Please log in to reply
22 replies to this topic

#1 keepachris

keepachris

    Lieutenant

  • Members
  • 87 posts
  • Gender:Male
  • Location:Leicester

Posted 12 April 2012 - 05:19 PM

Hey i am using Los Angeles Mod v2.0 4x4 i wanted to add 3 extra parking spaces (opposite parking 01,02 & 03) to the police station for personal use i have tried for about 3months now and ive added the VO in the editor and then pasted the code in the La To police station script from parking space 1,2 & 3 (as they work) but obviously changing the number of Parking 01 to parking 08. the closest i got to it working was the police car would pull up to the space and park across it and then it would immediately pull off and start a patrol. i since ditched that script and put back the default one but was wondering if anyone has seen a tutorial to add PD parking spaces or if anybody is willing to create one? thank you

#2 Guest_nbrown8568_*

Guest_nbrown8568_*
  • Guests

Posted 09 June 2012 - 11:10 PM

That would be a great idea. I have been able to add spaces to the police station, maybe I can take on such a project.

Norm,

#3 drbauss96

drbauss96

    Firefighter

  • Members
  • 20 posts
  • Gender:Male
  • Location:Princeton
  • Interests:Police, Fire, EMS, Emergency 4, GTA IV with lots of police mods. On top of all this... I'm ballin outta control.

Posted 10 June 2012 - 09:43 PM

Howabout explaining how you did it so others can too maybe?
Thanks!,
Andrew

Posted Image

Posted Image

Wanna help out with Princeton Mod? Talk to me!

Ballin Outta Control

#4 cletus

cletus

    Captain

  • Members
  • 182 posts
  • Gender:Male
  • Location:ohio, cincinnati

Posted 15 June 2012 - 08:06 PM

i just added 10 parking spaces but i cant call all the units for back up do to a error.
Posted Image
Posted Image

#5 jsutton

jsutton

    Battalion Chief

  • Members
  • 540 posts
  • Gender:Male
  • Location:Taylorville, Illinois, USA
  • Interests:Tractor Pulling, Emergency Vehicles, Gaming

Posted 17 June 2012 - 10:26 AM

Me and buddy have been working on this project for a while now. We managed to get the police station to function just like the fire station (spawning officers, patrol cars spawning and returning to station). I'll take a look at the script since it's been a couple months since I even looked at the editor or script.

#6 cletus

cletus

    Captain

  • Members
  • 182 posts
  • Gender:Male
  • Location:ohio, cincinnati

Posted 18 June 2012 - 04:32 PM

i like your script already lol. i have been wanting to do someting like that. do you have a pic i can l;ook at to see how it is set up?
Posted Image
Posted Image

#7 jsutton

jsutton

    Battalion Chief

  • Members
  • 540 posts
  • Gender:Male
  • Location:Taylorville, Illinois, USA
  • Interests:Tractor Pulling, Emergency Vehicles, Gaming

Posted 19 June 2012 - 08:40 AM

i like your script already lol. i have been wanting to do someting like that. do you have a pic i can l;ook at to see how it is set up?


Script is far from done. We just have it functional for spawning the police officers and returning two vehicles to station currently. He figured out how to do the spawning and over 3/4 of the scripting. I just fixed the flaws in the scripting and I did all the editor work. Right now, me and him are so busy with life, we can't do any modding or gaming like we want to. We also put this on hold to focus on the returning to station script for multiplayer. So two major projects at once but no time to work on them. All I can give you is a editor screenshot of the station w/ virtual objects and then a screenshot of the layout I made in paint when we planned it out.

KeepaChris: I think I have your problem solved. The order and game object lists need to be changed. I haven't tested this so make sure you have a backup made. I'm just looking at the script and picturing it all in my head and this should work. I would test it myself, but don't have much time to trial and error at the moment.

What you should do is copy Park01-Park03 codes and paste them in a blank notepad. (assuming Park06 thru Park08 is the VO you created.)
Change Park01 to Park06 and the game object list #'s to 5.
Change Park02 to Park07 and the game object list #'s to 6.
Change Park03 to Park08 and the game object list #'s to 7.

Copy them and paste them under the park03 code just before this line: if (Donut && !ParkinglotFound)
**Note** The reason you want to do this is, anything after Park03 is suppose to go to the donut shop (which is Park04 / Park05). So you must add Park06-Park08 before the "send to donut shop parking lot" code and then change the game object list #'s so it's in chronological order. (hope it makes sense)

Now, after you do that, you need to change the game object lists of: Park04 and Park05
Change Park04 game object list #'s to 8.
Change Park05 game object list #'s to 9.

At the top of the page, add these three lines under Park05, of course:
const char VO_PARK06[] = "policestation_park06";
const char VO_PARK07[] = "policestation_park07";
const char VO_PARK08[] = "policestation_park08";

At the bottom of the page, after "return;" of Park05 hit enter and add this:
else
   ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_PARK06))
	return;
else
   ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_PARK07))
	return;
else
   ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_PARK08))
	return;

Ok, I think that is all you need to do. Make sure the ending stays there "else... ToPoliceStation=true;". I'm not sure if Xplorer was working on a Park06 or if it is actually needed for the script. I would assume it has no purpose and can be deleted but let's not do that until you have a working script!

Let me know if it works and if not, upload the script so I can see the edited part and make sure there is no errors in it or see if I made a mistake on how to do something.

Thanks,
jsutton

Attached Files



#8 cletus

cletus

    Captain

  • Members
  • 182 posts
  • Gender:Male
  • Location:ohio, cincinnati

Posted 22 June 2012 - 11:23 AM

looks a lot like mine lol. how do you get the vo to rotate? all my cars are parked in the same direction. i also can hold up to 10 cares in mine but my issue is that i can not call the car 9 or 10 in the call patrol script do to the statementbeing to long. is there a way to fix that part of it?
Posted Image
Posted Image

#9 jsutton

jsutton

    Battalion Chief

  • Members
  • 540 posts
  • Gender:Male
  • Location:Taylorville, Illinois, USA
  • Interests:Tractor Pulling, Emergency Vehicles, Gaming

Posted 23 June 2012 - 09:01 AM

looks a lot like mine lol. how do you get the vo to rotate? all my cars are parked in the same direction. i also can hold up to 10 cares in mine but my issue is that i can not call the car 9 or 10 in the call patrol script do to the statementbeing to long. is there a way to fix that part of it?


Yep, there isn't much else you can do with it. We have only done minimum scripting to make it functional.... I do not know how to rotate vehicles. I've looked through the script and do not see anything that has to deal with rotating the patrol cars so unsure here.... LACallPatrol script is what you are talking about? What is car 9 & 10? As I said, we haven't gotten to any of the scripting work but to make it functional but I can always look over things and get an idea of what needs to be changed to make it work. Never received a statement to long error but I'm wondering if your missing a bracket or something like that.

#10 cletus

cletus

    Captain

  • Members
  • 182 posts
  • Gender:Male
  • Location:ohio, cincinnati

Posted 25 June 2012 - 03:37 PM

i have up to ten parking spaces for patrol cars to park. not counting swat parking. here is my script... maybe together we can figure it out. every thing in the script works.the high lighted blue is where if i add anther car it says the statment is too long. if u need a better view let me know. it would not allow me to sent the file to you.Attached File  Untitled.png   524.96KB   74 downloads
Posted Image
Posted Image

#11 rettungstier

rettungstier

    Senior Captain

  • Members
  • 368 posts
  • Gender:Male
  • Location:Germany

Posted 25 June 2012 - 03:49 PM

@ cletus

i have no scripting skills, but ain't there a bracket (<- right english word?) too much in the last line after the LASD06 VO thing ?!

HpFA7Aj.png


#12 cletus

cletus

    Captain

  • Members
  • 182 posts
  • Gender:Male
  • Location:ohio, cincinnati

Posted 25 June 2012 - 05:39 PM

i will test that but i changed nothing there.


i took one out but the game keeps crashing so i guess it needs all 3
Posted Image
Posted Image

#13 jsutton

jsutton

    Battalion Chief

  • Members
  • 540 posts
  • Gender:Male
  • Location:Taylorville, Illinois, USA
  • Interests:Tractor Pulling, Emergency Vehicles, Gaming

Posted 30 June 2012 - 09:17 AM

Sorry, I've been busy with work all week. I don't think the parenthesis is anything to worry about.

What script is your problem in? I've looked in all the scripts I thought it would be in unless I overlooked it.

#14 cletus

cletus

    Captain

  • Members
  • 182 posts
  • Gender:Male
  • Location:ohio, cincinnati

Posted 01 July 2012 - 09:23 PM

the la call patrol car script
Posted Image
Posted Image

#15 Zach1019

Zach1019

    Senior Captain

  • Members
  • 421 posts
  • Gender:Male
  • Location:United States of America

Posted 10 July 2012 - 12:36 AM

ok I need some help. I have added some more parking spaces to my script and I followed what it says in this topic how to put in new parking spaces.

Here's what my script looks like(LA To Police Station script):



//******************************************************************************************
// #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 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_PARK01[] = "policestation_park01";
const char VO_PARK02[] = "policestation_park02";
const char VO_PARK03[] = "policestation_park03";
const char VO_PARK04[] = "policestation_park04";
const char VO_PARK05[] = "policestation_park05";
const char VO_PARK06[] = "policestation_park06";
const char vo_Park07[] = "policestation_park07";
const char vo_Park08[] = "policestation_park08";
const char vo_Park09[] = "policestation_park09";
const char vo_Park10[] = "policestation_park10";
const char vo_Park11[] = "policestation_park11";
const char vo_Park12[] = "policestation_park12";
const char vo_Park13[] = "policestation_park13";
const char vo_Park14[] = "policestation_park14";
const char vo_Park15[] = "policestation_park15";
const char VO_HELI[] = "policestation_heli";
const char VO_SPAWN[] = "policestation_spawn";
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 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))
return false;

ActorList l1 = Game::GetActors(VO_PARK01);
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);
bool Donut = false;
ActorList d = Game::GetActors(VO_PARK04);
if (StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD) == 0 && d.GetNumActors() > 0)
Donut = true;

if(ChildID == 0)
{
if (v.GetVehicleType() != VT_POLICE_PHC)
{
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;
bool ToDonut = false;
ActorList l1;
if (!ParkinglotFound)
{
GameObjectList l2;
Game::CollectObstaclesOnVirtualObject(VO_PARK01, l2, ACTOR_VEHICLE);
if(l2.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK01);
ParkinglotFound = true;
}
}
if (!ParkinglotFound)
{
GameObjectList l3;
Game::CollectObstaclesOnVirtualObject(VO_PARK02, l3, ACTOR_VEHICLE);
if(l3.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK02);
ParkinglotFound = true;
}
}
if (!ParkinglotFound)
{
GameObjectList l4;
Game::CollectObstaclesOnVirtualObject(VO_PARK03, l4, ACTOR_VEHICLE);
if(l4.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK03);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l5;
Game::CollectObstaclesOnVirtualObject(VO_PARK06, l5, ACTOR_VEHICLE);
if(l5.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK06);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l6;
Game::CollectObstaclesOnVirtualObject(VO_PARK07, l6, ACTOR_VEHICLE);
if(l6.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK07);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l7;
Game::CollectObstaclesOnVirtualObject(VO_PARK08, l7, ACTOR_VEHICLE);
if(l7.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK08);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l8;
Game::CollectObstaclesOnVirtualObject(VO_PARK09, l8, ACTOR_VEHICLE);
if(l8.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK09);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l9;
Game::CollectObstaclesOnVirtualObject(VO_PARK10, l9, ACTOR_VEHICLE);
if(l9.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK10);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l10;
Game::CollectObstaclesOnVirtualObject(VO_PARK11, l10, ACTOR_VEHICLE);
if(l10.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK11);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l11;
Game::CollectObstaclesOnVirtualObject(VO_PARK11, l13, ACTOR_VEHICLE);
if(l11.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK12);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l12;
Game::CollectObstaclesOnVirtualObject(VO_PARK13, l12, ACTOR_VEHICLE);
if(l12.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK13);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l13;
Game::CollectObstaclesOnVirtualObject(VO_PARK14, l13, ACTOR_VEHICLE);
if(l13.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK14);
ParkinglotFound = true;
}

if (!ParkinglotFound)
{
GameObjectList l14;
Game::CollectObstaclesOnVirtualObject(VO_PARK15, l14, ACTOR_VEHICLE);
if(l14.GetNumObjects() == 0)
{
l1 = Game::GetActors(VO_PARK15);
ParkinglotFound = true;
}
}
if (Donut && !ParkinglotFound)
{
GameObjectList l15;
Game::CollectObstaclesOnVirtualObject(VO_PARK04, l15, ACTOR_VEHICLE);
if (!l15.ContainsSquad())
{
l1 = Game::GetActors(VO_PARK04);
ParkinglotFound = true;
ToDonut = true;
}
}
if (Donut && !ParkinglotFound)
{
GameObjectList l16;
Game::CollectObstaclesOnVirtualObject(VO_PARK05, l16, ACTOR_VEHICLE);
if (!l16.ContainsSquad())
{
l1 = Game::GetActors(VO_PARK05);
ParkinglotFound = true;
ToDonut = 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());

if (!ToDonut)
{
v.PushActionMove(ACTION_NEWLIST, PD);
v.PushActionTurnTo(ACTION_APPEND, TurnTo);
} else
{
v.PushActionMove(ACTION_NEWLIST, PD2);
v.PushActionTurnTo(ACTION_APPEND, PD + Vector(320,-320,0));
v.PushActionWait(ACTION_APPEND, 0.5f);
v.PushActionMove(ACTION_APPEND, PD);
}
v.PushActionWait(ACTION_APPEND, 1.5f);
v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 2, false);
PersonList transports = v.GetTransports();
if (!ToDonut && transports.GetNumPersons() > 0)
v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);
}
} else
{
Audio::PlaySample3D(SND_TOSTATION, v.GetPosition());
ActorList l1 = Game::GetActors(OBJ_HELIPAD);
if(l1.GetNumActors() > 0)
{
Actor policestation = *l1.GetActor(0);
Vector Policestation = policestation.GetPosition();
}
if (Game::IsSquadInVirtualObject(VO_HELI))
{
GameObjectList l2;
Game::CollectObstaclesOnVirtualObject(VO_HELI, l2, ACTOR_VEHICLE);
for (int i = 0; i < l2.GetNumObjects(); i++)
{
Vehicle m = l2.GetObject(i);
m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_GOHOME, &m, 1, false);
Mission::PlayHint(HINT_HELICOPTER);
}
}
Game::FindFreePosition(Caller, Policestation);
GameObject obj(&policestation);
float landingDirection = v.GetValidLandingAngle(&obj, Policestation);
v.PushActionFlyTo(ACTION_NEWLIST, Policestation, true, landingDirection);
PersonList transports = v.GetTransports();
if (transports.GetNumPersons() > 0)
v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);
}
}
if(ChildID == 1)
{
if (v.GetVehicleType() != VT_POLICE_PHC)
{
ActorList l1 = Game::GetActors(VO_SPAWN);
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_PARK01))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_PARK02))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_PARK03))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_PARK04))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualObject(VO_PARK05))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park06))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park07))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park08))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park09))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park10))
return;
` else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park11))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park12))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park13))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park14))
return;
else
ToPoliceStation = true;
if (v.IsCollidingWithVirtualobject(vo_Park15))
return;
else
ToPoliceStation = true;

if(ToPoliceStation)
v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_TOPOLICESTATION, Caller, 0, false);
}
}
};

Co-Creator of the Red Beach Modification


#16 cletus

cletus

    Captain

  • Members
  • 182 posts
  • Gender:Male
  • Location:ohio, cincinnati

Posted 11 July 2012 - 04:55 PM

what do you need help with?
Posted Image
Posted Image

#17 Zach1019

Zach1019

    Senior Captain

  • Members
  • 421 posts
  • Gender:Male
  • Location:United States of America

Posted 11 July 2012 - 06:02 PM

Well when I load my mod it gives me a script error and then when I ignore the script error and go to free play the game crashes after about 30 second. I need to fix my scrip so I can use those parking spaces and so it doesn't crash the game.


LA TO POLICE STATION Script:
//******************************************************************************************
// #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 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_PARK01[]	 = "policestation_park01";
const char VO_PARK02[]	 = "policestation_park02";
const char VO_PARK03[]	 = "policestation_park03";
const char VO_PARK04[]	 = "policestation_park04";
const char VO_PARK05[]	 = "policestation_park05";
const char VO_PARK06[]	 = "policestation_park06";
const char vo_Park07[]    = "policestation_park07";
const char vo_Park08[]    = "policestation_park08";
const char vo_Park09[]    = "policestation_park09";
const char vo_Park10[]    = "policestation_park10";
const char vo_Park11[]    = "policestation_park11";
const char vo_Park12[]    = "policestation_park12";
const char vo_Park13[]    = "policestation_park13";
const char vo_Park14[]    = "policestation_park14";
const char vo_Park15[]    = "policestation_park15";
const char VO_HELI[]	 = "policestation_heli";
const char VO_SPAWN[]	 = "policestation_spawn";
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 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))
   return false;
  ActorList l1 = Game::GetActors(VO_PARK01);
  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);
  bool Donut = false;
  ActorList d = Game::GetActors(VO_PARK04);
  if (StrCompare(v.GetPrototypeFileName(), PROTO_CV_LAPD) == 0 && d.GetNumActors() > 0)
   Donut = true;
  if(ChildID == 0)
  {
   if (v.GetVehicleType() != VT_POLICE_PHC)
   {
    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;
    bool ToDonut = false;
    ActorList l1;
    if (!ParkinglotFound)
    {
	 GameObjectList l2;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK01, l2, ACTOR_VEHICLE);
	 if(l2.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK01);
	  ParkinglotFound = true;
	 }
    }
    if (!ParkinglotFound)
    {
	 GameObjectList l3;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK02, l3, ACTOR_VEHICLE);
	 if(l3.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK02);
	  ParkinglotFound = true;
	 }
    }
    if (!ParkinglotFound)
    {
	 GameObjectList l4;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK03, l4, ACTOR_VEHICLE);
	 if(l4.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK03);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l5;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK06, l5, ACTOR_VEHICLE);
	 if(l5.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK06);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l6;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK07, l6, ACTOR_VEHICLE);
	 if(l6.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK07);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l7;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK08, l7, ACTOR_VEHICLE);
	 if(l7.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK08);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l8;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK09, l8, ACTOR_VEHICLE);
	 if(l8.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK09);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l9;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK10, l9, ACTOR_VEHICLE);
	 if(l9.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK10);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l10;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK11, l10, ACTOR_VEHICLE);
	 if(l10.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK11);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l11;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK11, l11, ACTOR_VEHICLE);
	 if(l11.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK12);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l12;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK13, l12, ACTOR_VEHICLE);
	 if(l12.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK13);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l13;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK14, l13, ACTOR_VEHICLE);
	 if(l13.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK14);
	  ParkinglotFound = true;
	 }
    if (!ParkinglotFound)
    {
	 GameObjectList l14;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK15, l14, ACTOR_VEHICLE);
	 if(l14.GetNumObjects() == 0)
	 {
	  l1 = Game::GetActors(VO_PARK15);
	  ParkinglotFound = true;
	 }
    }
    if (Donut && !ParkinglotFound)
    {
	 GameObjectList l15;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK04, l15, ACTOR_VEHICLE);
	 if (!l15.ContainsSquad())
	 {
	  l1 = Game::GetActors(VO_PARK04);
	  ParkinglotFound = true;
	  ToDonut = true;
	 }
    }
    if (Donut && !ParkinglotFound)
    {
	 GameObjectList l16;
	  Game::CollectObstaclesOnVirtualObject(VO_PARK05, l16, ACTOR_VEHICLE);
	 if (!l16.ContainsSquad())
	 {
	  l1 = Game::GetActors(VO_PARK05);
	  ParkinglotFound = true;
	  ToDonut = 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());
	 if (!ToDonut)
	 {
	  v.PushActionMove(ACTION_NEWLIST, PD);
	  v.PushActionTurnTo(ACTION_APPEND, TurnTo);
	 } else
	 {
	  v.PushActionMove(ACTION_NEWLIST, PD2);
	  v.PushActionTurnTo(ACTION_APPEND, PD + Vector(320,-320,0));
	  v.PushActionWait(ACTION_APPEND, 0.5f);
	  v.PushActionMove(ACTION_APPEND, PD);
	 }
	 v.PushActionWait(ACTION_APPEND, 1.5f);
	 v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 2, false);
	 PersonList transports = v.GetTransports();
	 if (!ToDonut && transports.GetNumPersons() > 0)
	  v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);
    }
   } else
   {
    Audio::PlaySample3D(SND_TOSTATION, v.GetPosition());
    ActorList l1 = Game::GetActors(OBJ_HELIPAD);
    if(l1.GetNumActors() > 0)
    {
	 Actor policestation = *l1.GetActor(0);
	 Vector Policestation = policestation.GetPosition();
    }
    if (Game::IsSquadInVirtualObject(VO_HELI))
    {
	 GameObjectList l2;
	  Game::CollectObstaclesOnVirtualObject(VO_HELI, l2, ACTOR_VEHICLE);
	 for (int i = 0; i < l2.GetNumObjects(); i++)
	 {
	  Vehicle m = l2.GetObject(i);
	  m.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_GOHOME, &m, 1, false);
	  Mission::PlayHint(HINT_HELICOPTER);	
	 }
    }
    Game::FindFreePosition(Caller, Policestation);
    GameObject obj(&policestation);
    float landingDirection = v.GetValidLandingAngle(&obj, Policestation);
    v.PushActionFlyTo(ACTION_NEWLIST, Policestation, true, landingDirection);
    PersonList transports = v.GetTransports();
    if (transports.GetNumPersons() > 0)
	 v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);
   }
  }
  if(ChildID == 1)
  {
   if (v.GetVehicleType() != VT_POLICE_PHC)
   {
    ActorList l1 = Game::GetActors(VO_SPAWN);
		   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_PARK01))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualObject(VO_PARK02))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualObject(VO_PARK03))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualObject(VO_PARK04))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualObject(VO_PARK05))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park06))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park07))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park08))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park09))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park10))
    return;
  ` else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park11))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park12))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park13))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park14))
    return;
   else
    ToPoliceStation = true;
   if (v.IsCollidingWithVirtualobject(vo_Park15))
    return;
   else
    ToPoliceStation = true;
   if(ToPoliceStation)
    v.PushActionExecuteCommand(ACTION_NEWLIST, CMD_TOPOLICESTATION, Caller, 0, false);
  }
}
};


I followed everything that was said in this topic on how to make new parking spaces and it still doesn't work.

Co-Creator of the Red Beach Modification


#18 cletus

cletus

    Captain

  • Members
  • 182 posts
  • Gender:Male
  • Location:ohio, cincinnati

Posted 11 July 2012 - 07:11 PM

GameObjectList l4; Game::CollectObstaclesOnVirtualObject(VO_PARK03, l4, ACTOR_VEHICLE); if(l4.GetNumObjects() == 0) {
l1
= Game::GetActors(VO_PARK03); ParkinglotFound = true; } if (!ParkinglotFound) { GameObjectList l5; Game::CollectObstaclesOnVirtualObject(VO_PARK06, l5, ACTOR_VEHICLE); if(l5.GetNumObjects() == 0) {
l1
= Game::GetActors(VO_PARK06); ParkinglotFound = true; } if (!ParkinglotFound) {
i think i see your issue, your missing 4 and 5. you jumped. also did you create the spots in the editor?
Posted Image
Posted Image

#19 Zach1019

Zach1019

    Senior Captain

  • Members
  • 421 posts
  • Gender:Male
  • Location:United States of America

Posted 11 July 2012 - 08:51 PM

Yeah I did make then Virtual Objects in the editor.

Co-Creator of the Red Beach Modification


#20 jsutton

jsutton

    Battalion Chief

  • Members
  • 540 posts
  • Gender:Male
  • Location:Taylorville, Illinois, USA
  • Interests:Tractor Pulling, Emergency Vehicles, Gaming

Posted 12 July 2012 - 01:53 AM

Hope you backed up your file. I posted that info to see if it fixes keepachris script and never heard feedback whether it did or didn't. I would not recommend anyone doing it unless they know it will work or not.