Jump to content
hoverguy

[Release] Simple Weapon Shop System

Recommended Posts

Hi,

It's being saved in the profileNamespace, if you disable peristence it will take start cash value and save it as a normal variable on your player. Its getting annoying if you enable persistency then disable it, re-enable it and you'll get your old cash when you first enabled it so yeah what you want me to do?

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

It's being saved in the profileNamespace, if you disable peristence it will take start cash value and save it as a normal variable on your player. Its getting annoying if you enable persistency then disable it, re-enable it and you'll get your old cash when you first enabled it so yeah what you want me to do?

Thanks man :)

I guess turn it off by default and let it accept the start cash from the config file and go about it from there. IMHO :)

Share this post


Link to post
Share on other sites

I can't seem to get the "starting cash" feature to work. Even in the demo mission, there is no starting cash, regardless of assigned rank. Am I missing something? 

 

Thanks for any insight! 

Share this post


Link to post
Share on other sites

Thanks man :)

I guess turn it off by default and let it accept the start cash from the config file and go about it from there. IMHO :)

I can't seem to get the "starting cash" feature to work. Even in the demo mission, there is no starting cash, regardless of assigned rank. Am I missing something? 

 

Thanks for any insight!

Hi,

Both fixed, download using my link in the first post, thanks.

  • Like 1

Share this post


Link to post
Share on other sites

How did you make the cursor appear when displaying the shop menu?

Share this post


Link to post
Share on other sites

So I loaded the script in, but when I try to add guns other than the default ArmA 3 weapons, everything below that line just stops. For example:

        class Weapons
        {
            displayName = "$STR_HG_SHOP_WEAPONS";
            items[] =
            {
                {"arifle_MXC_F",3500},
                {"arifle_MX_F",3500},
                {"arifle_MXM_F",5500},
                {"arifle_MX_SW_F",5500},
                {"arifle_MX_GL_F",5000},
                {"arifle_MXM_F",13000},
                {"hgun_P07_F",1500}
            };
        };

This works fine, but as soon as I add an APEX weapon or any of my custom downloaded weapons to make it look like this:

        class Weapons
        {
            displayName = "$STR_HG_SHOP_WEAPONS";
            items[] =
            {

                {"arifle_MXC_F",3500},
                {"arifle_MX_F",3500},
                {"arifle_MXM_F",5500},
                {"arifle_MX_SW_F",5500},
                ("arifle_SPAR_01_snd_F",4000),
                ("arifle_SPAR_01_GL_blk_F",6000),
                ("arifle_SPAR_02_snd_F",7000),
                ("arifle_SPAR_03_snd_F",6000),
                ("arifle_AKM_FL_F",5500),
                ("arifle_AK12_F",6000),
                {"arifle_MX_GL_F",5000},
                ("srifle_DMR_02_F",9500),
                ("srifle_DMR_03_F",10000),
                ("srifle_DMR_06_camo_F",10000),
                ("arifle_ARX_blk_F",10000),
                ("hgun_PDW2000_F", 1700),
                ("SMG_01_F",1850),
                {"hgun_P07_F",700},
                ("hgun_ACPC2_F",700),
                ("hgun_Rook40_F",800),
                ("hgun_Pistol_heavy_01_F",900),
                ("hgun_Pistol_heavy_02_F",950)
                
            };
        };

Nothing shows up beyond the arifle_MX_SF_F. Is there a file where I need to show what items to include beyond listing the weapons in the shop?

Share this post


Link to post
Share on other sites
40 minutes ago, Jossiwales said:

So I loaded the script in, but when I try to add guns other than the default ArmA 3 weapons, everything below that line just stops. For example:

        class Weapons
        {
            displayName = "$STR_HG_SHOP_WEAPONS";
            items[] =
            {
                {"arifle_MXC_F",3500},
                {"arifle_MX_F",3500},
                {"arifle_MXM_F",5500},
                {"arifle_MX_SW_F",5500},
                {"arifle_MX_GL_F",5000},
                {"arifle_MXM_F",13000},
                {"hgun_P07_F",1500}
            };
        };

This works fine, but as soon as I add an APEX weapon or any of my custom downloaded weapons to make it look like this:

        class Weapons
        {
            displayName = "$STR_HG_SHOP_WEAPONS";
            items[] =
            {

                {"arifle_MXC_F",3500},
                {"arifle_MX_F",3500},
                {"arifle_MXM_F",5500},
                {"arifle_MX_SW_F",5500},
                ("arifle_SPAR_01_snd_F",4000),
                ("arifle_SPAR_01_GL_blk_F",6000),
                ("arifle_SPAR_02_snd_F",7000),
                ("arifle_SPAR_03_snd_F",6000),
                ("arifle_AKM_FL_F",5500),
                ("arifle_AK12_F",6000),
                {"arifle_MX_GL_F",5000},
                ("srifle_DMR_02_F",9500),
                ("srifle_DMR_03_F",10000),
                ("srifle_DMR_06_camo_F",10000),
                ("arifle_ARX_blk_F",10000),
                ("hgun_PDW2000_F", 1700),
                ("SMG_01_F",1850),
                {"hgun_P07_F",700},
                ("hgun_ACPC2_F",700),
                ("hgun_Rook40_F",800),
                ("hgun_Pistol_heavy_01_F",900),
                ("hgun_Pistol_heavy_02_F",950)
                
            };
        };

