MrDynamite

[solved]Change vehicle repair item

6 posts in this topic

Posted (edited)

Hi,

I try to get rid of the duck tape for everything =).

So i did find the duck tape in ExileClient_action_repairVehicle_condition.sqf and ExileClient_action_repairVehicle_completed.sqf.

I wanna have a consumable wheel and an non consumable toolbox. For easy of use would be nice to have the foolbox in the vehicle.
But I have no idea (2nd overwrite at all) who to check the inventury of the car.

This check is vs the player and works.

Quote

private["_vehicle","_result","_availableHitpoints","_canBeReparied"];
_vehicle = _this;
_result = "";
try
{
    if (ExileClientPlayerIsInCombat) then
    {
        throw "You are in combat!";
    };
    if ((vehicle player) isEqualTo _vehicle) then
    {
        throw "Are you serious?";
    };
    if (isEngineOn _vehicle) then
    {
        throw "Turn off the engine first!";
    };
    if ((locked _vehicle) isEqualTo 2) then
    {
        throw "Unlock the vehicle first!";
    };
    _availableHitpoints = (getAllHitPointsDamage _vehicle) select 0;
    _canBeReparied = false;
    {
        if ((_vehicle getHitPointDamage _x) > 0) exitWith
        {
            _canBeReparied = true;
        };
    }
    forEach _availableHitpoints;
    if !(_canBeReparied) then
    {
        throw "This vehicle looks fine.";
    };
    if !(local _vehicle) then
    {
        throw "Please get in as driver/pilot first.";
    };
    if !("Exile_Item_CarWheel" in (magazines player)) then
    {
        throw "You need a car wheel  to do that!";
    };
    if !("Exile_Item_Foolbox" in (magazines player)) then
    {
        throw "You need a foolbox in your vehicle to do that!";
    };
    if ((_vehicle distance player) > 7) then
    {
        throw "You are too far away!";
    };
}

How do I "if !("Exile_Item_Foolbox" in (magazines player)) then" vs the vehicle I wanna repair? "in (magazines _vehicle)" does not work?
No error but it does not recognize that the foolbox is in the vehicle.
Somebody can give me a hint?

 

2nd question:

Can i querry the Class fom the main mission config.cpp inside this method?

Quote

class Car
    {
        targetType = 2;
        target = "Car";

        class Actions
        {
        // Repairs a vehicle to 100%. Requires Duckttape
            class Repair: ExileAbstractAction
            {
                title = "Repair";
                condition = "true";
                action = "['RepairVehicle', _this select 0] call ExileClient_action_execute";
            };
           


This funcion / method is called / from inside class air, car and boat defind in the main config.cpp.
Does ExileClient_action_repairVehicle_condition know vrom which class this call came from and can i querry it to get diffrent recipes for the 3 vehicle classes?

Thx MrD

Edited by MrDynamite

Share this post


Link to post
Share on other sites

Posted (edited)

Hi,

after a few days of intense googling I was able to querry the vehicle inventory and check existence of the toolbox with:

Quote

private _vehItems = _vehicle call ExileClient_util_containerCargo_list;

if !("Exile_Item_Foolbox" in _vehitems ) then
    {
        throw "You need a foolbox in your vehicle to do that!";
    };

getItemCargo _vehicle or magazines _vehicle did nothing ... maybe cause vehicle is server and script is client ... but to be honest I have no clue.. =).

The idea is to prepare/create a packed foolbox with hammer, screwdriver, .... and have it at hand when needed.
You can sort of grab the tools out of the foolbox and have only the consumable in the players inventory.
I like it because its not only ducktape and not to much pve like the repairbuddy addon.

So 2nd question:
Has somebody an idea how to get the class of the vehicle ... car, boat or air to get 3 difrent recipes for the rapair?

Thx MrD

Edited by MrDynamite

Share this post


Link to post
Share on other sites
Advertisement

I believe the classes car, bike, helicopter is arrays in exile_server_config.pbo  config.cpp file

Share this post


Link to post
Share on other sites

Posted (edited)

Hi,

so this was successful. :-)

