Jump to content
7erra

[Release] Virtual Arsenal Shop System

Recommended Posts

Posted (edited)

Virtual Arsenal Shop System

by 7erra

20181010194142_1.jpg

 

https://github.com/7erra/Arsenal-Shop

http://www.armaholic.com/page.php?id=34506

 

Information

This script turns the Arsenal into a shop where each defined item costs money. The whole system is customizable to a certain extent. Open the config.sqf for more information.

 

Setup

  1. Add the following lines to your description.ext:
  2. class CfgFunctions
    {
    	#include "arsenalShop\cfgFunctions.hpp"
    };

     

  3. Move the arsenalShop folder to your mission folder
  4. Modify the config.sqf to your likeing
  5. Add an arsenal via [this] call TER_fnc_addArsenal in the init line of the object

 

Functions

There are some functions which the system uses. The most useful ones are documented in their respective files (arsenalShop\fnc\fn_X.sqf) and the functions viewer.
Currently available functions:

  • TER_fnc_addArsenal
  • TER_fnc_itemCostFromTable
  • TER_fnc_compareLoadout
  • TER_fnc_arrayChange


Download

https://github.com/7erra/Arsenal-Shop

 

Changelog

Spoiler

v1.4 - cfgFunctions (14.10.2018)

! IMPORTANT ! The setup of the system has changed. Please refer to the readme.

+ TER_fnc_addArsenal can now be called from the init of an object

+ Credit link when ui is hidden

+ Functions library

~ Backpack names are now displayed correctly in the purchase detail listbox

~ Buy button moved to the purchase detail listbox

~ You no longer can buy undefined items or shop unrelated items

~ Color of the price is now green
~ File structure with better overview

 

v1.3 - Safety and UI (10.10.2018)

+ New functions:

   + TER_fnc_compareLoadout

   + TER_fnc_arrayChange

+ Purchase details

~ All functions and the cost array are now unchangeable during mission

~ The controls bar will now stay hidden

- Seperate control for displaying the cost of an item it is now displayed on the listbox instead

 

v1.2 - Better Refunding (07.10.2018)

+ Refunding of items in containers (uniform, vest, backpack)

~ Selecting a new weapon won't add 4 free magazines, neither does removing a weapon delete the compatible mags

 

v1.1 - Refunding (06.10.2018) 

+ Refunding

~ more versatile TER_fnc_addArsenal (see config.sqf)

 

v1 - Release (05.10.2018)

You can make suggestions and report bugs here in the forums or open an issue on GitHub here. There you can also find all planned features.

 

Have fun,

7erra

Edited by 7erra
v1.4
  • Like 13
  • Thanks 3

Share this post


Link to post
Share on other sites

This is Great !

 

Congratulations and thanks 7erra !

 

I will ask if it is possible to edit this , or make an edit for Ravage ?

Since this script , will be very helpful !

 

Thanks again !

Share this post


Link to post
Share on other sites
1 hour ago, GEORGE FLOROS GR said:

I will ask if it is possible to edit this , or make an edit for Ravage ?

I have never worked with Ravage before so I'm not familliar with the currency system and the shop system. I will take a look though :)

  • Thanks 1

Share this post


Link to post
Share on other sites

This is great script just what I needed for my new project. Thanks 7erra!

 

Question, can you sell items?

 

Share this post


Link to post
Share on other sites
9 minutes ago, gc8 said:

Question, can you sell items?

Not yet. I'm was running into a problem but I might have a lead now. The next update should fix this.

  • Thanks 2

Share this post


Link to post
Share on other sites
4 hours ago, 7erra said:

Ravage

 

Thank you very much 7erra !

 

If you have more news it would be good to make a post also to ravage topic , there are a lot of followers there , who would like this feature !

Share this post


Link to post
Share on other sites

Sure. You can use the BIS_fnc_addVirtualXXXCargo commands to add specific items to an arsenal. The shop system applies to any Arsenal that is opened. I will modify the addArsenal function so you can add specific items/types and put it in the next update which will also add the possibilty to sell items @gc8 ;) Thanks for the ideas :thumbsup:

  • Thanks 1

Share this post


Link to post
Share on other sites

@7erra Just tested it, works great!

Share this post


Link to post
Share on other sites

Hi 

 

little question , i'm working on a mission

i would like to add money when i kill somoene 

how can i add money from kill ?   (i will out the command in the init of the ennemy)

 

thanks for your help and sorry for my english

Share this post


Link to post
Share on other sites
11 minutes ago, Davinel said:

Hi 

 

little question , i'm working on a mission

i would like to add money when i kill somoene 

how can i add money from kill ?   (i will out the command in the init of the ennemy)

 

thanks for your help and sorry for my english

Try this:
 

this addEventHandler ["Killed", {
	params ["_unit", "_killer", "_instigator", "_useEffects"];
	_killer setVariable ["TER_money",1000];
	_killer hint "You recieved 1000$";
}];


Note that this code has to be put in the unit which will be killed, if you let players fight AI, then put this into the AI, if it's PvP then put it in every players init.

  • Sad 1

Share this post


Link to post
Share on other sites
18 minutes ago, KokaKolaA3 said:

Try this:
 


this addEventHandler ["Killed", {
	params ["_unit", "_killer", "_instigator", "_useEffects"];
	_killer setVariable ["TER_money",1000];
	_killer hint "You recieved 1000$";
}];


Note that this code has to be put in the unit which will be killed, if you let players fight AI, then put this into the AI, if it's PvP then put it in every players init.

 

 

