Blockland Forums > Modification Help
Two questions about eraly fuel mod. How to package for all types, how to stop?
(1/1)
DrenDran:
An early example of a fuel mod I decided to make:

--- Code: ---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);
}

--- End code ---
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.
lordician:

--- Quote from: DrenDran on November 07, 2010, 02:02:31 PM ---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.

--- End quote ---
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...
DrenDran:

--- Quote from: lordician on November 07, 2010, 04:54:14 PM ---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...

--- End quote ---
Wheeled vehicles only wouldn't both me, espically if I can duplicate it for flyingwheeledvehicldata.
Navigation
Message Index

Go to full version