Hacking tool guide and framework

## Introduction

With Milsim Tools, you can create simple hackable and downloadable content on objects. By default players will need to carry a hacking tool in their inventory (found in the arsenal under [+] miscellaneous items). To perform hacks and downloads.

With the functions explained below you can easily add an ACE3 action to an object and make it hackable/contain downloadable content.

While hacking or downloading a file players must remain within range of the source object. A wifi signal is shown and the signal decreases or increases depending on the player's distance to the object. If the distance exceeds 20 meters signal will be lost and the player will have to return to the source object to resume downloading or hacking. (progression is saved). Upon finishing the hack / download the ACE 3 action will be globally removed from the object.

You can script the effects of the downloads and hacks to be whatever you want or just set them to fire a trigger via a variable you create with the hack.

## Settings

The module has a single setting found under

**settings >>configure addons >> MRH\_MilsimTools - Hacking settings**

* Require hacking tool

*This setting is enabled by default, if disabled players will be able to perform hacks and downloads even if they do not have a hacking tool in their inventory.*

## Hacking/downloading set up for mission makers

Hacking function:

```
 Function name:MRH_fnc_Hack;
  Author: Mr H.
  Description: Makes the object hackable with the hacking tool
  Return value: None
  Public: Yes
  Parameters:
  0- <NUMBER> -Duration of the hack in seconds.
  1-<OBJECT> - Object to add the action to
  2 - <STRING> - "HackName" when the hack is complete a public variable (value = true) will be created. Can be anything but must be a single word and must not contain spaces
  3- <CODE> -Optional - Code to execute upon completion of the hack, canSuspend = true, must be stated between {}, source object (parameter 1) is passed to the code and can be retrieved.
  Example(s):
  [20,this,"testhack"] call MRH_fnc_Hack;
  or
  [20,this,"yourHackName",{deleteVehicle (_this select 0); player setDamage 0.5; hint 'The laptop was booby trapped'}] call MRH_fnc_Hack; // will delete the source object and damage the player

```

Download file function:

```
 Function name:MRH_fnc_DownloadFile;
    Author: Mr H.
    Description: This function allows you to turn any object into a file source for download
    Return value: None
    Public: Yes
    Parameters:
    0-<NUMBER> size of the file in Mo as an actual effect on how long the download will take
    1- <OBJECT> - object to add the action to
    2 - <STRING> - "FileName" when the download is complete a public variable (value = true) will be created. Can be anything but must be a single word and must not contain spaces
    3- <CODE> -Optional - Code to execute upon completion of the download, canSuspend = true, must be stated between {}, source object (parameter 1) is passed to the code and can be retrieved.
    Example(s):
    [10,this,"testfile"] call MRH_fnc_DownloadFile;
    or
    [20,this,"file1",{player setDamage 0,5; hint 'You received a small electrical shock'}] call MRH_fnc_DownloadFile; //will hurt the player after download is completed
    or
    [5,this,"someFileName",{deleteVehicle (_this select 0)}] call MRH_fnc_DownloadFile; // will delete the object used as a source upon completion
    or
    [30,this,"whateverYouWant",{[player,["dataEntry1","dataEntry2"]]call MRH_fnc_MilsimTools_SoldierTab_attributeData;}] call MRH_fnc_DownloadFile; //will add data to the player's pda.

```