Jump to content

[Release] Personal Player Bike v0.1 / v0.2


jahangir13

Recommended Posts

After switching from Chernarus to Napf I've created a simple script on player demand for our server. Maybe someone finds it useful, so I release it here.

 

It allows a player to pack / unpack a bike on demand to be able to make larger distances a bit quicker. No items are needed for crafting or deploying the bike. It's just there to make things a bit easier.

The bike is bound to the PlayerUID, so only the player who unpacked the bike can pack it again.

 

http://youtu.be/lG4j80qUDlc

 

The video shows how it works (early stage...looks a bit different now). Link to the script is in the video description (installation instructions are placed inside the script...so where they are needed).

 

You get killed on the bike if you do not add the _classname to variables.sqf or elsewhere to the array:

DZE_safeVehicle = ["ParachuteWest","ParachuteC"];

 

So: DZE_safeVehicle = ["ParachuteWest","ParachuteC","MMT_USMC" ];

 

For battleye script restriction kicks:

Add this:

!="_bike setVariable[\"Ownername\", _playeruid, true];"

at the end of the setDammage line, like:

5 "setDammage" !="_bike setVariable[\"Ownername\", _playeruid, true];"

.

.

Changelog v0.2 (10.12.2014):

- Some performance improvements (e.g. short hang at first use)

- Player now hops directly onto the bike as driver after unpacking

 

Link to Script v0.2:

http://pastebin.com/2NnAP6eR

Link to comment
Share on other sites

Ah yes. I guess you need to add the bike classname into allowedvehicles_dze . I need to add this when i am back from work.

 

@SadBoy1981: I do not get the battleye script restriction. Can you go to your script.log in your Battleye directory on the server and post me the logged line to see for what it happened (after getting kicked...you will see your name there and the reason why you got kicked)).

And also the line which it belongs to in script.txt? Restriction #52 means line 52 is responsible for the kick (this starts with a 5). So you count from 0 on (first line is 0) and leave out any commented lines ( // ).

We can then add a excemption for the line which kicks you. As I do not get the kick, I don't know exactly what it is.

Link to comment
Share on other sites

Ah yes. I guess you need to add the bike classname into allowedvehicles_dze . I need to add this when i am back from work.

 

@SadBoy1981: I do not get the battleye script restriction. Can you go to your script.log in your Battleye directory on the server and post me the logged line to see for what it happened (after getting kicked...you will see your name there and the reason why you got kicked)).

And also the line which it belongs to in script.txt? Restriction #52 means line 52 is responsible for the kick (this starts with a 5). So you count from 0 on (first line is 0) and leave out any commented lines ( // ).

We can then add a excemption for the line which kicks you. As I do not get the kick, I don't know exactly what it is.

22.10.2014 12:44:32: F_R_O_S_T (127.0.0.1:2404) 72d8db75855762483ae16f2f031624f6 - #52 "ername", _playeruid, true];

if (_keepDamage) then {
_bike setDammage s_bikeDamage;
};
_positionBike = player modelToWorld _dist"

scripts.txt

