[TUTORIAL] Deployable bike. {1.7.7.1}

after many test, I think something is wrong on ur code:

Code:
// PLAYER2 BIKE DEPLOY
if((speed player <= 1) && _hasToolbox && _canDo) then {
if (s_player_deploybike < 0) then {
s_player_deploybike = player addaction[('"<t color="'"#007ab7"'">" + ("Deploy Bike") +"</t>");,"bike\deploy.sqf","'",5,false,true,"", "'"]
};
} else {
player removeAction s_player_deploy;
s_player_deploybike = -1;
};

... because no metter how, where and when I paste this, selfactions will stop working .
 
I've got "deploy bike" option to show up with this:
Code:
if ("PartGeneric" in _mags) then {
        hasBikeItem = true;
    } else { hasBikeItem = false;};
    if((speed player <= 1) && hasBikeItem && _canDo) then {
        if (s_player_deploybike < 0) then {
            s_player_deploybike = player addaction[("<t color=""#c70000"">" + ("Deploy bike") +"</t>"),"Scripts\deploy.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_deploybike;
        s_player_deploybike = -1;
    };
But I cant get the bike to spawn. PLAYER2's deploy.sqf won't work. I've tried something like this:
Code:
if (dayz_combat == 1) then {
cutText [format["You are in combat and cannot build a bike."'], "PLAIN DOWN"];
} else {
 
player removeAction s_player_deploybike;
player playActionNow "Medic";
r_interrupt = false;
player removeMagazine "PartGeneric";
 
sleep 6;
 
_object = createVehicle ["Old_bike_TK_INS_EP1", [0,0,0], [], 0, "CAN_COLLIDE"];
_object setVariable ["ObjectUID",""];
 
player reveal _object
 
cutText [format["You have used your scrap metal to build a bike!"], "PLAIN DOWN"];
 
r_interrupt = false;
player switchMove "";
player playActionNow "stop";
 
sleep 10;
 
cutText [format["Warning: This bike will be deleted on next restart!"], "PLAIN DOWN"];
 
};
Not working tho..
 
I've got "deploy bike" option to show up with this:
Code:
if ("PartGeneric" in _mags) then {
        hasBikeItem = true;
    } else { hasBikeItem = false;};
    if((speed player <= 1) && hasBikeItem && _canDo) then {
        if (s_player_deploybike < 0) then {
            s_player_deploybike = player addaction[("<t color=""#c70000"">" + ("Deploy bike") +"</t>"),"Scripts\deploy.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_deploybike;
        s_player_deploybike = -1;
    };
But I cant get the bike to spawn. PLAYER2's deploy.sqf won't work. I've tried something like this:
Code:
if (dayz_combat == 1) then {
cutText [format["You are in combat and cannot build a bike."'], "PLAIN DOWN"];
} else {
 
player removeAction s_player_deploybike;
player playActionNow "Medic";
r_interrupt = false;
player removeMagazine "PartGeneric";
 
sleep 6;
 
_object = createVehicle ["Old_bike_TK_INS_EP1", [0,0,0], [], 0, "CAN_COLLIDE"];
_object setVariable ["ObjectUID",""];
 
player reveal _object
 
cutText [format["You have used your scrap metal to build a bike!"], "PLAIN DOWN"];
 
r_interrupt = false;
player switchMove "";
player playActionNow "stop";
 
sleep 10;
 
cutText [format["Warning: This bike will be deleted on next restart!"], "PLAIN DOWN"];
 
};
Not working tho..


the deploy bike was really a good idea, sad it dosent work :(
 
I got it to work except one big problem. The bike deploys\repacks as I want it to. The problem is when I get on the bike it kills me.
 
Neither of the drop box links work.

Not that I would ever want to do it that way. Does anyone have a WORKING version of player2 post.
 
Got this working. You will need a custom self-actions for this to work.

In your mission.pbo, inside a folder called 'fixes', create a file called deploybike.sqf and insert the following code:

Code:
if (dayz_combat == 1) then {
cutText [format["You are in Combat and cannot build a bike."], "PLAIN DOWN"];
} else {
private ["_object"];
player removeAction s_player_deploybike;
player playActionNow "Medic";
r_interrupt = false;
player removeWeapon "ItemToolbox";
player removeMagazine "PartGeneric";
_dis=10;
_sfx = "repair";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
sleep 6;
 
_object = createVehicle ["Old_bike_TK_INS_EP1", position player,[],0,"CAN_COLLIDE"];
_object setVariable ["ObjectID", "1", true];
_object setVariable ["ObjectUID", "1", true];
 
player reveal _object
 
cutText [format["You've used your toolbox to build a bike!"], "PLAIN DOWN"];
 
r_interrupt = false;
player switchMove "";
player playActionNow "stop";
 
sleep 10;
 
cutText [format["Warning: Spawned Bikes do not save after server restart!"], "PLAIN DOWN"];
 
};

In your self-actions, under the self-bloodbag action, insert the following:

Code:
if (("PartGeneric" in _mags) && _hasToolbox ) then {
        hasBikeItem = true;
    } else { hasBikeItem = false;};
    if((speed player <= 1) && hasBikeItem && _canDo) then {
        if (s_player_deploybike < 0) then {
            s_player_deploybike = player addaction[("<t color=""#c70000"">" + ("Deploy bike") +"</t>"),"fixes\deploybike.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_deploybike;
        s_player_deploybike = -1;
};

If you are using anti-hacks, insert 's_player_deploybike ' into your exceptions.
 
I should have stated before that I am running Overwatch. Is there a way to load a custom compiles without overrunning the overwatch scripts.

I tried this method before and found that self bloodbag - which is in the overwatch code (not sure where) - does not work.

Also how do I go about calling upon the fn_selfActions.sqf properly, it is in the init.sqf or it has to be within the custom compiles?
 
I got it to work except one big problem. The bike deploys\repacks as I want it to. The problem is when I get on the bike it kills me.


I'm also having this problem. There seems to be some clues from Dami, but not quite sure how to implement the changes ... Are there any clues or places to look at to get this going? I've got a private hive server running with Dayz control center and have implemented a bunch of features already, like debug monitor etc. etc.

Was really hoping to get the deployable bike going so that it is similar to the au46 server that has this feature ...

Any help would be appreciated, even if it's stuff to read to to get there ...
 
I should have stated before that I am running Overwatch. Is there a way to load a custom compiles without overrunning the overwatch scripts.

I tried this method before and found that self bloodbag - which is in the overwatch code (not sure where) - does not work.

Also how do I go about calling upon the fn_selfActions.sqf properly, it is in the init.sqf or it has to be within the custom compiles?


have two lines one for the original and one for the custom. Mines is

Code:
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";  //Compile regular functions
call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile custom compiles


Could someone tell me how to change this to gyro copter and bicycle with gyro only needing rotar and engine and can upgrade the bicycle to motorbike if you have engine parts.
 
anyone can help me to fix this death bike issue? what do I need to do to make my character not die after entering self deployed bike? please help me! T_T
 
To do deployable bikes on grab your fn_selfactions.sqf and add this below the _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLader);

Code:
if((speed player <= 1) && cursorTarget isKindOf "Old_bike_TK_CIV_EP1" && _canDo) then {
if (s_player_deploybike2 < 0) then {
        s_player_deploybike2 = player addaction[("<t color=""#007ab7"">" + ("Re-Pack Bike") +"</t>"),"spawnbike\bike2.sqf","",5,false,true,"", ""];
    };
} else {
    player removeAction s_player_deploybike2;
    s_player_deploybike2 = -1;
};
 
if((speed player <= 1) && _hasToolbox && _canDo) then {
    if (s_player_deploybike < 0) then {
        s_player_deploybike = player addaction[("<t color=""#007ab7"">" + ("Deploy Bike (will loose Toolbox)") +"</t>"),"spawnbike\bike.sqf","",5,false,true,"", ""];
    };
} else {
    player removeAction s_player_deploybike;
    s_player_deploybike = -1;
};

make sure to make a spawnbike folder inside the mission pbo and make a
bike.sqf and a bike2.sqf here is the links to what you need to put in
the .sqf's, as well as change the call in compiles for the
fn_selfActions.sqf

bike.sqf
Code:
if (dayz_combat == 1) then {
    cutText [format["You are in Combat and cannot build a bike."], "PLAIN DOWN"];
} else {
        player removeAction s_player_deploybike;
        player playActionNow "Medic";
        r_interrupt = false;
        player removeWeapon "ItemToolbox";
        _dis=10;
        _sfx = "repair";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
   
        sleep 6;
   
        _object = "Old_bike_TK_CIV_EP1" createVehicle (position player);
        _object setVariable ["ObjectID", "1", true];
        _object setVariable ["ObjectUID", "1", true];
   
        _object attachto [player,[0.0,3.0,0.5]];
        sleep 3;
        detach _object;
        player reveal _object;
 
        cutText [format["You've used your toolbox to build a bike."], "PLAIN DOWN"];
   
        r_interrupt = false;
        player switchMove "";
        player playActionNow "stop";
   
        sleep 10;
   
        cutText [format["Warning: Spawned Bikes DO NOT SAVE after server restart!"], "PLAIN DOWN"];
bike2.sqf
Code:
if (dayz_combat == 1) then {
    cutText [format["You are in Combat and cannot re-build your bike."], "PLAIN DOWN"];
} else {
        player removeAction s_player_deploybike2;
        player playActionNow "Medic";
        r_interrupt = false;
        player addWeapon "ItemToolbox";
        deletevehicle cursortarget;
        _dis=10;
        _sfx = "repair";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
   
        sleep 6;
   
        cutText [format["You have packed your bike and been given back your toolbox"], "PLAIN DOWN"];
   
        r_interrupt = false;
        player switchMove "";
        player playActionNow "stop";
};
 
To do deployable bikes on grab your fn_selfactions.sqf and add this below the _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLader);

Code:
if((speed player <= 1) && cursorTarget isKindOf "Old_bike_TK_CIV_EP1" && _canDo) then {
if (s_player_deploybike2 < 0) then {
        s_player_deploybike2 = player addaction[("<t color=""#007ab7"">" + ("Re-Pack Bike") +"</t>"),"spawnbike\bike2.sqf","",5,false,true,"", ""];
    };
} else {
    player removeAction s_player_deploybike2;
    s_player_deploybike2 = -1;
};
 
if((speed player <= 1) && _hasToolbox && _canDo) then {
    if (s_player_deploybike < 0) then {
        s_player_deploybike = player addaction[("<t color=""#007ab7"">" + ("Deploy Bike (will loose Toolbox)") +"</t>"),"spawnbike\bike.sqf","",5,false,true,"", ""];
    };
} else {
    player removeAction s_player_deploybike;
    s_player_deploybike = -1;
};

make sure to make a spawnbike folder inside the mission pbo and make a
bike.sqf and a bike2.sqf here is the links to what you need to put in
the .sqf's, as well as change the call in compiles for the
fn_selfActions.sqf

bike.sqf
Code:
if (dayz_combat == 1) then {
    cutText [format["You are in Combat and cannot build a bike."], "PLAIN DOWN"];
} else {
        player removeAction s_player_deploybike;
        player playActionNow "Medic";
        r_interrupt = false;
        player removeWeapon "ItemToolbox";
        _dis=10;
        _sfx = "repair";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
        sleep 6;
 
        _object = "Old_bike_TK_CIV_EP1" createVehicle (position player);
        _object setVariable ["ObjectID", "1", true];
        _object setVariable ["ObjectUID", "1", true];
 
        _object attachto [player,[0.0,3.0,0.5]];
        sleep 3;
        detach _object;
        player reveal _object;
 
        cutText [format["You've used your toolbox to build a bike."], "PLAIN DOWN"];
 
        r_interrupt = false;
        player switchMove "";
        player playActionNow "stop";
 
        sleep 10;
 
        cutText [format["Warning: Spawned Bikes DO NOT SAVE after server restart!"], "PLAIN DOWN"];
bike2.sqf
Code:
if (dayz_combat == 1) then {
    cutText [format["You are in Combat and cannot re-build your bike."], "PLAIN DOWN"];
} else {
        player removeAction s_player_deploybike2;
        player playActionNow "Medic";
        r_interrupt = false;
        player addWeapon "ItemToolbox";
        deletevehicle cursortarget;
        _dis=10;
        _sfx = "repair";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
        sleep 6;
 
        cutText [format["You have packed your bike and been given back your toolbox"], "PLAIN DOWN"];
 
        r_interrupt = false;
        player switchMove "";
        player playActionNow "stop";
};


the entire above's script does work, however after I spawn the bike and I ride it on it as driver it kills me instantly, any idea how to fix that? :'(
 
If you guys are also running Sarge AI you could try setting the variable it spawns with to Sarge instead:

Change this:

Code:
 _object = "Old_bike_TK_CIV_EP1" createVehicle (position player);
        _object setVariable ["ObjectID", "1", true];
        _object setVariable ["ObjectUID", "1", true];

to this:

Code:
 _object = "Old_bike_TK_CIV_EP1" createVehicle (position player);
        _object setVariable ["Sarge", "1", true];

Assuming you have your server_updateObject.sqf and server_cleanup.fsm edited to deal with Sarge AI I don't see why that wouldn't work with this as well.
 
Back
Top