it work thank you 

but it change the value and not add value to the current variable. i try to figure it how to add value to the variable 

Share this post


Link to post
Share on other sites
10 minutes ago, Davinel said:

 

 

it work thank you 

but it change the value and not add value to the current variable. i try to figure it how to add value to the variable 

Hm, right. 
I'm not good at scripting, so this may not work or may not be the easiest way, but try this:

this addEventHandler ["Killed", {
	params ["_unit", "_killer", "_instigator", "_useEffects"];
	_money = _killer getVariable ["TER_money"];
	_money + 500;
	_killer setVariable ["TER_money", _money];
	_killer hint "You recieved 500$";
}];

 

Share this post


Link to post
Share on other sites
1 hour ago, KokaKolaA3 said:

this addEventHandler ["Killed", {
	params ["_unit", "_killer", "_instigator", "_useEffects"];
	_money = _killer getVariable ["TER_money"];
	_money + 500;
	_killer setVariable ["TER_money", _money];
	_killer hint "You recieved 500$";
}];

 

Eh close enough:

this addEventHandler ["Killed", {
	params ["_unit", "_killer", "_instigator", "_useEffects"];
	_money = _killer getVariable [TER_moneyVariable,0];// get the variable, if not defined use default (0)
	_money = _money + 500;//add kill reward
	_killer setVariable [TER_moneyVariable, _money];
	"You received 500$" remoteExec ["hint",_killer];// execute code local on the pc of the killer
}];

 

  • Like 2

Share this post


Link to post
Share on other sites

Just released another update:

v1.2 - Better refunding

  • Refunding of items in containers (uniform, vest, backpack)
  • Selecting a new weapon won't add 4 free magazines, neither does removing a weapon delete the compatible mags

I finally got a grasp of how the default Arsenal handles it's stuff (the script is 3206 lines long :thud:) so future editing should be easier.

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

Actually you can just do something like this:  

 

in initServer.sqf:

 

#include "scripts\fnc_BountyPayout.sqf"

 

with fnc_BountyPayout.sqf being:

 

fnc_BountyPayout = addMissionEventHandler ["EntityKilled", 
{
	_killed = _this select 0;
	_killer = _this select 1;
	
	_killedSide = (side group _killed);
	_killedFaction = faction _killed;
	
	
	if (_killedSide == resistance) then
	{
		if (isplayer _killer) then
		{
			_money = _killer getVariable [TER_moneyVariable,0];// get the variable, if not defined use default (0)
			_money = _money + 500;//add kill reward
			_killer setVariable [TER_moneyVariable, _money];
		};
	};
	
	if (_killedSide == east) then
	{
		if (isplayer _killer) then
		{
			_money = _killer getVariable [TER_moneyVariable,0];// get the variable, if not defined use default (0)
			_money = _money + 500;//add kill reward
			_killer setVariable [TER_moneyVariable, _money];
		};
	};
	
	if (_killedSide == civilian) then
	{
		if (isplayer _killer) then
		{
			0 = [_killer] execVM "scripts\fnc_CivilianKilledPenalty.sqf";
			
		};
	};
	 
	// Player death
	if (_killedSide == west) then
	{
		if (isplayer _killed) then
		{
			
		};
	};
}];

You could even expand this into certain vehicles.

 

Say you have a array of Jeep classnames...

 

{
        if (typeOf _killed == _x) then 
        {
           _money = _killer getVariable [TER_moneyVariable,0];// get the variable, if not defined use default (0)

          _money = _money + 500;//add kill reward

          _killer setVariable [TER_moneyVariable, _money];
        };
    } forEach Jeeps;

 

 

Or even specify infantry classnames if you like.....

 

 

sidebar over  :don11:

  • Like 1

Share this post


Link to post
Share on other sites

7erra,

 

Is there a way to disable the loading of saved loadouts with this script?  That way peeps can't hack in stuff.  In other words, does this overwrite any arsenal that a player may access?  (like with personal arsenal)

Share this post


Link to post
Share on other sites
58 minutes ago, accuracythruvolume said:

Is there a way to disable the loading of saved loadouts with this script?  That way peeps can't hack in stuff.  In other words, does this overwrite any arsenal that a player may access?  (like with personal arsenal)

I disabled all controls which could get you items for free. The script is run EVERY time an Arsenal is opened, regardless of the circumstances. Therefore there is no way to circumvent the system (at least that I know of). I already have some other possible exploits in mind which I'll try to fix.

 

On that note: I intend to make the whole system safer in a future update. Atm I went for an easy setup for small groups who want to play fair.

  • Like 1

Share this post


Link to post
Share on other sites

Update v1.3 - Safety and UI

All right the system is now in a state which I'd call finished. I fixed some minor bugs and added everything that I could think of. Of course I tested the new version but if there are any bugs then please report them. All changes can be found in the original post. The picture is up-to-date.

 

7erra

 

Spoiler

PS: Try out the black beret in the arsenal :wink_o:

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@7erra

 

This is great, well done. Exactly what I was looking for.

 

Atmo

Share this post


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

Changelog in OP still stops at 1.2  :drinking:

You sure? It says 1.3 in my browser?

 

Cheers! :drinking2:

Share this post


Link to post
Share on other sites

Update v1.4 - cfgFunctions

Developement still continues as I notice quirks and errors unintended features. The changelog in the orignial post is up-to-date.

 

7erra

  • Like 1
  • Thanks 1

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

×