Jump to content
7erra

[Release] Virtual Arsenal Shop System

Recommended Posts

VASS - Virtual Arsenal Shop System

F86551B593493C320A8C3E91EFE0D21768BED165

Introduction

VASS provides a simple to setup shop system and is the successor to the Arsenal Shop. The system provides several functions to handle traders and items. As of now it does not come bundled with an economy system but the implementation of an external one is easily possible.

 

Setup

Enable system:

  1. Download the GitHub repo: https://github.com/7erra/VASS-Virtual-Arsenal-Shop-System
  2. Check the example mission (Mission.VR)
    1. Copy the VASS folder to your mission
    2. Add the lines from the description.ext

 

Add trader:

  1. Execute the addShop function: [this] call TER_fnc_addShop
  2. Add an inventory with the addShopCargo function: [this, ["itemclass0", 15, 5, ..., "itemClassN", price, amount]] call TER_fnc_addShopCargo

For easier setup of this cost table I have created a mod that does this task with a user interface: https://steamcommunity.com/sharedfiles/filedetails/?id=1760193128. The settings can be changed by opening the object's attribute window and scrolling down to the "VASS" section.

 

Handle money:

  1. Edit the TER_fnc_VASShandler in "VASS\fnc\fn_VASShandler.sqf"
  2. Change the getMoney and setMoney functions to match your economy system

 

Documentation

GitHub will have a wiki on all aspects of the system. In addition to that all relevant functions have a header at the beggining of the file to show you what arguments they expect and what they do.

 

Further links

GitHub: https://github.com/7erra/VASS-Virtual-Arsenal-Shop-System

VASS 3den mod: https://steamcommunity.com/sharedfiles/filedetails/?id=1760193128

BI forums: https://forums.bohemia.net/forums/topic/219677-release-virtual-arsenal-shop-system/

 

Screenshots

8VnH0QC.jpg    nHUipiq.jpg  

 

3denAttributes.jpg    3denCargo.jpg

 

That's all for now and I hope that you find this useful!

 

7erra

 

 

DISCLAIMER - This post was edited nearly a year after the original post. Don't expect comments from the previous discussion (up until page 5) to be applicable to the new system

Edited by 7erra
Updated for v2.1.0
  • Like 16
  • Thanks 6

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?

 

  • Like 1

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.

  • Like 1
  • 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:

  • Like 1
  • Thanks 1

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

×