Jump to content

Sign in to follow this  
TeaDrinker

Speed Bump damage

Recommended Posts

Hello,

I'm attempting to create a speed bump that will effectively degrade the vehicles health if driven over at a certain speed (High speed), I've attempting adding a block of geometry to try and smash the wheel agenst it but the wheels on ArmA 3 just bounce right over it, any other way I could get a bit of damage on the car & slow the vehicle down too?

Thanks

Edited by TeaDrinker

Share this post


Link to post
Share on other sites

You could do something like this, which would damage you everytime you drove over a "Land_HelipadEmpty_F" faster than 5km/h

_speedBumpObjects = ["Land_HelipadEmpty_F"];      //Array of objects to search for
_maXingSpeed = 5;                                 //max crossing speed in km/h

//loop to run
while {true} do
{
//Checks
_vehicle = vehicle player;                //Object player is in or player object if they are not in one
_isInVehicle = (_vehicle != player);      //true when vehicle object is not equal to player object (ie unit inside of vehicle)
_isDriver = (driver _vehicle == player);  //driver returns the driver of the vehicle or the player if they are not in one. 
//expression
if(_isInVehicle)&&(_isDriver) then
{
            _speedBumps = nearestObjects [player,_speedBumpObjects,1];
                   if((speed _vehicle > _maXingSpeed) && (count _speedBumps > 0) ) then {
                       setdamage _vehicle ( (damage _vehicle) + 0.01);
                   };
            };
sleep 0.1;
};

That would all go inside of a file like speedbumps.sqf and then it would be called from your main script like:

if !(isServer) then {
[] execvm "speedbumps.sqf";
};

Alternativly you can create an evently handler than triggers when the player enters a vehicle to launch this script, then another that kills it when the player exits the script, however my lunch is over so that is outside the scope of my reply.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×