Jump to content

Recommended Posts

You want to modify HALs_money_fnc_getFunds (maintaining that it returns a scalar) to:

Spoiler

/*
	Function: HALs_money_fnc_getFunds
	// Modified for Ravage
	Author: HallyG

	Arguments(s):
	0: None

	Return Value:
	None
	
	Example:
	[] call HALs_money_fnc_getFunds;
__________________________________________________________________*/
params [
	["_unit", objNull, [objNull]]
];

({_x isEqualTo "rvg_money"} count magazines _unit)

 

 

For HALs_money_fnc_addFunds maybe something like:

Spoiler

/*
	Function: HALs_money_fnc_addFunds
	// Modified for Ravage
	Author: HallyG

	Arguments(s):
	0: None

	Return Value:
	None
	
	Example:
	[player, 100] call HALs_money_fnc_addFunds;
__________________________________________________________________*/
params [
	["_unit", objNull, [objNull]],
	["_funds", 0, [0]]
];

if (!local _unit) exitWith {
	[_unit, _funds] remoteExec ["HALs_money_fnc_addFunds", _unit, false];
};

if (_funds < 0) then {
  _funds = ceil _funds;
} else {
  _funds = floor _funds;
};

if (_funds isEqualTo 0) exitWith {};

// Remove money
if (_funds < 0) then {
  for "_i" from 1 to (abs _funds) do {
    _unit removeItem "rvg_money";
  };
} else {
  _unit addMagazines ["rvg_money", _funds];
};

 

 

This should give you something to start and build upon.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you! But there is a small problem. The amount of money is constant after shopping.

 

// Remove money if (_funds < 0) then { for "_i" from 1 to _funds do { _unit removeItem "rvg_money"; }; } else { _unit addMagazines ["rvg_money", _funds]; };    I think the problem is here.

Share this post


Link to post
Share on other sites
14 hours ago, HallyG said:

You want to modify HALs_money_fnc_getFunds (maintaining that it returns a scalar) to:

  Reveal hidden contents


/*
	Function: HALs_money_fnc_getFunds
	// Modified for Ravage
	Author: HallyG

	Arguments(s):
	0: None

	Return Value:
	None
	
	Example:
	[] call HALs_money_fnc_getFunds;
__________________________________________________________________*/
params [
	["_unit", objNull, [objNull]]
];

({_x isEqualTo "rvg_money"} count magazines _unit)

 

 

For HALs_money_fnc_addFunds maybe something like:

  Reveal hidden contents


/*
	Function: HALs_money_fnc_addFunds
	// Modified for Ravage
	Author: HallyG

	Arguments(s):
	0: None

	Return Value:
	None
	
	Example:
	[player, 100] call HALs_money_fnc_addFunds;
__________________________________________________________________*/
params [
	["_unit", objNull, [objNull]],
	["_funds", 0, [0]]
];

if (!local _unit) exitWith {
	[_unit, _funds] remoteExec ["HALs_money_fnc_addFunds", _unit, false];
};

if (_funds < 0) then {
  _funds = ceil _funds;
} else {
  _funds = floor _funds;
};

if (_funds isEqualTo 0) exitWith {};

// Remove money
if (_funds < 0) then {
  for "_i" from 1 to (abs _funds) do {
    _unit removeItem "rvg_money";
  };
} else {
  _unit addMagazines ["rvg_money", _funds];
};

 

 

This should give you something to start and build upon.

I used the script you provided. But the balance will not decrease after buying something, no change.  Can you find a reason?  Thank you for your patience!

Share this post


Link to post
Share on other sites

Hi!
I noticed that when i try to configure it to buy clothing, the uniforms buyed it cannot be used.
Is it normal?!

Share this post


Link to post
Share on other sites
45 minutes ago, Kain181 said:

Hi!
I noticed that when i try to configure it to buy clothing, the uniforms buyed it cannot be used.
Is it normal?!

Certain uniforms can only be dressed by certain units. You cannot manually dress a unit with a restricted uniform unless you use the forceAddUniform command.

 