//new
5 "dedicatedServerInterface"
5 "set' + 'Damage"
5 "\"Logic\" createUnit _array;"
5 "hint \"Server Anti-Hack is OFF. Rejoin Server Now\";"
5 "[6300,7700,0]"
5 "group (" !"_mygrp = group ("
5 ", 27000"
1 "Sound_Alarm"
5 "Sound_Alarm2"
5 "val = [.1,1.5,.2]"
5 "BoxObject"
5 "dafonz"
5 "_fonzy"
5 "_troll"
5 "_sharky"
5 "Phonza"
5 "gible"
5 "nice antihack"
5 "\"Bo\"+\"_FAB\"+\"_250\""
5 "\"B\"+\"o\"+\"_\"+\"F\"+\"A\"+\"B\"+\"_\"+\"2\"+\"5\"+\"0\""
5 "_x setDamage 1"
5 "nearestObjects [[6325.6772,7807.7412]"
5 "createVehicleLocal _fck"
5 "\"HelicopterExplobig\", \"HelicopterExploSmall\""
5 "\"HelicopterExplobig\",\"HelicopterExploSmall\""
5 "\"HelicopterExploSmall\", \"HelicopterExplobig\""
5 "\"HelicopterExploSmall\",\"HelicopterExplobig\""
5 "_classname = \"HelicopterExploBig\";"
5 "_fck select"
5 "BattleFieldClearance"
5 "_codeAHOFF"
5 "_first in"
5 "_commands"
5 "_agent setDamage 1"
5 "_unit createUnit"
5 "createUnit _array"
5 "[_pos, _grp, \";\" +"
5 "+ \";\""
5 "+\";\""
5 "+ \";\"]"
5 "+\";\"]"
5 "], \"Logic\"]"
5 "],\"Logic\"]"
5 "closeDisplay ="
5 "{rJIPREQUEST" !"!isNil {rJIPREQUEST}"
5 "RUSTLER"
5 "Ruslter"
5 "Systems Online"
5 "HangenderRE"
5 "vilegaming"
5 "v.i.l.e"
5 "Lystic"
5 "setDammage"
5 "compile toString"
5 "@TheWarZ"
5 "beeeh"
5 "dayz-injector-menu"
5 "Shadowy_NONRE"
5 "_cute"
5 "_stuff"
5 "_vgmenu"
5 "_func4"
5 "_genVar"
5 "_rand60"
5 "_first_term"
5 "_skarmory"
5 "_salamence"
5 "Init RE"
5" Nigger"
5 "\"You\""
5 "selectedItemCountLeft = lnbText"
5 "[[\"Man\",\"Air\",\"Car\",\"Motorcycle\",\"Tank\",\"Ship\",\"StaticWeapon\"],250000]"
5 "action_crate1"
5 "_dummyveh"
5 "], 40000])"
5 "(getPosATL player) nearObjects [\"Man\", 200];"
5 "(nearestObject [player, \"Rabbit\"])"
5 "try saving"
5 "addMagazineCargoGlobal[\"ItemSilverBar\",50];"
5 "addMagazineCargoGlobal[\"ItemSilverBar10oz\",50];"
5 "addMagazineCargoGlobal[\"ItemGoldBar\",50];"
5 "addMagazineCargoGlobal[\"ItemGoldBar10oz\",50];"
5 "addMagazineCargoGlobal[\"ItemBriefcase100oz\",50];"
5 "addMagazineCargoGlobal[\"ItemSilverBar\",500];"
5 "addMagazineCargoGlobal[\"ItemSilverBar10oz\",500];"
5 "addMagazineCargoGlobal[\"ItemGoldBar\",500];"
5 "addMagazineCargoGlobal[\"ItemGoldBar10oz\",500];"
5 "addMagazineCargoGlobal[\"ItemBriefcase100oz\",500];"
5 "rJIPrequest =" !"rJIPrequest = 'JIPrequest'"
5 "(createGroup sideLogic)"
5 "_g = createGroup sidelogic;"
5 "_u = _g createUnit ["
5 "_u = _g createUnit [\"Fun\"+\"ctions\"+\"Man\"+\"ager\",[0,0,0],[],0,\"NONE\"];"
5 "_MissionZBoar"
5 "join _Editor;"
5 "_Editor ="
5 "\"F\"+\"u\"+\"n\"+\"c\"+\"t\"+\"i\"+\"o\"+\"n\"+\"s\"+\"M\"+\"a\"+\"n\"+\"a\"+\"g\"+\"e\"+\"r\""
5 "Fun\"+\"ctions\"+\"Man\"+\"ager"
5 "allmissionobjects 'FunctionsManager'"
5 "allmissionobjects \"FunctionsManager\""
5 "], \"FunctionsManager\"]"
5 "],\"FunctionsManager\"]"
5 "\"Functions\" + \"Manager\""
5="\"Manager\""
5="\"Fuck server\""
5="\"Rcon (run twice)\""
5 "'by Douggem'"
5 "taskHint ['Nuke incoming, take cover!',[1,0,0,1],'taskNew'];"
5 "taskHint ['Open your mouth my cock is going in',[1,0,0,1],'taskNew'];"
5 "taskHint ['LOL NICE ANTIHACK! Your shitty server just got fucked. Have a nice day!',[1,0.05,0.55,1],'taskNew'];"
5 "Nuke incoming, take cover!"
5 "Open your mouth my cock is going in"
5 "LOL NICE ANTIHACK! Your shitty server just got fucked. Have a nice day!"
5 "_epochGuard = (_epochGroup)"
5 "\"Fun\"+\"ctions\"+\"Man\"+\"ager\""
5 "'Hel'+'icopterE'+'xplobig'"
5 "\"Hel\"+\"icopterE\"+\"xploBig\""
5 "Spawned exploding sheep on all"
5 "create\"+\"Unit"
5 "dayz_spawnPos =" !"dayz_spawnPos = getPosATL player" !"dayz_spawnPos = _debugPos;"
5 "_newUnit = _class"
5 "_unit = _grp create\"+\"Unit [_type, _itemPos, _class];"
5 "_unit = _grp createUnit [_type, _itemPos, _class];"
5 "[_type, _itemPos, _class]"
5 "_engineered"
5 "[] spawn {player addMagazine"
5 "[] spawn {player addWeapon"
5 "_objectBB"
5 "_hitMemoryBB"
5 "Key [%1] added to inventory!"
5 "_object = \"Medbox0\" createVehicle (position player);"
5 "vehicle player addaction"
5 "respawn_west" !="getMarkerPos \"respawn_west\"" !="getMarkerpos 'respawn_west';"
5 "attachTo [_hitObjectBB"
5 "_DMG = 0; exitWith{};"
1 "player addweapon _result;"
1 "createVehicleLocal _position" !"_spawnveh createVehicleLocal _position" !="_point = \"Logic\" createVehicleLocal getPosATL _unit;" !="_tag = \"Sign_sphere10cm_EP1\" createVehicleLocal _position;"
1 "FunctionsManager" !="_logic = _group createUnit [\"FunctionsManager\", [0,0,0], [], 0, \"none\"];"
1 "\"+\""
1 "'+'"
1 "_grp" !"createGroup" !="BIS_OO_grpLogic" !="BIS_OO_grp"
1 "addweapon" !"\"addWeapon\"" !"='STR';" !"player addWeapon \"Loot\";" !"player addWeapon \"Flare\";" !"_item addWeaponCargoGlobal [_iItem,1];" !"player addWeapon _x" !"_qty" !"_itemOut" !"DZE_REPLACE_WEAPONS" !"_newUnit" !"raddWeapon" !"select _index" !"DEBUG TRADER CHANG MADE" !"_objWpnQty" !"_isOK" !"configName" !"_itemtodrop" !"player playActionNow \"Medic\";" !"_body addWeapon dayz_onBack;" !="CBA_fnc_addWeaponVerified" !="CBA_fnc_addWeapon" !="CBA_fnc_addWeaponCargo" !="CBA_fnc_addWeaponCargoGlobal" !="_item addWeaponCargoGlobal [_cwep,1];"
1 "addmagazine" !"\"addmagazine\"" !"='STR';" !"_swing';" !"_qty" !"_agent addMagazine _loot;" !"_itemOut" !"DZE_REPLACE_WEAPONS" !"_newUnit" !"raddMagazine" !"select _index" !"DEBUG TRADER CHANG MADE" !"_objWpnQty" !"_isOK" !"configName" !"_itemorignal" !"player addMagazine _canName" !"_itemtodrop" !"addMagazineTurret" !"BIS_fnc_invRemove" !"player addMagazine [\"Quiver\", _ammo];" !"player addMagazine _item;" !="CBA_fnc_addMagazineVerified" !="CBA_fnc_addMagazine" !="CBA_fnc_addMagazineCargo" !="CBA_fnc_addMagazineCargoGlobal" !="_zombiebody addMagazine \"ItemZombieParts\";" !="vehicle _obj addMagazine _mag;"
1 "createDialog" !"\"createDialog\"" !"='STR';" !"createdialog \"EpochDeathBoardDialog\";" !"createdialog \"TraderDialog\";" !"createdialog \"ComboLockUI\"" !"createdialog \"SafeKeyPad\";" !"createDialog \"RscDisplayGenderSelect\";" !"createDialog \"RscDisplaySpawnSelecter\";" !"createDialog 'RscDisplayCraftingMenu';"
1 "createDisplay" !"\"createDisplay\"" !"='STR';"
5 !="PV_requestServerunit"

