Jump to content
Ghost Graphic Designs

Spawning vehicles on the freeplay map

Recommended Posts

Hi. 

 

I've been working on my modification and I need to find a way for the vehicles to spawn at a certain VO without lights and crew. I've tried to take a look into Copenhagen's start-up script (and mG3 city mod) and I don't really understand what to do. I just need a simple script to make 30 vehicles spawn in their respective Virtual Objects with no lights and with space for the fire fighters, paramedics and police officers (and transports) to get in.

 

If someone could help me out, it would be extremely appreciated! :)

Link to comment
Share on other sites

Then you are looking the right place :)

 

I know the script can be confusing, but line line 3 -> 72 can be deleted because it is only in Copenhagen it is needed. 

 

But what you are looking at is 

	vl=Game::GetGameObjects("P_P1");									// *	if(vl.GetNumObjects() > 0)	{		Mission::PlayHint("P1 er allerede på mappet"); 				// *	}	else	{		l1=Game::GetActors("P_P1"); 								// *		if(l1.GetNumActors() > 0)		{			parkobj = *l1.GetActor(0);		parkplatz = parkobj.GetPosition();		v = Game::CreateVehicle("mod:Prototypes/Vehicles/Fire Department/P1.e4p","P1"); 	// **		v.SetMaxPassengers(2); 									// *		v.SetMaxTransports(0); 									// *		v.EnableBlueLights(false);		v.EnableBreakLights(false);		v.EnableSpecialLights(false);		v.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);		Math::EulerToMatrix(180.f, 0.f, 0.f, childRot); 						// *		Math::MultiplyMatrices(childRot, rot);		v.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);		v.SetPosition(parkplatz);		v.SetCommandable(false);		v.RemoveCommand("GoHome");		v.AssignCommand("ParkAtBase");		v.AssignCommand("Dummy_Free");		v.AssignCommand("Dummy_Parked");		v.AssignCommand("Dummy_OMC");	}		else		{			Mission::PlayHint("P pladsen kan ikke findes"); 				// *		}	}

It can be confusing, but it really isn't 

 

lets walk threw it:

 

 

vl=Game::GetGameObjects("P_P1"); // *      <- Is the virtuel object
if(vl.GetNumObjects() > 0)
{
Mission::PlayHint("P1 er allerede på mappet"); // *
}
else
{
l1=Game::GetActors("P_P1"); // *   <- Is the virtuel object
if(l1.GetNumActors() > 0)
{
parkobj = *l1.GetActor(0);
parkplatz = parkobj.GetPosition();
v = Game::CreateVehicle("mod:Prototypes/Vehicles/Fire Department/P1.e4p","P1"); // **  <- Is creating the vehicle(the place of the prototype and the name)
v.SetMaxPassengers(2); // *  <- Amount of passengers
v.SetMaxTransports(0); // *  <- Amount of transports(for ambulances or police cars)
v.EnableBlueLights(false);  <- Turn off blue light
v.EnableBreakLights(false);  <- Turn off break light
v.EnableSpecialLights(false);  <- Turn off special lights
v.GetRotation(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
Math::EulerToMatrix(180.f, 0.f, 0.f, childRot); // *  <- Rotates the car(360 is all the way around, 180 is half the way around ect)
Math::MultiplyMatrices(childRot, rot);
v.SetRotation(childRot[0], childRot[1], childRot[2], childRot[3], childRot[4], childRot[5], childRot[6], childRot[7], childRot[8]);
v.SetPosition(parkplatz);
v.SetCommandable(false);   <- Make the car not controlable
v.RemoveCommand("GoHome");   <- Remove random command
v.AssignCommand("ParkAtBase"); <- Assign random command
v.AssignCommand("Dummy_Free"); <- Assign random command
v.AssignCommand("Dummy_Parked"); <- Assign random command
v.AssignCommand("Dummy_OMC"); <- Assign random command
}
else
{
Mission::PlayHint("P pladsen kan ikke findes"); // *
}
}
 
All you need to focus on is the lines i have marked with red and described :)
This describes 1 car, look at the script and you will see that it is just theese lines repeated over and over again with different cars :)
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...