From 5a871c6fd5f9ce5b2192538c65d2a58dbeb305b7 Mon Sep 17 00:00:00 2001 From: Ghostrider-DbD- Date: Wed, 21 Jun 2017 19:13:00 -0400 Subject: [PATCH] Version 1.0 --- Epoch.Altis/addons/DBD/autoRun.sqf | 23 +++++++++++++ Epoch.Altis/addons/DBD/canRun.sqf | 12 +++++++ Epoch.Altis/addons/DBD/init.sqf | 17 ++++++++++ Epoch.Altis/addons/DBD/keyPressed.sqf | 34 +++++++++++++++++++ Epoch.Altis/addons/DBD/stopAutoRun.sqf | 21 ++++++++++++ .../customs/EPOCH_custom_EH_KeyDown.sqf | 20 +++++++++++ .../customs/EPOCH_custom_OnEachFrame.sqf | 28 +++++++++++++++ Epoch.Altis/init.sqf | 9 +++++ INSTALLATION.txt | 17 ++++++++++ License.md | 7 ++++ README.md | 12 +++++++ 11 files changed, 200 insertions(+) create mode 100644 Epoch.Altis/addons/DBD/autoRun.sqf create mode 100644 Epoch.Altis/addons/DBD/canRun.sqf create mode 100644 Epoch.Altis/addons/DBD/init.sqf create mode 100644 Epoch.Altis/addons/DBD/keyPressed.sqf create mode 100644 Epoch.Altis/addons/DBD/stopAutoRun.sqf create mode 100644 Epoch.Altis/epoch_code/customs/EPOCH_custom_EH_KeyDown.sqf create mode 100644 Epoch.Altis/epoch_code/customs/EPOCH_custom_OnEachFrame.sqf create mode 100644 Epoch.Altis/init.sqf create mode 100644 INSTALLATION.txt create mode 100644 License.md create mode 100644 README.md diff --git a/Epoch.Altis/addons/DBD/autoRun.sqf b/Epoch.Altis/addons/DBD/autoRun.sqf new file mode 100644 index 0000000..7aafc1b --- /dev/null +++ b/Epoch.Altis/addons/DBD/autoRun.sqf @@ -0,0 +1,23 @@ +/* + Start Autorun. Loosely based on ExileMod code. + By Ghostrider-DbD- + For DeathBeforeDishonorClan + + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. +*/ + +if (!DBD_AutorunOn) then +{ + _canRun = call DBD_canRun; + if (_canRun) then + { + DBD_AutorunOn = true; + hint "Autorun Activated"; + }; +} +else +{ + call DBD_stopAutoRun; +}; + diff --git a/Epoch.Altis/addons/DBD/canRun.sqf b/Epoch.Altis/addons/DBD/canRun.sqf new file mode 100644 index 0000000..0787b18 --- /dev/null +++ b/Epoch.Altis/addons/DBD/canRun.sqf @@ -0,0 +1,12 @@ +/* + Adapted from code written by Exile Mod team. + By Ghostrider-DbD- + For DeathBeforeDishonorClan + + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. +*/ + +_canRun = (vehicle player == player && !(surfaceIsWater (getPos player)) && !((damage player) >= 0.5)); +_canRun + diff --git a/Epoch.Altis/addons/DBD/init.sqf b/Epoch.Altis/addons/DBD/init.sqf new file mode 100644 index 0000000..514b3bd --- /dev/null +++ b/Epoch.Altis/addons/DBD/init.sqf @@ -0,0 +1,17 @@ + +// Initialize functions for actions controlled by a keypress. +// by GhostriderDbD +// For DeathbeforeDishonorClan +// for Epoch 0.3.8.0 + +// Copywrite 2016 + +DBD_Autorun = compileFinal preprocessFileLineNumbers "addons\DBD\autoRun.sqf"; +DBD_stopAutoRun = compileFinal preprocessFileLineNumbers "addons\DBD\stopAutoRun.sqf"; +DBD_canRun = compileFinal preprocessFileLineNumbers "addons\DBD\canRun.sqf"; +DBD_keyPress = compileFinal preprocessFileLineNumbers "addons\DBD\keyPressed.sqf"; +DBD_AutorunOn = false; + + + + + diff --git a/Epoch.Altis/addons/DBD/keyPressed.sqf b/Epoch.Altis/addons/DBD/keyPressed.sqf new file mode 100644 index 0000000..90ce091 --- /dev/null +++ b/Epoch.Altis/addons/DBD/keyPressed.sqf @@ -0,0 +1,34 @@ +/* + Custom Keypress Handler for Arma 3 Epoch + By Ghostrider-Db- + for DeathbeforeDishonorClan + Copywrite 2016 + Intended to be called from the KeyDown event handler for Epoch 0.3.8 + + + usage: + [_dikCode] DBD_keyPress; + + for DIK Codes see: https://resources.bisimulations.com/wiki/DIK_KeyCodes +*/ + +params ["_dikCode"]; + + +if (_dikCode in [0x09] /* 8 key*/) then { + if (DBD_AutorunOn) then { + call DBD_stopAutoRun; + } else { + call DBD_autoRun; + }; +}; + +if (_dikCode == 0x06 /* 5 key*/) then {call cm_Earplugs_FUNc}; + +if (_dikCode in [0x11,0x1E,0x1F,0x20,0x2C,0x2D,0x2E]) then +{ + call DBD_stopAutoRun; +}; + +if (_dikCode == 0x16 /* u key */) then {execVM "scripts\ActionMenu\admin_actions\admin_unlock.sqf";}; + +if (_dikCode == 0x1B /* R bracket */) then {execVM "addons\Menu\playerMenu.sqf";}; diff --git a/Epoch.Altis/addons/DBD/stopAutoRun.sqf b/Epoch.Altis/addons/DBD/stopAutoRun.sqf new file mode 100644 index 0000000..3aefbf5 --- /dev/null +++ b/Epoch.Altis/addons/DBD/stopAutoRun.sqf @@ -0,0 +1,21 @@ +/* + Adapted from code written by Exile Mod team. + By Ghostrider-DbD- + For DeathBeforeDishonorClan + * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. +*/ + +if (DBD_AutorunOn) then +{ + DBD_AutorunOn = false; + if ((vehicle player) isEqualTo player) then + { + if (alive player) then + { + hint "Autorun Inactivated"; + player switchMove ""; + }; + }; +}; +true \ No newline at end of file diff --git a/Epoch.Altis/epoch_code/customs/EPOCH_custom_EH_KeyDown.sqf b/Epoch.Altis/epoch_code/customs/EPOCH_custom_EH_KeyDown.sqf new file mode 100644 index 0000000..3df8217 --- /dev/null +++ b/Epoch.Altis/epoch_code/customs/EPOCH_custom_EH_KeyDown.sqf @@ -0,0 +1,20 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch KeyUp Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_KeyDown.sqf +*/ +params ["_display","_dikCode","_shift","_ctrl","_alt"]; +_handled = false; + +[_dikCode] call DBD_keyPress; + +_handled diff --git a/Epoch.Altis/epoch_code/customs/EPOCH_custom_OnEachFrame.sqf b/Epoch.Altis/epoch_code/customs/EPOCH_custom_OnEachFrame.sqf new file mode 100644 index 0000000..a185482 --- /dev/null +++ b/Epoch.Altis/epoch_code/customs/EPOCH_custom_OnEachFrame.sqf @@ -0,0 +1,28 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch OnEachFrame + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_OnEachFrame.sqf +*/ + +/* + This still needs refinement. Some conditions are shown below but need testing. +*/ + +if (DBD_AutorunOn) then { + private _OK_toRun = call DBD_canRun; + if (_OK_toRun) then + { + player playAction "FastF"; + } else { + DBD_AutorunOn = false; + }; +}; diff --git a/Epoch.Altis/init.sqf b/Epoch.Altis/init.sqf new file mode 100644 index 0000000..fb1c6b3 --- /dev/null +++ b/Epoch.Altis/init.sqf @@ -0,0 +1,9 @@ +/* + Merge the lines below with those in your init.sqf +*/ + +if(hasInterface) then{ + execVM "addons\DBD\init.sqf"; +}; + + diff --git a/INSTALLATION.txt b/INSTALLATION.txt new file mode 100644 index 0000000..5ab41c0 --- /dev/null +++ b/INSTALLATION.txt @@ -0,0 +1,17 @@ +Installation: + +///////////////////////////// +// MPMissions - modify your mission pbo (epoch.Altis.pbo) as follows. +1) Unpack the Zip file you downloaded from the Github to a folder in a convenient location. +2) Unpack your mission pbo (epoch.Altis.pbo). +3) Open the folder containing the unpacked mission. +4) If you have not added any code to the custom KeyDown or onEachFrame event handlers, copy the DBD and epoch_code folders from the download into the folder containing the unpacked mission. + If you already use EPOCH_custom_OnEachFrame or EPOCH_custom_EH_KeyDown custom event handlers then carefully merge the code in the downloaded files. +5) Merge the line in MPMissions\epoch.Altis\init.sqf with your init.sqf, or use the one provided if you do not have one. +6) Repack your mission.pbo. +/////////////////////////// + + +Activating Autorun: press the 8 key. + +Linking Autorun to icons on status bars or other HUD: you can easily poll autorun status by checking the status of DBD_AutorunOn \ No newline at end of file diff --git a/License.md b/License.md new file mode 100644 index 0000000..1e5b727 --- /dev/null +++ b/License.md @@ -0,0 +1,7 @@ +-------------------------- +License +-------------------------- +All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + +http://creativecommons.org/licenses/by-nc-sa/4.0/ + diff --git a/README.md b/README.md new file mode 100644 index 0000000..7f9533d --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +epochmod Autorun Version 1.0 for Epochmod for Arma 3 version 0.5.0 + and Arma 3 V 1.70 +. + +This is a simple script that adds an autorun function to epoch. +I have tried to make installation as simple as possible so that this is plug and play. +Please see the installation instructions for details regarding adding this to your server. + +-------------------------- +License +-------------------------- +All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + +http://creativecommons.org/licenses/by-nc-sa/4.0/