Author Topic: Two questions about eraly fuel mod. How to package for all types, how to stop?  (Read 370 times)

An early example of a fuel mod I decided to make:
Code: [Select]
function StopVehicleCheck(%this,%obj)
{
if(!isObject(%obj))
return;
if(!%obj.nofuelstop)
return;
if(%obj.fuel > 1)
{
%obj.nofuelstop = 0;
return;
}

%obj.setVelocity("0 0 0");

Schedule(50,0,StopVehicleCheck,%this,%obj);
}

function FuelCheck(%this, %obj)
{
if(!isObject(%obj))
return;
%speed = vectorLen(%obj.getVelocity());
schedule(500,0,"FuelCheck",%this,%obj);
if(%speed < 1 || %obj.GetControllingClient() == 0)
return;

if(%obj.fuel > 0)
%obj.fuel--;
else
{
%obj.nofuelstop = true;
StopVehicleCheck(%this,%obj);
}
}

function JeepVehicle::onadd(%this, %obj)
{
echo("Made a vehicle.");
Parent::onadd(%this,%obj);
%obj.fuel = 25;
FuelCheck(%this, %obj);
}
How do I replace JeepVehicle with something that's generic for all vehicle types?
Any better way of stopping/slowing-down a vehicle than constantly setting it's velocity to 0?

This needs more work than that, but I can't go much farther until I get these questions answered.
Thanks for potential help.

An early example of a fuel mod I decided to make:
How do I replace JeepVehicle with something that's generic for all vehicle types?
Any better way of stopping/slowing-down a vehicle than constantly setting it's velocity to 0?

This needs more work than that, but I can't go much farther until I get these questions answered.
Thanks for potential help.
When you want to replace JeepVehicle with Vehicle you will be wanting to overwrite the default script, thus you have to package it.
You will have to replace JeepVehicle with WheeledVehicleData to make it work.
Before you say, isn't that only for wheeled vehicles, i dunno.
I guess so, but you could try.

Stopping a vehicle without constantly setting velocity...
I don't know...

When you want to replace JeepVehicle with Vehicle you will be wanting to overwrite the default script, thus you have to package it.
You will have to replace JeepVehicle with WheeledVehicleData to make it work.
Before you say, isn't that only for wheeled vehicles, i dunno.
I guess so, but you could try.

Stopping a vehicle without constantly setting velocity...
I don't know...
Wheeled vehicles only wouldn't both me, espically if I can duplicate it for flyingwheeledvehicldata.