Link to comment
Share on other sites

Hi,

 

you need to add this at the end of your scripts.txt battleye file:

 

!="_bike setVariable[\"Ownername\", _playeruid, true];"

 

So that it lokks like this:

5 "setDammage" !="_bike setVariable[\"Ownername\", _playeruid, true];"

 

I could now reproduce it with your scripts file.

Link to comment
Share on other sites

  • 2 weeks later...

If the player is im combat or unconscious is what I check in the script (you should not be able to unpack the bike if in combat or unconscious).

I got it once after I died and relogged. So I guess in this case the player should not be unconscious anymore. You can comment the line out if you don't want it there.

 

Never vanished or had a freeze so far, hm. If you have a look into your db. How many objects do you have with classname "MMT_USMC" ?

For the standard linux server I use you cannot buy this mountain bike at traders and they do not spawn automatically. Only other classnames. Therefore I've used this one. If there are a lot of these on your map...yes, it might take long.

 

What does 'vanish' mean exactly. You drive with the bike and then it's gone and you are on your feet again or is it invisible but you are still driving?

Link to comment
Share on other sites

I also had it twice today that the bike vanished. I guess this has nothing to do with the script...it's the same as with vaults which sometimes look ok and sometimes disappear. I am not sure if it#s the same.

Have a look at the small video: I am standing next to the bike and when I turn the player around a bit it's visible or completely invisible.

 