To check whether a uniform can be worn by a specific unit use the isUniformAllowed command.

Cheers

Share this post


Link to post
Share on other sites

How can I make the player unit use all the uniforms I need ?! I have to modify something from your script or directly in the .ini file?

Share this post


Link to post
Share on other sites

It's like you don't read? It is right above your own post. Even if you did then your question should be asking what file, line, etc... A general idea.

On 9/22/2018 at 5:20 PM, HallyG said:

Certain uniforms can only be dressed by certain units. You cannot manually dress a unit with a restricted uniform unless you use the forceAddUniform command.

 

To check whether a uniform can be worn by a specific unit use the isUniformAllowed command.

Cheers

What .ini file? lol? Anyway...

@HallyG

I just dropped by to say very nice UI + shop! I have been looking for some inspiration (for design layout) for my upcoming gun store that I'll be making for a project of mine and came across this.  Superb work! By the way, I am stealing your blurred effect when dialog is open!

https://github.com/HallyG/HALs_Store/blob/master/HALs/Addons/store/functions/client/fn_blur.sqf

GONE! STOLEN! :happy:

  • Like 1

Share this post


Link to post
Share on other sites
On 23/09/2018 at 10:52 AM, Kain181 said:

How can I make the player unit use all the uniforms I need ?! I have to modify something from your script or directly in the .ini file?

Unless you equip the uniform upon purchase, you will need a separate script to enable that functionality. I suggest you take a look at @pierremgi's "wear what you want" script.

 

 

10 hours ago, HazJ said:

...

Thanks for the kind words, I'm glad it was able to give you some inspiration! If you're looking for additional gun-store-style inspiration then this is another approach I have been working on (solely with ctrlCreate) ((shameless plug)):

 

Spoiler

 

 

 

10 hours ago, HazJ said:

 

Excellent, just make sure you listen to some Blur whenever it is used :wink_o:

 
Cheers

 

 

  • Like 1

Share this post


Link to post
Share on other sites

@HallyG - I have used ctrlCreate quite a lot.  Especially since they added support for custom control class in mission. Don't think I'll use it for my upcoming shop. My original plan was to use RscListNBox type but you can't draw the side arrows. At least last time I tried. There is no command support.

  • Like 1

Share this post


Link to post
Share on other sites

Hi all,

 

I'm sure I saw how to script this atleast once in this thread sometime back but I can't seem to find it.

 

How would someone add money every-time you would search an enemy body or kill an enemy on the map?

 

Also, is there anyway to change the currency type showing in game for example changing $ to RU or something similar. 

Share this post


Link to post
Share on other sites

Hi all,

 

How can i add coins (money) for loot?For buying in this system?

 

Thank you.

Edited by bombajack

Share this post


Link to post
Share on other sites
On 30/09/2018 at 9:50 AM, Oscah said:

How would someone add money every-time you would search an enemy body or kill an enemy on the map?

On 23/10/2018 at 6:35 PM, bombajack said:

How can i add coins (money) for loot?For buying in this system?

 

Money for killing enemy units:

Spoiler

initServer.sqf


HALs_store_moneyToAddKill = 100;

addMissionEventHandler ["EntityKilled", {
    params ["_killed", "_killer", "_instigator"];

    //--- Don't increment kills if it's a suicide
    if (_killed isEqualTo _killer) exitWith {false};
    if (vehicle _killed isEqualTo vehicle _killer) exitWith {false};
	if (isNull _killer && isNull _instigator) exitWith {false};
	if ((vehicle _killed) isEqualTo _killer) exitWith {false};

    //--- Valid unit/vehicle
    if (_killed in allUnits OR _killed in vehicles) then {
        private _target = _instigator;

        if (isNull _instigator) then {
    		_target = _killer;
    	};

        //--- Enemies only
        if (side group _killed in ([_target] call bis_fnc_enemySides)) then {
            //--- Only players get money
            if (isPlayer _target) then {
                [player, HALs_store_moneyToAddKill] call HALs_money_fnc_addFunds;
            };
        };
    };
}];

 


