Code: [Select]
//IN_22 is for the Counter or ValuePrint object
/////////////////////////////////////////////////////////////////////////
///////////////Suspension Air Bag Script/////////////////////////////
/////////////////////////////////////////////////////////////////////////
int MAX_AXLE_TORQUE_FRONT = 100;
int SUSPENSION_TRAVEL_FRONT = 6;
int SUSPENSION_TARGET_FRONT = 7;
//////////////////////////////////////////////////////
int MAX_AXLE_TORQUE_REAR = 100;
int SUSPENSION_TRAVEL_REAR = 106;
int SUSPENSION_TARGET_REAR = 107;
//////////////////////////////////////////////////////
int MAX_CAR_SPEED = 200;
int CENTER_OF_MASS_OFFSET_Y = 205;
////////////////////////////////////////////////////////////////////////
float V4 = 0.02;////the amount time for the supsension travel to lower//
//value the longer it takes for the car to lower it's suspension travel/
//don't know why it works like that.////////////////////////////////////
////////////////////////////////////////////////////////////////////////
float V1 = 1.5f/60f;
float V2 = V4;
float V3 = V2;
//////////////////////////////////////////////////////
void Main()
{
VAL_1 = 77 + V3*900;
iObjectParamSet(OBJ_0,CENTER_OF_MASS_OFFSET_Y,-0.7 - IN_22*0.004);
///////////////////////////////////////////////////////////////
if (iInitializing())
{
V3= V1;
//////////////////////////////////////////////////////
}
if (iKeyDown(iKeyCode("DIK_End")))
{
V3 = iFloatTendTo(V3,V1,-0.07,V2,0);
//////////////////////////////////////////////////////
iObjectParamSet(OBJ_0,MAX_CAR_SPEED,160*V3*0.5);
iObjectParamSet(OBJ_0,MAX_AXLE_TORQUE_FRONT,1);
iObjectParamSet(OBJ_0,MAX_AXLE_TORQUE_REAR,1);
iObjectParamSet(OBJ_0,SUSPENSION_TRAVEL_FRONT,0.71 + V3);
iObjectParamSet(OBJ_0,SUSPENSION_TRAVEL_REAR,0.71 + V3);
iObjectParamSet(OBJ_0,SUSPENSION_TARGET_FRONT,0.01 + V3);
iObjectParamSet(OBJ_0,SUSPENSION_TARGET_REAR,0.01 + V3);
}
else if (iKeyDown(iKeyCode("DIK_Home")))
{
V3 = iFloatTendTo(V3,-0.07,V1,V2,0);
//////////////////////////////////////////////////////
iObjectParamSet(OBJ_0,MAX_CAR_SPEED,160*V3*50);
iObjectParamSet(OBJ_0,MAX_AXLE_TORQUE_FRONT,0.5);
iObjectParamSet(OBJ_0,MAX_AXLE_TORQUE_REAR,0.5);
iObjectParamSet(OBJ_0,SUSPENSION_TRAVEL_FRONT,0.71 + V3);
iObjectParamSet(OBJ_0,SUSPENSION_TRAVEL_REAR,0.71 + V3);
iObjectParamSet(OBJ_0,SUSPENSION_TARGET_FRONT,0.01 + V3);
iObjectParamSet(OBJ_0,SUSPENSION_TARGET_REAR,0.01 + V3);
}
}
Here is a script I put together that lets a cars suspensions riser/lower by pressing home or end.it obviously works while the car is idle or while it's moving and no need to reset the car just to have the changes to be applied.