Nothing shows up beyond the arifle_MX_SF_F. Is there a file where I need to show what items to include beyond listing the weapons in the shop?

God dammit.. I just now realized I was using () instead of {}... I'm an idiot...

  • Like 3

Share this post


Link to post
Share on other sites

Okay, new question. Is there a script to manually give players cash. For example an addaction to take a pile of cash, delete the cash, and assign all BLUFOR 5,000 each?
I know how to take and delete, just don't know how to assign the players money.

Share this post


Link to post
Share on other sites
8 hours ago, Jossiwales said:

Okay, new question. Is there a script to manually give players cash. For example an addaction to take a pile of cash, delete the cash, and assign all BLUFOR 5,000 each?
I know how to take and delete, just don't know how to assign the players money.

 

Hi,

 

Actually the only way to give/remove cash to/from players is the following:

 

// Add 5000 to all blufor
[5000,0] remoteExecCall ["HG_fnc_addOrSubCash",west,false];

// Remove 5000 from all blufor
[5000,1] remoteExecCall ["HG_fnc_addOrSubCash",west,false];

 

Hope it helps.

 

 

Share this post


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

 

Hi,

 

Actually the only way to give/remove cash to/from players is the following:

 


// Add 5000 to all blufor
[5000,0] remoteExecCall ["HG_fnc_addOrSubCash",west,false];

// Remove 5000 from all blufor
[5000,1] remoteExecCall ["HG_fnc_addOrSubCash",west,false];

 

Hope it helps.

 

 

I haven't tested it but if this works, you are a bloody genius! Thanks so much!

will adding [2000,0] remoteExecCall ["HG_fnc_addOrSubCash",west,false]; to a trigger work? Like upon task completion, pay team 2,000? Or is there a better way to do that?

And thanks again for the response. I've wanted something like this for years!

Share this post


Link to post
Share on other sites

Yes you can do that upon task completion as long as it's only triggered once.

  • Like 1

Share this post


Link to post
Share on other sites

Great script loving it. 

Quick question. How do you change the money to a physical item in game? I've tried but can't figure it out.

Share this post


Link to post
Share on other sites

First of all my humblest Thank You to HoverGuy for creating this weapons shop system (+ Vehicle and Clothing!) and for sharing them!

It's been fun and easy to add the weapons I want to have in my mission so far and I'd like to take the next step in creating the mission but sadly I've hit a snag with a thing so many have before me.

 

I'd like to incorporate a reward system in a mission of mine where a human player gets more cash for killing other (human) players and also for capturing objectives.

 

I've scrambled through the discussion already for a couple of times and saw the couple choices for adding cash for kills (where an eventhandler should be used) but apparently the discussion never ends in an easily comprehensible revelation like "Hey guys, this is how I got my reward system to work, try it out!".

 

I've personally tried using .sqf file ("cashforkill.sqf") to get this to work

Spoiler

 

[] spawn
{
    {
        _x addEventHandler
        [
            "Killed",
            {
                private["_unit","_killer];
                _unit = _this select 0;
                _killer = _this select 1;
       
                if((isPlayer _killer) AND {_killer != _unit}) then
                {
                    private["_oldCash","_newCash"];
                    _oldCash = _killer getVariable "HG_myCash";
                    _newCash = _oldCash + 200;
                    _killer setVariable ["HG_myCash",_newCash];
                };
           
            }
        ];
    } forEach allUnits;

};

 

where I call the "cashforkill.sqf" from the player's Init-line with this null = [this] execVM "cashforkill.sqf";  but as everyone who knows better than me, that doesn't work.

 

Then I tried the other, shorter eventhandler in the player's Init-line and again "as everyone who knows better than me.."

 

What is the easiest way to get "cash for kills" or "cash for capturing objectives" by using only HoverGuy's work?

  • Like 1

Share this post


Link to post
Share on other sites

Hi there,

 

First of all thanks for your support :)

 

I would recommend you to check the GitHub repo I setup couple days ago. There you can find how to add kill reward and many other things as well.

Note that since a week or so kill reward is included (toggleable in main config).

 

I merged all the shops together so I no longer provide support for these individual systems.

 

https://github.com/Ppgtjmad/SimpleShops

  • Like 1

Share this post


Link to post
Share on other sites

Hey hoverguy,

 

and thank you for the continued support of your magnificent shop system!

Btw. have you thought of creating another forum topic for the whole shop system you're now working with?

 