For adding money when searching a body, I would take a look at this. Alternatively, you could try creating an addAction on the enemies to, for example, pilfer their wallets.

 

On 30/09/2018 at 9:50 AM, Oscah said:

Also, is there anyway to change the currency type showing in game for example changing $ to RU or something similar. 

I'll make sure to add this as an option in the next update.

Cheers
 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Hey it would be cool if you could bu multiple items at one time, so you could buy say a gun fully attached out. Or like buy all health/navigation items at one time

Share this post


Link to post
Share on other sites

Any way to add in selling items back to a trader ?

 

i.e drop it all into a ammo crate and sell all items back to the trader to get some money - good way to earn some cash  🙂

 

 

Share this post


Link to post
Share on other sites

Ah, Hello...

I have a "little" question

 

I wanted to script your "addFunds" in a way, that, each players gets an amount of X Money in an intervall of X seconds if a specific Sector (created with the sector module) is controlled by there own faction... So since I'm a completly noob at scripting things like this I really have no clue if this is even possibly.

 

I would be glad if someone can help.

 

So thanks already.

Share this post


Link to post
Share on other sites
On 3/1/2019 at 10:33 AM, 1para{god-father} said:

Any way to add in selling items back to a trader ?

 

i.e drop it all into a ammo crate and sell all items back to the trader to get some money - good way to earn some cash  🙂

 

 

I plan on adding this feature, yes. Currently I have very little free time due to RL stuff. I recommend checking the GitHub because sometimes I'll add features without mentioning. Was planning on adding a temporary script to sell everything in an ammo box (without an UI).

 

45 minutes ago, Nagrach said:

Ah, Hello...

I have a "little" question

 

I wanted to script your "addFunds" in a way, that, each players gets an amount of X Money in an intervall of X seconds if a specific Sector (created with the sector module) is controlled by there own faction... So since I'm a completly noob at scripting things like this I really have no clue if this is even possibly.

 

I would be glad if someone can help.

 

So thanks already.

I've written a very basic script for you and added comments to help you understand:

Spoiler

// We need to spawn this code because we are using sleep which will suspend the script.
// Suspension is not allowed in an unscheduled environment so we need to run it in a scheduled environment.
// So to be extra sure, use spawn.
// More info here https://community.bistudio.com/wiki/Scheduler#Suspension
h = [] spawn {
    // Only run this code on the server
    if !(isServer) exitWith {};

    // If the global variable HALS_TIME_BETWEEN_MONEY exists, exit the script because it is already running
    if (!isNil "HALS_TIME_BETWEEN_MONEY") exitWith {};

	// Edit HALS_TIME_BETWEEN_MONEY, HALS_MONEY_TO_ADD_BASE and HALS_MONEY_TO_ADD_PER_SECTOR below
    // How many seconds between each update
    HALS_TIME_BETWEEN_MONEY = 10;

    // Money to add every update
    HALS_MONEY_TO_ADD_BASE = 100;

    // Additionally money to add for each sector owned by the players side
    HALS_MONEY_TO_ADD_PER_SECTOR = 25;

	/* Dont edit below here */
    // Run this code indefinitely
    while {true} do {
        // Sleep HALS_TIME_BETWEEN_MONEY seconds
        sleep HALS_TIME_BETWEEN_MONEY;

        // Run code for every player
        {
            // Get player and their side
            _unit = _x;
            _side = side group _unit;

            // How many sectors the player's side owns
            _sectors = _side call BIS_fnc_moduleSector;

            // Calculate money to give: MONEY_BASE + MONEY_PER_SECTOR * NUM_SECTORS_OWNED
            _money = HALS_MONEY_TO_ADD_BASE + (HALS_MONEY_TO_ADD_PER_SECTOR * _sectors);

            // Add money
            [_unit, _money] call HALs_money_fnc_addFunds;
        } forEach allPlayers;
    };
};

 

 

  • Like 3

Share this post


Link to post
Share on other sites
Quote

