Jump to content

[Release] Mission vehicles warning + Bicycle handbrake


Sandbird

Recommended Posts

Mission vehicles warning + Bicycle handbrake

This little tweak does 2 things that i think are useful for any server that has the Deploy bike script, Missions and Mountains :P
Got the idea when i was looting a barrack, and on the back wall, there was a body next to a bike, under a big mountain, lol. He obviously couldn't slow down and ended up crashing there.
 
So what this script does in short is:
- It Informs the players that the vehicle they entered will not be saved on the map if its a Mission vehicle, so they know not to horde it at their base with the rest of their vehicles.
- (Optional) Checks if a player is on a bike (mountain bike in this case) and allow him to handbrake when his speed is over 20.

  From 120 m/h i went to 0 in 2 seconds.
  Both messages are shown on side chat...as a system message.

Now why did i add both scripts under the same script ? To save me an extra while loop...You can separate them if you want.
 
Setup

  • Download the files and put them in your mission file inside folder \custom      Click Here
  • Open your init.sqf
    At the bottom add:
    _null = [] execVM "custom\sanddzai.sqf";
  • Open both files with an editor. There are 2 things you have to change here according to your mission files.
    I use DZAI variable for my mission spawned vehicles, so i have:
    _vehicleDZAI = vehicle player getVariable ["DZAI",0];
    If your mission spawned vehicles have a different value (like Mission, or Sarge), then replace my "DZAI" with your value.

    Also i use the MMT_Civ bike model when i Deploy a bike. If you are using the Old_bike_TK_CIV_EP1 or whatever, then replace the "MMT_Civ" values with your classname, in both files!
     
  • If you dont want the handbreak option, then delete this from sanddzai.sqf and remove the file.
    if (_inVehicle and (typeOf(_vehicle) == "MMT_Civ")) then {
    	_null = [_vehicle] execVM "custom\sandbreak.sqf";
    };
    

Troubleshooting
 
If your Mission vehicles dont have that extra variable on them (DZAI), then the script wont recognize them as mission vehicles and show the message to the players. What you have to do is open your mission files in your dayz_server folder and find where it creates Vehicles for the missions.
It should look something like:

_veh  = createVehicle [_vehclass,_position, [], 0, "CAN_COLLIDE"];

All you have to do is under that line add:

_veh setVariable ["DZAI",1,true]; 

Notice the 1 doesnt have " " like DZAI has.
This is how i check for mission vehicles. If you have quotes (like "1"), then you have to do the same with my files as well and add the extra quotes when i do, getVariable DZAI !!!!!!!
 
Thats it...enjoy

Link to comment
Share on other sites

thankz for the share.

now if we could only get reverse on planes....

 

hmmm i think thats pretty easy thing to do. Its just a different check, like instead of MMT_CIV, to make an array of all the planes you use in the server and do a :

_vehicle = vehicle player;
_planes = ["plane1", "plane2"];
_altimeter = getPosATL _vehicle;
if ((typeOf(_vehicle) in _planes) and (_altimeter >=0 and _altimeter <= 2)) then {
    _null = [_vehicle] execVM "custom\reverse.sqf";
};

my guess is the height is between 0-2 ...depending on the plane....maybe i am wrong...and its between 0 - 1.

 

Then in your reverse.sqf you copy/paste my sandbreak.sqf script and just change :

_vehicle SetVelocity [(velocity _vehicle select 0) * 0.95, (velocity _vehicle select 1) *0.95, (velocity _vehicle select 2) * 0.98];

to 

_curspeed = speed _vehicle;
_vel = velocity _vehicle;
_dir = direction _vehicle;
_speed = -10; //like a fixed speed so it doesnt accelerate
_vehicle setVelocity [(_vehicle select 0)-((sin _dir)*_speed),(_vel select 1)- ((cos _dir)*_speed),(_vel select 2)];

I could be wrong on the last one here...basically you set a speed and reverse it...and keep the direction and other velocities intact.

Link to comment
Share on other sites

trying to make an array of bike but its not working

 

_bikes = ["MMT_Civ", "MMT_USMC", "Old_bike_TK_CIV_EP1 ", "Old_bike_TK_INS_EP1"];

 

if (_inVehicle and (typeOf(_vehicle) in _bikes)) then {

 

if(isServer)exitwith{};

waitUntil {sleep 1; !isNil ("PVDZE_plr_LoginRecord") };

while {true} do {

private ["_vehicle","_inVehicle","_vehicleDZAI"];
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_vehicleDZAI = vehicle player getVariable ["DZAI",0];
_bikes = ["MMT_Civ", "MMT_USMC", "Old_bike_TK_CIV_EP1 ", "Old_bike_TK_INS_EP1"]; 
if (!(_vehicle == player ) && (_vehicleDZAI == 1)) then {
systemChat ("Temporary vehicle. (It wont be saved on server restart)");  //If he is in a mission vehicle
};

if (_inVehicle and (typeOf(_vehicle) in _bikes)) then {
//if (_inVehicle and (typeOf(_vehicle) == "MMT_USMC")) then {
_null = [_vehicle] execVM "custom\sandbreak.sqf";
};

// He is not in a vehicle
while {!(vehicle player == player)} do {
sleep 3;
};

sleep 2;
};

any ideas whats wrong with this ??

Link to comment
Share on other sites

If you take a mission vehicle and the mission system is configured not to write the vehicle to the database, there is already a message that tells you the vehicle will despawn on restart.

 

Depending the mission system you use. I dont have that with WAI, didnt have it with Sarge either.....but anyways..the whole post was for the bike really....I decided to place it in that while loop and then thought why not give that one as well.

If you want just use the bike script

Link to comment
Share on other sites

 

trying to make an array of bike but its not working

 

_bikes = ["MMT_Civ", "MMT_USMC", "Old_bike_TK_CIV_EP1 ", "Old_bike_TK_INS_EP1"];

 

if (_inVehicle and (typeOf(_vehicle) in _bikes)) then {

 

if(isServer)exitwith{};

waitUntil {sleep 1; !isNil ("PVDZE_plr_LoginRecord") };

while {true} do {

private ["_vehicle","_inVehicle","_vehicleDZAI"];
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_vehicleDZAI = vehicle player getVariable ["DZAI",0];
_bikes = ["MMT_Civ", "MMT_USMC", "Old_bike_TK_CIV_EP1 ", "Old_bike_TK_INS_EP1"]; 
if (!(_vehicle == player ) && (_vehicleDZAI == 1)) then {
systemChat ("Temporary vehicle. (It wont be saved on server restart)");  //If he is in a mission vehicle
};

if (_inVehicle and (typeOf(_vehicle) in _bikes)) then {
//if (_inVehicle and (typeOf(_vehicle) == "MMT_USMC")) then {
_null = [_vehicle] execVM "custom\sandbreak.sqf";
};

// He is not in a vehicle
while {!(vehicle player == player)} do {
sleep 3;
};

sleep 2;
};

any ideas whats wrong with this ??

 

 

You are not declaring _bikes inside private...should be :

private ["_vehicle","_inVehicle","_vehicleDZAI","_bikes"];

And ps...did you check your client log file at : C:\Users\YOURPROFILE\AppData\Local\ArmA 2 OA\Arma2oa.RPT   first?

Always check that file when you are adding code to see if you've made any mistakes.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...