http://youtu.be/6x4zstrPIds

 

Maybe someone can explain what this is or if there's a way to fix this?

Link to comment
Share on other sites

There is :

 

player reveal _bike;

 

But not the next command after the createVehicle. First I set some variables, change pos and so on. After all of that I reveal it.

I was just not sure if I am doing something wrong here, but I guess it's as you said: something with texture or model for this classname (MMT_USMC).

 

It's something like this...so no scripting issue in your opinion? That's what I want to know ;)

http://forums.bistudio.com/showthread.php?146864-ArmA-2-LOD-stuttering-texture-flickering

 

With a Vault it's a bit different for me..it's sometimes badly to see nut it's there. The bike completely vanished as it can be seen in the video, hm.

Link to comment
Share on other sites

Lol, this one was a real performance killer. Doing the loop to check for an existing player bike in fn_selfAction was bullshit. To avoid that the menu action shows up if the bike has been already unpacked when player reloggs I did it this way (for what I should get banned from the forums^^).

 

I've updated the link in the video description to the corrected script (instructions are at the end of the file). I've also rearranged some other things (bike spawns into direction at time player looked when executing the command / quit the loop if personal bike has been found) and now it should work as intended.

 

I did not get the invisibility issue anymore. Let me know if that still occurs (or try to change _classname everywhere from "MMT_USMC" to "MMT_Civ" which might solve it...don't know why there are 2 classnames for the sae thing. There might be a reason ;) ).

Link to comment
Share on other sites

  • 4 weeks later...

what if you move this to a right click on radio or some other item then you dont have to do the whole loop check, and it also keeps your scroll wheel menu smaller and you wouldn't have to have any self action edits 

 

thanks for the script  :)

Link to comment
Share on other sites

@TNT: yuo can add it also to a right click option. It's just the way how it is called.

 

The loop I need to check if the player already has unpacked his/her bike. There are always different ways how things can be done, I wanted to avoid having too many bikes all over the map if people can unpack one after another.

So I have a look for any existing bike before letting the player unpack one.

Link to comment
Share on other sites

First of all I would like to thank you for this mod I’ve been looking for a basic deploy bike script to add to my server :)

 

I am having an issue with it though that is not described in the replies

Everything works when I log into server ...Unpack bike menu shows up and I can ride the bike and then pack the bike..

The issue is the option only lasts about 20 seconds or less then everything disappears :(

If the bike is unpacked or even if I am riding it, it disappears also the option to unpack or pack its all gone after about 20 seconds

 

Any help with this would be much appreciated..

Also a step by step installation guide would be awesome because the install guide for this is very vague and I spent allot of time trying to figure out what was supposed to be done and I’m not exactly sure I’ve done all the steps correctly

 

Thanks in advance

Motoboss

Link to comment
Share on other sites

  • 2 weeks later...

Thanks it's working !

however I have this in my server .RPT

 

 1:38:21 Error in expression <layerHadBike = true;
};
} count (player nearEntities [["MMT_Civ"], 25000]);
>
 1:38:21   Error position: <nearEntities [["MMT_Civ"], 25000]);
>
 1:38:21   Error 0 éléments fournis, 3 attendus
 1:38:21 File mpmissions\DayZ_Epoch_11.Chernarus\init.sqf, line 138

so it comes from 

 

// check for existing player bike
{
    _ownername = _x getVariable["Ownername", "nil"];
    if ( _ownername == getPlayerUID player ) exitWith {          
        s_playerHadBike = true;
    };
} count (player nearEntities [["MMT_Civ"], 25000]);
// jahan - end player bike

any idea how to fix it?

Link to comment
Share on other sites

i have the same error in my logs.

14:29:03 Error in expression <layerHadBike = true;
};
} count (player nearEntities [["MMT_Civ"], 25000]);
ca>
14:29:03   Error position: <nearEntities [["MMT_Civ"], 25000]);
ca>
14:29:03   Error 0 elements provided, 3 expected
14:29:03 File mpmissions\__cur_mp.chernarus\init.sqf, line 205

 
Here is the init line around that:

//DayZ Watermark
if (!isNil "server_name") then {
[] spawn {
waitUntil {(!isNull Player) and (alive Player) and (player == player)};
waituntil {!(isNull (findDisplay 46))};
5 cutRsc ["wm_disp","PLAIN"];
((uiNamespace getVariable "wm_disp") displayCtrl 1) ctrlSetText server_name;
};
};
 
// jahan - begin player bike
s_playerHadBike = false;
s_player_unpackbike = -1;
s_player_packbike = -1;
s_bikeDamage = 0;
// check for existing player bike
{
    _ownername = _x getVariable["Ownername", "nil"];
    if ( _ownername == getPlayerUID player ) exitWith {          
        s_playerHadBike = true;
    };
} count (player nearEntities [["MMT_Civ"], 25000]);
// jahan - end player bike
 
call compile preprocessFileLineNumbers "custom\walkamongstthedead\config.sqf";
 
#include "\z\addons\dayz_code\system\BIS_Effects\init.sqf"

 

btw: Chernarus, Epoch. and infistar.

Link to comment
Share on other sites

Hm, I am not sure why this happens. Can you try to change the 'count' to a 'forEach'.

I am not sure what happens if there are no MMT_CIVs in the map. Where exactly in the init you've posted is your line 205?

 

Or another idea:

 

Change

count (player nearEntities [["MMT_Civ"], 25000]);

to

count (player nearEntities [["MMT_Civ"], 25000]) -1;

and tell me if that solves the issue.

Link to comment
Share on other sites

So, i have testing this:

count (player nearEntities [["MMT_Civ"], 25000]) -1;

 

forEach (player nearEntities [["MMT_Civ"], 25000]) -1;

 

forEach (player nearEntities [["MMT_Civ"], 25000])

 

dosn't work. I might also just see what simple. Here is the init: http://pastebin.com/emKrvn3M

 

here the error message

13:51:15 Bad conversion: array

13:51:15 Error in expression <layerHadBike = true;
};
} count (player nearEntities [["MMT_Civ"], 25000]) -1;
 
>
13:51:15   Error position: <nearEntities [["MMT_Civ"], 25000]) -1;
 
>
13:51:15   Error 0 elements provided, 3 expected
13:51:15 File mpmissions\__cur_mp.chernarus\init.sqf, line 205

Link to comment
Share on other sites

Hm, whatever I do I cannot reproduce this,

I thought it has something to do with not having any MMT_Civ objects on the map maybe. I've deleted all I had and no errors.

When does the error occor...I guess just after logging into the game?

The problem is if I cannot reproduce this I cannot find a solution.

 

Maybe someone else can help here, I hope.

Link to comment
Share on other sites

The error occurs when I pull the server out of the restart. Then he writes the error in the logs.
The bikes are also on the map, multiple stand there, just as in the database.
I look again everything in silence through, is only something small which is only about looks.
Link to comment
Share on other sites

Possible to make this:

///// ################ jahan - Begin Player Bike ########################################        
if ((speed player < 1) && !(player isKindOf "PZombie_VB") && _canDo && !_inVehicle ) then {  
    
    ///// unpack bike addaction:
    if( ( isNull cursorTarget ) ) then {
        if ((s_player_unpackbike < 0) && (!s_playerHadBike)) then {
            s_player_unpackbike = player addAction [("<t color=""#DF01D7"">" + ("Unpack Bike") +"</t>"),"custom\jtools\player_bike.sqf","unpack",-1,false,true,"", ""];
        };
    } else {
        player removeAction s_player_unpackbike;
        s_player_unpackbike = -1;
    };
 
    ///// pack bike addaction:
    if ( !(isNull cursorTarget) && (player distance cursorTarget < 3) && (typeOf cursorTarget == "MMT_Civ") ) then {
        if ((s_player_packbike < 0) && ( s_playerHadBike )) then {
            s_player_packbike = player addAction [("<t color=""#DF01D7"">" + ("Pack Bike") +"</t>"),"custom\jtools\player_bike.sqf","pack",-1,false,true,"", ""];
        };
    } else {
        player removeAction s_player_packbike;
        s_player_packbike = -1;
    };
};
///// ################ jahan - End Player Bike ########################################

a part of custom menu script that is already included in fn_selfActions?

Dont want to make another selfaction menu options so i wanted to make it a part of sub-menu...

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...