Jump to content

Recommended Posts

Hi,

Does anyone know how to change the price of all virtual items for a faction. So i want all virtual items for bluefor and med to be free and have it the normal price for civ

Thx

Share this post


Link to post
Share on other sites

For your issue there are 2 things that come to mind.
1. In Altis_Life.Altis/core/shops/fn_virt_buy.sqf add a muliplier for the buy price.
2. Do what the vehicle shop does and create two (or three) new variables in Altis_Life.Altis/config/Config_Master.hpp then in Altis_Life.Altis/core/shops/fn_virt_buy.sqf write a switch statement (based of the side of the player) that would use the values you set in Config_Master.hpp as the multiplier.

Ex 1.
if (side player != civilian) then {_price = _price * x) (("x" is your multiplier)

Ex 2.
In Config_Master.hpp
vitem_buy_multiplier_COP = 0; //Virtual item multiplier for cops
vitem_buy_multiplier_CIVILIAN = 1; //Virtual item multiplier for civs
vitem_buy_multiplier_MEDIC = 0; //Virtual item multiplier for medics
In fn_virt_buy.sqf

//Taken from Altis_Life.Altis/core/shops/fn_vehicleShopBuy.sqf
private "_buyMultiplier";

switch (playerSide) do {
    case civilian: {
        _buyMultiplier = LIFE_SETTINGS(getNumber,"vitem_buy_multiplier_CIVILIAN");
    };
    case west: {
        _buyMultiplier = LIFE_SETTINGS(getNumber,"vitem_buy_multiplier_COP");
    };
    case independent: {
        _buyMultiplier = LIFE_SETTINGS(getNumber,"vitem_buy_multiplier_MEDIC");
    };
};
_price = _price * _buyMultiplier

 

Edited by Fawks

Share this post


Link to post
Share on other sites
16 hours ago, Matty6603 said:

Hi,

Does anyone know how to change the price of all virtual items for a faction. So i want all virtual items for bluefor and med to be free and have it the normal price for civ

Thx

let me see if i can do it for you

 

Share this post


Link to post
Share on other sites
On 12/18/2019 at 2:57 PM, Matty6603 said:

Hi,

Does anyone know how to change the price of all virtual items for a faction. So i want all virtual items for bluefor and med to be free and have it the normal price for civ

Thx

try this  i didnt test it so ....

Spoiler

#include "..\..\script_macros.hpp"
/*
    File: fn_virt_buy.sqf
    Author: Bryan "Tonic" Boardwine
    edited by mohsen98     
    Description:
    Buy a virtual item from the store.
*/
private ["_type","_price","_amount","_diff","_name","_hideout"];
if ((lbCurSel 2401) isEqualTo -1) exitWith {hint localize "STR_Shop_Virt_Nothing"};
_type = lbData[2401,(lbCurSel 2401)];

if (playerSide isEqualTo civilian) then {
_price = lbValue[2401,(lbCurSel 2401)];
};

if (playerSide != civilian) then {
_price = 0;
};

 

_amount = ctrlText 2404;
if (!([_amount] call TON_fnc_isnumber)) exitWith {hint localize "STR_Shop_Virt_NoNum";};
_diff = [_type,parseNumber(_amount),life_carryWeight,life_maxWeight] call life_fnc_calWeightDiff;
_amount = parseNumber(_amount);
if (_diff <= 0) exitWith {hint localize "STR_NOTF_NoSpace"};
_amount = _diff;
private _altisArray = ["Land_u_Barracks_V2_F","Land_i_Barracks_V2_F"];
private _tanoaArray = ["Land_School_01_F","Land_Warehouse_03_F","Land_House_Small_02_F"];
private _hideoutObjs = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call TON_fnc_terrainSort;
_hideout = (nearestObjects[getPosATL player,_hideoutObjs,25]) select 0;
if ((_price * _amount) > CASH && {!isNil "_hideout" && {!isNil {group player getVariable "gang_bank"}} && {(group player getVariable "gang_bank") <= _price * _amount}}) exitWith {hint localize "STR_NOTF_NotEnoughMoney"};
if ((time - life_action_delay) < 0.2) exitWith {hint localize "STR_NOTF_ActionDelay";};
life_action_delay = time;

_name = M_CONFIG(getText,"VirtualItems",_type,"displayName");

if ([true,_type,_amount] call life_fnc_handleInv) then {
    if (!isNil "_hideout" && {!isNil {group player getVariable "gang_bank"}} && {(group player getVariable "gang_bank") >= _price}) then {
        _action = [
            format [(localize "STR_Shop_Virt_Gang_FundsMSG")+ "<br/><br/>" +(localize "STR_Shop_Virt_Gang_Funds")+ " <t color='#8cff9b'>$%1</t><br/>" +(localize "STR_Shop_Virt_YourFunds")+ " <t color='#8cff9b'>$%2</t>",
                [(group player getVariable "gang_bank")] call life_fnc_numberText,
                [CASH] call life_fnc_numberText
            ],
            localize "STR_Shop_Virt_YourorGang",
            localize "STR_Shop_Virt_UI_GangFunds",
            localize "STR_Shop_Virt_UI_YourCash"
        ] call BIS_fnc_guiMessage;
        if (_action) then {
            hint format [localize "STR_Shop_Virt_BoughtGang",_amount,(localize _name),[(_price * _amount)] call life_fnc_numberText];
            _funds = group player getVariable "gang_bank";
            _funds = _funds - (_price * _amount);
            group player setVariable ["gang_bank",_funds,true];

            if (life_HC_isActive) then {
                [1,group player] remoteExecCall ["HC_fnc_updateGang",HC_Life];
            } else {
                [1,group player] remoteExecCall ["TON_fnc_updateGang",RSERV];
            };

        } else {
if (playerSide isEqualTo civilian) then {                    
            if ((_price * _amount) > CASH) exitWith {[false,_type,_amount] call life_fnc_handleInv; hint localize "STR_NOTF_NotEnoughMoney";};
            hint format [localize "STR_Shop_Virt_BoughtItem",_amount,(localize _name),[(_price * _amount)] call life_fnc_numberText];
            CASH = CASH - _price * _amount;
        };
if (playerSide != civilian) then {        
        hint format ["You bought %1 %2 for free",_amount,(localize _name), call life_fnc_numberText];    
    };
    };
    } else {
if (playerSide isEqualTo civilian) then {
        if ((_price * _amount) > CASH) exitWith {hint localize "STR_NOTF_NotEnoughMoney"; [false,_type,_amount] call life_fnc_handleInv;};
        hint format [localize "STR_Shop_Virt_BoughtItem",_amount,(localize _name),[(_price * _amount)] call life_fnc_numberText];
        CASH = CASH - _price * _amount;
    };
if (playerSide != civilian) then {        
        hint format ["You bought %1 %2 for free",_amount,(localize _name), call life_fnc_numberText];        
    };    
    };
    [] call life_fnc_virt_update;
};

[0] call SOCK_fnc_updatePartial;
[3] call SOCK_fnc_updatePartial;

 

Edited by john_65wadwada654

Share this post


Link to post
Share on other sites

Just throwing this out there, you don't need 4 if statements. A simple if (side player != civilian) then{_price = 0}; would work.
playerSide doesn't auto update if the player switches from civilian to cop or vice versa so in this case I prefer (side player).
https://community.bistudio.com/wiki/playerSide
https://community.bistudio.com/wiki/side

Edited by Fawks
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.