Jump to content

Recommended Posts

hey.

I needed help with this. 

i need to add these to the script, but somehow it is difficult.

 

+ an interruption in file download if the player goes far away from the laptop.

+ a random chance that the download failed during the download.

 

laptop.sqf

_Progress = 0;

hacked = false;

_unit = _this select 0;

 

_unit removeAction 0;

 

while {_Progress < 100} do 

{

    _Progress = _Progress + 1;

    hintSilent format ["Downloading...  %1", _Progress];

 

    if (_Progress >= 100) then 

    {

        hacked = true;

        _Progress = 100;

        hint "Download is Complete!";

    };

    sleep 2.5;

};

  • Like 1

Share this post


Link to post
Share on other sites

Just add a distance check into your condition to stop it if they wander too far away:

while {(_Progress < 100) && ((_unit distance _laptop) < 5)} do
//_laptop being the object the need to stay near, and must be within 5m

Then at the end of the process, and before any other code, just use something like:

if (_Progress >= 100) then 

    if ((random 1) < 0.25) exitWith {hint "Download failed. Try again."};
    //25% chance of failure

    {
        hacked = true;

 

You could also use BIS_fnc_holdActionAdd to make the player hold their action button down to complete the action, but it looks like they'd have to do that for over 4 minutes which probably isn't quite what you're going for.

  • Like 1

Share this post


Link to post
Share on other sites

I try, but a few problems came up.

1. it stops downloading but no message.🙁

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×