So my question is how to spawn additional cars on the map without clogging up the init. Currently i am calling a scrip file in the init.c
class CreateVehicle
{
private Car vehicle;
void CreateVehicle(string vehName, vector pos)
{
vehicle = GetGame().CreateObject(vehName, pos);
}
void addVehicleFuel(float fuelAmount)
{
vehicle.Fill(CarFluid.FUEL, fuelAmount);
}
void addVehicleCoolant(float coolantAmount)
{
vehicle.Fill(CarFluid.COOLANT, coolantAmount);
}
void addVehicleComponents()
{
vehicle.GetInventory().CreateAttachment("Hatchback_02_Wheel");
vehicle.GetInventory().CreateAttachment("Hatchback_02_Wheel");
vehicle.GetInventory().CreateAttachment("Hatchback_02_Wheel");
vehicle.GetInventory().CreateAttachment("Hatchback_02_Wheel");
vehicle.GetInventory().CreateAttachment("CarBattery");
vehicle.GetInventory().CreateAttachment("CarRadiator");
vehicle.GetInventory().CreateAttachment("SparkPlug");
vehicle.GetInventory().CreateAttachment("Hatchback_02_Door_1_1");
vehicle.GetInventory().CreateAttachment("Hatchback_02_Door_1_2");
vehicle.GetInventory().CreateAttachment("Hatchback_02_Door_2_1");
vehicle.GetInventory().CreateAttachment("Hatchback_02_Door_2_2");
vehicle.GetInventory().CreateAttachment("Hatchback_02_Hood");
vehicle.GetInventory().CreateAttachment("Hatchback_02_Trunk");
}
}
init.c
CreateVehicle myHatchback = new CreateVehicle("Hatchback_02","575.151001 5.839860 1735.019287");
CreateVehicle myHatchback2 = new CreateVehicle("Hatchback_02","575.151001 5.839860 1735.019287");
This creates the car but for every car i make, i have to name it car1,car2, car3 etc however many times i want them to spawn. So im looking for a way to spawn 3 different vehicle types and just assign whichever type to a certain spawn point. Obviously i still want to be able to spawn them full of parts like the above code.