One question also:

 

was there already a way to give rewards using the principles of your shop system's way of giving cash when player's capture for example sectors?

Perhaps something to add in the OnActivation field of a trigger?

  • Like 1

Share this post


Link to post
Share on other sites

I call this on an object, mainly money

Cash.sqf

[150,0] call HG_fnc_addOrSubCash; 
_object = _this select 0; deletevehicle _object;
titleText ["+ $150", "PLAIN DOWN"];

in item init put

this addAction ["take cash", "Cash.sqf"];

 

you can edit that and pretty much use it for anything coz all you need is that first line

[150,0] call HG_fnc_addOrSubCash; 

Thanks HoverGuy for combining them and for helping me with what I wrote above.

 

If I wrote down the right one. Put this into any placed ai in the editor in their on death

unit_name addEventHandler ["Killed",{params ["_unit","_killer"]; if(isPlayer _killer) then {[100,0] remoteExecCall ["HG_fnc_addOrSubCash",_killer,false];};}];

unit_name being the name of the AI you are placing. Its the only way I got it working. Still havnt figured out how to add it to a AI spawn module

  • Like 1

Share this post


Link to post
Share on other sites

Hi guys,

 

I've heard your prayer, I've seen your tears, now there is an easy way to add the required stuff to get AI killed rewards to work, just put this wherever you spawn AIs:

// _AI is the unit
[_AI] call HG_fnc_aiSetup;

https://github.com/Ppgtjmad/SimpleShops/commit/c5c0bbe3bb3d93cd163f6a5d959848bedabb4650

 

And yeah it's so easy to give/sub money (can be called from anywhere, trigger, object init, addAction etc...)

// Sub 500
[500,1] call HG_fnc_addOrSubCash
 
// Add 500
[500,0] call HG_fnc_addOrSubCash

Thanks for using my shops.

Share this post


Link to post
Share on other sites
18 hours ago, hoverguy said:

And yeah it's so easy to give/sub money (can be called from anywhere, trigger, object init, addAction etc...)


// Sub 500
[500,1] call HG_fnc_addOrSubCash
 
// Add 500
[500,0] call HG_fnc_addOrSubCash

Thanks for using my shops.

 

This function would be very powerfull if I would know how every player inside a trigger could get the reward using that function.

Apparently there needs to be something else than just [500,0] call HG_fnc_addOrSubCash placed in the On Activation field of a trigger. Wondering what would that be?

 

edit: see https://github.com/Ppgtjmad/SimpleShops/issues/6 for findings about using call HG_fnc_addOrSubCash in slightly different situations

Share this post


Link to post
Share on other sites
On ‎3‎/‎12‎/‎2017 at 5:38 AM, Asmodeuz said:

 

This function would be very powerfull if I would know how every player inside a trigger could get the reward using that function.

Apparently there needs to be something else than just [500,0] call HG_fnc_addOrSubCash placed in the On Activation field of a trigger. Wondering what would that be?

 

edit: see https://github.com/Ppgtjmad/SimpleShops/issues/6 for findings about using call HG_fnc_addOrSubCash in slightly different situations

Place [500,0] call HG_fnc_addOrSubCash in a script and activate it with a trigger may work.

 

cash.sqf

[500,0] call HG_fnc_addOrSubCash

 

Trigger ativation

[] exec "cash.sqf";

see it that will work for you

Share this post


Link to post
Share on other sites

An awesome mod indeed! If not the.. best even :)

 

I am playing zombies & demons with my friends in Zeus mode maps with ACE, where one player is functioning as zeus entity and creating situations on the fly.

Those zombie heads must be made very valuable the evil Zeus spawns upon us!

Thus I wish there were some "simple" :D tools for Zeus as well to add and remove monies from players.

 

Suggestions for Functions I'd love to have in some Zeus-Ares style interface if you ever have an extra lifetime to add such funsies:

"Save money."   - choices: everyone's - player's - side's

"Set money 0."   - choices: everyone's - player's - side's

"Add/remove money."   - choices: everyone's - player's - side's

"Add/remove shop item."     -could use some arsenal functionality? Like make a loadout and this stuff is sold and add prices in arsenal window.

"Set target kill/destroy value."

"Set target kill/destroy team value."

"Spawn object with value."     -once looted the object would despawn, rewarding the player. Being like intel which you "activate" for 1-5 seconds to "loot" it for monies.

 

And as Ares has that handy "save mission to SQF" -tool, this could use something similar to save money amounts since we can't use the game's own "save game" feature due to mods not loading for zeus when reloading a multiplayer game.

Ahh the difficulties of life :D

 

Keep up the good work man :)

Edited by Powershard
details and .. simplifications

Share this post


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

 

Hi,

 

Make sure you include required functions in the library (in description.ext):

class CfgFunctions 
{
	#include "HG\Functions\HG_Functions.h"
};

 

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

×