Sign in to follow this  
Followers 0
OnkelBazi

Duc tape Repair chance

8 posts in this topic

Hi guys,

 

for a few days i see a post.....about repair %

so i can make that u need 3 ductape for 100% repair....but i didnt find it again

 

so does anyone  know how this is possible...where i can chance this? 

 

 

Regards from Bavaria :gottarun:

Share this post


Link to post
Share on other sites

Hello OnkelBazi,

You can create a file with this code:

Spoiler

/**
 * ExileClient_object_vehicle_repair
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * 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/.
 */
 
private["_vehicle","_availableHitpoints","_fixable","_equippedMagazines","_vehicledamage","_vehiclerepair"];
_vehicle = _this select 0;
if (ExileClientPlayerIsInCombat) exitWith
{
    ["RepairFailedWarning", ["You are in combat!"]] call ExileClient_gui_notification_event_addNotification;
};
if (vehicle player isEqualTo _vehicle) exitWith
{
    ["RepairFailedWarning", ["Are you serious?"]] call ExileClient_gui_notification_event_addNotification;
};
_availableHitpoints = (getAllHitPointsDamage _vehicle) select 0;
{
    if((_vehicle getHitPointDamage _x) > 0)exitWith
    {
        _fixable = "potato";
    };
}
forEach _availableHitpoints;
if (isNil "_fixable") exitWith
{
    ["RepairFailedWarning", ["This vehicle already looks fine."]] call ExileClient_gui_notification_event_addNotification;
};
if (!local _vehicle) then
{
    ["RepairFailedWarning", ["Please get in as driver/pilot first."]] call ExileClient_gui_notification_event_addNotification;
}
else
{
    _equippedMagazines = magazines player;
    if ("Exile_Item_DuctTape" in _equippedMagazines) then
    {
        _vehicledamage = damage _vehicle;
        _vehiclerepair = _vehicledamage - 0.33;
        if (_vehiclerepair < 0) then {_vehiclerepair = 0};
        _vehicle setDamage _vehiclerepair;
        player removeItem "Exile_Item_DuctTape";
    }
    else
    {
        ["RepairFailedWarning", ["You need duct tape to do that!"]] call ExileClient_gui_notification_event_addNotification;
    };
};
true

Name it like this: "ExileClient_object_vehicle_repair.sqf" and put it in a folder named like you want (for ex: ductape). So put this folder in your "Exile.Altis.pbo" and open "config.cpp", go to "class CfgExileCustomCode" and add this:

ExileClient_object_vehicle_repair = "ductape\ExileClient_object_vehicle_repair.sqf";

Repack you PBO and start your server.


It should ensure that 1 Duct tape repair only 33% of a vehicle virtually destroyed. So you will need 3 duct tape to totally repair it.
I did not test it, so tell me if it work. ^_^

Share this post


Link to post
Share on other sites
Advertisement

Arf, It would have been too easy. Arma damage command don't work like I thought...

I'm working on it. I'll let you know.

1 person likes this

Share this post


Link to post
Share on other sites

Do the same things I wrote in my first reply but put this code in the "ExileClient_object_vehicle_repair.sqf":

Spoiler

/**
 * ExileClient_object_vehicle_repair
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * 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/.
 */
 
private["_vehicle","_availableHitpoints","_fixable","_equippedMagazines","_vehiclerepair","_requiredducttape"];
_vehicle = _this select 0;
if (ExileClientPlayerIsInCombat) exitWith
{
    ["RepairFailedWarning", ["You are in combat!"]] call ExileClient_gui_notification_event_addNotification;
};
if (vehicle player isEqualTo _vehicle) exitWith
{
    ["RepairFailedWarning", ["Are you serious?"]] call ExileClient_gui_notification_event_addNotification;
};
_availableHitpoints = (getAllHitPointsDamage _vehicle) select 0;
{
    if((_vehicle getHitPointDamage _x) > 0)exitWith
    {
        _fixable = "potato";
    };
}
forEach _availableHitpoints;
if (isNil "_fixable") exitWith
{
    ["RepairFailedWarning", ["This vehicle already looks fine."]] call ExileClient_gui_notification_event_addNotification;
};
if (!local _vehicle) then
{
    ["RepairFailedWarning", ["Please get in as driver/pilot first."]] call ExileClient_gui_notification_event_addNotification;
}
else
{
    _requiredducttape = 3;        // Here the number of duct tape needed to 100% repair (every number you want except 0)
    _equippedMagazines = magazines player;
    if ("Exile_Item_DuctTape" in _equippedMagazines) then
    {
        {
            _vehiclerepair = (_vehicle getHitPointDamage _x) - (1 / _requiredducttape);
            if (_vehiclerepair < 0) then {_vehiclerepair = 0};
            _vehicle setHitPointDamage [_x, _vehiclerepair];
        }
        forEach _availableHitpoints;
        player removeItem "Exile_Item_DuctTape";
    }
    else
    {
        ["RepairFailedWarning", ["You need duct tape to do that!"]] call ExileClient_gui_notification_event_addNotification;
    };
};
true

I thought it was a good idea and I put it on my server. :D

Share this post


Link to post
Share on other sites

If you want a random number of duct tape needed so change the line:

_requiredducttape = 3;

by

_requiredducttape = round random [1, 2, 3];

It will give a random number between 1 and 3 with an average of 2.

Share this post


Link to post
Share on other sites

Hi,

i will test it the next days...

 

got a lot of work... thx for u r help i will notice u if its work

Share this post


Link to post
Share on other sites
Advertisement

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.