I plan on adding this feature, yes. Currently I have very little free time due to RL stuff. I recommend checking the GitHub because sometimes I'll add features without mentioning. Was planning on adding a temporary script to sell everything in an ammo box (without an UI).

 

Yep that sounds like a great plan as no need for a UI and you can put a lot of stuff back in when you scavenge from dead AI  🙂 get like 50% back from sell price

Share this post


Link to post
Share on other sites

Wow! That was a fast answer! Thank you very much! I will try out as fast as I can.

Share this post


Link to post
Share on other sites

@HallyG - Suggestion:

The first post is pretty much unreadable using dark theme unless I highlight everything. Not sure how many others use the dark theme but maybe use a different text colour?

Share this post


Link to post
Share on other sites

i really like the look of the gui. really slick. hope you figure out the sell aspect of it soon. would love to use this for a single-player STALKER mission.

  • Like 1

Share this post


Link to post
Share on other sites

This is the slickest UI I've seen for Arma 3 so far! Amazing job!

 

Can we get a Inventory/Ammobox version to display and transfer the contents of containers from one to the other faster.

 

That feature would be a god send in Antistasy/Overtrow type missions where you must move around thousands of weapons and items.

Share this post


Link to post
Share on other sites

I need a tutorial for a noob to add money to every enemy IA kill no matter the way they was spawned... step by step please... 😥

 

 

EDIT: Fixed !! but its possible to add vehicles with more money ?

Share this post


Link to post
Share on other sites
On 1/22/2020 at 11:59 PM, Sorrow117 said:

How to enable persistency of this mod ? Money seems to not be saved

 

Check out the post from ghost sniper:


I used the script from ghost sniper, but modified it a little bit. I created an evenhandler to save money when a player presses 'ESC', instead of saving with mouse scroll and click.

How to:

1: Add this script to initplayerlocal.sqf:

[] execVM "savedb.sqf";

private ["_player"];

_player =_this select 0;


waitUntil {!isNull _player};

if (isNil {profileNamespace getVariable "HALs_money_funds"}) then {
    profileNamespace setVariable ["HALs_money_funds", 0];
};

_profile = (profileNamespace getVariable "HALs_money_funds");

_player setVariable ["HALs_money_funds", _profile];



2:  Save this script as savedb.sqf:

 

[] spawn {
    waitUntil {!isNull(findDisplay 46)};

    (findDisplay 46) displayAddEventHandler ["KeyDown", {
        if(_this select 1 == 1) //number 5
        then {

[] execVM "autosave.sqf";              
        };
    }];
};

 

3:  Save this script as autosave.sqf:

 

_moneys = (player getVariable "HALs_money_funds");
profileNamespace setVariable ["HALs_money_funds", _moneys];


// Each time a player press 'Esc' money will be saved. Saved money is loaded when a player connects to the server.
 

Share this post


Link to post
Share on other sites

Updated:
Make enemies drop cash on death, that players can pick up:

Init.sqf:
 

if (isServer) then {

{
_unit = _x;
addMissionEventHandler ["entityKilled", { _this spawn { params ["_unit"];

         _suitcase = "Land_Money_F" createVehicle (getpos _unit);
         [_suitcase,["<t color='#FF0000'>Pick up money</t>","addons\PlayerEvents\Tasks\cash\cashdrop.sqf",[],1,true,true,"","_this distance _target < 3"]] remoteExec ["addAction",0];


} } ];
} forEach (allUnits select {side _x == EAST});

};

 

 

 

cashdrop.sqf:
 

params ["_suitcase","_caller","_id"];
[_caller, 250] call HALs_money_fnc_addFunds;
hint "+250$";
[_suitcase,_id] remoteExec ["removeAction"];
deleteVehicle _suitcase;
_suitcase removeAction 0;
sleep 5;
hintSilent "";


I'm still learning.. To be able to limit the addaction distance i had to split the scripts into two parts. If anyone knows how to run all of it from init.sqf + add target distance on the addaction, please drop a hint.

 

Edited by Blaq G-Sus
corr

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

×