I ended up with 2 overrides, check for items:

Quote

/**
 * ExileClient_action_repairVehicle_condition
 *
 * 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","_result","_availableHitpoints","_canBeReparied"];
_vehicle = _this;
_result = "";

private _vehItems = _vehicle call ExileClient_util_containerCargo_list; // OPA

try
{
    /*
    if (ExileClientPlayerIsInCombat) then
    {
        throw "You are in combat!";
    };
    */
    if ((vehicle player) isEqualTo _vehicle) then
    {
        throw "Are you serious?";
    };
    if (isEngineOn _vehicle) then
    {
        throw "Turn off the engine first!";
    };
    if ((locked _vehicle) isEqualTo 2) then
    {
        throw "Unlock the vehicle first!";
    };
    _availableHitpoints = (getAllHitPointsDamage _vehicle) select 0;
    _canBeReparied = false;
    {
        if ((_vehicle getHitPointDamage _x) > 0) exitWith
        {
            _canBeReparied = true;
        };
    }
    forEach _availableHitpoints;
    if !(_canBeReparied) then
    {
        throw "This vehicle looks fine.";
    };
    if !(local _vehicle) then
    {
        throw "Please get in as driver/pilot first.";
    };
    if ((_vehicle distance player) > 7) then
    {
        throw "You are too far away!";
    };
    // start
    if !("Exile_Item_Foolbox" in _vehitems ) then
    {
        throw "You need a foolbox in your vehicle to do that!";
    };
    if (_vehicle isKindOf "Car") then
    {
        if !("Exile_Item_CarWheel" in (magazines player)) then
        {
            throw "You need a car wheel to do that!";
        };
    };
    if (_vehicle isKindOf "Air") then
    {
        if !("Exile_Item_MetalBoard" in (magazines player)) then
        {
            throw "You need a metal board to do that!";
        };
    };
    if (_vehicle isKindOf "Boat") then
    {
        if !("Exile_Item_DuctTape" in (magazines player)) then
        {
            throw "You need a ducktape to do that!";
        };
    };
    // end
}
catch
{
    _result = _exception;
};
_result

and remove consumables:

Quote

/**
 * ExileClient_action_repairVehicle_completed
 *
 * 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/.
 */
 
_this setDamage 0;

// start
private _vehicle = _this;
if (_vehicle isKindOf "Car") then
{
    player removeItem "Exile_Item_CarWheel";
};
if (_vehicle isKindOf "Air") then
{
    player removeItem "Exile_Item_MetalBoard";
};
if (_vehicle isKindOf "Boat") then
{
    player removeItem "Exile_Item_DuctTape";
};
// end

and here is a recipe to prepare your packed foolbox in your base:

Quote

class CraftFoolbox: Exile_AbstractCraftingRecipe
{
    name = "Pack your foolbox ...";
    pictureItem = "Exile_Item_Foolbox";
    requiredInteractionModelGroup = "WorkBench";
    returnedItems[] =
    {
        {1, "Exile_Item_Foolbox"}
    };
    components[] =
    {
        {1,"Exile_Item_Hammer"},
        {1,"Exile_Item_Pliers"},
        {1,"Exile_Item_Screwdriver"},
        {1,"Exile_Item_Wrench"},
        {1,"Exile_Item_DuctTape"},
        {1,"Exile_Item_OilCanister"},
        {1,"Exile_Item_Grinder"},
        {1,"Exile_Item_CordlessScrewdriver"},
        {1,"Exile_Item_FuelCanisterEmpty"}
    };
};

I like it since there is some effort to get your repair parts but there is still the ease of use in combat.

Thx MrD

PS: topic is done ... close it.

Edited by MrDynamite

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

  • Recently Browsing   0 members

    No registered users viewing this page.