Jump to content

Recommended Posts

Looking to use this system in an upcoming campaign, but I don't know how the persistent saving is called. I'd like to use the profle save type since I don't have to fiddle around with an external database.

 

Is there a function I can call manually to save Simple Shops stuff?

 

EDIT: Specifically looking to ensure that bought vehicles that aren't stored in a garage are saved where they are currently sitting in the world.

 

Edited by Robert Tyburne
Clarification

Share this post


Link to post
Share on other sites

Hi @Robert Tyburne

 

On 12/20/2019 at 5:51 PM, Robert Tyburne said:

EDIT: Specifically looking to ensure that bought vehicles that aren't stored in a garage are saved where they are currently sitting in the world.

 

A little bit of explanation:

 

Player buys a vehicle

- Vehicle is spawned

- A variable is set on that vehicle and is then broadcasted, that variable contains the owner steam64 ID and a random number that serves as a "plate" number (unique identification)

- Vehicle is inserted into database or saved in server's profile and active variable is set to 1

 

Player opens garage

- Server searches for vehicles owned by that player (in profile or in db according to savingMethod), finds them and returns those with active var = 0

- Dialog displays available vehicles

 

Player stores a vehicle

- Vehicle is deleted from world

- The active variable is set to 0 (in profile or in db)

 

Player disconnects (only works if storeVehiclesOnDisconnect is set to true in HG_Config.h)

- Server scans all vehicles and filter out those that belong to the player (with the help of the variable set on it)

- Destroyed vehicles are removed from the result

- Vehicles are deleted

- The active variable is set to 0 (in profile or in db) for every vehicle

 

There is also this parameter resetGaragesOnServerStart that

- When set to false, will switch the active status on vehicles to 0, meaning that they're available in the garage again

- When set to true, will DELETE every vehicles (from profile or from db), meaning that garage will be empty for everyone

 

So to answer your concern, storeVehiclesOnDisconnect is set to true by default meaning that you don't have to worry about vehicles not being saved because they're removed from the world as explained above.

If you set both storeVehiclesOnDisconnect and resetGaragesOnServerStart to false, all the vehicles will stay available in the world when the owner disconnects and available in your garage once server restarts.

The downside with the second method is: Let's say you disconnect, one of your vehicle is destroyed by another player, that vehicle will be available again when server restarts... simply because there is no thread that monitors what happens to the vehicle when you're not in game.

 

Thanks for using SimpleShops!

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Gotcha, so all the saving is actually being triggered specifically on player disconnect. Is there a way to call those saves through say an addaction script instead? I have a save script that's calling the particular save functions of two other systems that I'm using, and being able to save Simple Shops vehicles through that same way would make for better flow to ensure all the things that need saving are synced in some way. Ideally without using the garage at all, as I'd like to physically limit the amount of space in the motorpool.

 

For instance, if players clear a place then disconnect but forget to hit the save button back at base, and the server restarts, I wouldn't want their vehicles to stay in what would be an active AO again.

Share this post


Link to post
Share on other sites

I've been struggling with this for a while. How do I spawn objects to 70 meters? The mission is based on a carrier. Cars spawn on top but the aircraft spawn below it. 

Share this post


Link to post
Share on other sites
On 5/22/2019 at 8:42 AM, hoverguy said:

Hello @C.Hall

 

I presume that you're using profile namespace as saving method and that the mission is not hosted in that case this code will reset saved stats for you:


uid = getPlayerUID player;
["HG_Cash","HG_Bank","HG_XP","HG_Kills","HG_Gear","HG_Garage"] apply {profileNamespace setVariable [format["%1_%2",_x,uid],nil]; saveProfileNamespace;};

Load up the editor, open the debug console and copy/paste this code then exec local.

 

Thank you so much for this. Is there a way to clear off everyone's progress in one go? We've been testing the mission off and on and I can't remember everyone who had helped me test to get their UIDs.

 

Is the progress tied to the mission name? Could I just rename the mission for everyone's progress to start anew?

Share this post


Link to post
Share on other sites

Hello @NikoWZRD

 

On 1/14/2020 at 11:36 AM, NikoWZRD said:

 

Thank you so much for this. Is there a way to clear off everyone's progress in one go? We've been testing the mission off and on and I can't remember everyone who had helped me test to get their UIDs.

 

Is the progress tied to the mission name? Could I just rename the mission for everyone's progress to start anew?

 

The progress is saved in server's profile (if savingMethod is set to "Profile" in HG_Config.h), the only way to reset it is to either use that code above or delete the <name>.vars.Arma3Profile file

 

To avoid the hassle you could just setup a database, this way you can reset everything in one go... or nil out variables on server start like so (only works with "Profile" as savingMethod):

 

if(!isNil {parsingNamespace getVariable "HG_Profile"}) then
{
    private["_vars","_strs","_str"];

    _vars = parsingNamespace getVariable "HG_Profile";
    _strs = ["hg_cash","hg_bank","hg_xp","hg_kills","hg_gear","hg_garage"];

    {
        _str = _x;

        {
            if([_str,_x,false] call BIS_fnc_inString) then
            {
                profileNamespace setVariable [_x,nil];
                saveProfileNamespace;
            };
        } forEach _vars;
    } forEach _strs;
};

Put that code at the end of HG\Setup\fn_serverInitialization.sqf

 

On large scale missions I recommend using a database though...

  • Like 1

Share this post


Link to post
Share on other sites
41 minutes ago, hoverguy said:

Hello @NikoWZRD

 

 

The progress is saved in server's profile (if savingMethod is set to "Profile" in HG_Config.h), the only way to reset it is to either use that code above or delete the <name>.vars.Arma3Profile file

 

To avoid the hassle you could just setup a database, this way you can reset everything in one go... or nil out variables on server start like so (only works with "Profile" as savingMethod):

 


if(!isNil {parsingNamespace getVariable "HG_Profile"}) then
{
    private["_vars","_strs","_str"];

    _vars = parsingNamespace getVariable "HG_Profile";
    _strs = ["hg_cash","hg_bank","hg_xp","hg_kills","hg_gear","hg_garage"];

    {
        _str = _x;

        {
            if([_str,_x,false] call BIS_fnc_inString) then
            {
                profileNamespace setVariable [_x,nil];
                saveProfileNamespace;
            };
        } forEach _vars;
    } forEach _strs;
};

Put that code at the end of HG\Setup\fn_serverInitialization.sqf

 

On large scale missions I recommend using a database though...

 

This is great, I really appreciate your super fast reply! This isn't a large scale mission, probably only have about 8-12 people total. It's been in testing for the longest time and we're about to go live on Saturday, so I just wanted all the testers to start clean.

 

Does the inventory/garage/etc carry into other missions using the same scripts then? That could be very interesting to play with.

Share this post


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

Does the inventory/garage/etc carry into other missions using the same scripts then? That could be very interesting to play with.

 

The answer is yes as long as the same profile is used by the server

  • Like 1

Share this post


Link to post
Share on other sites
On 1/15/2020 at 4:41 PM, hoverguy said:

 

The answer is yes as long as the same profile is used by the server

 

On 1/15/2020 at 3:15 PM, hoverguy said:

Hello @NikoWZRD

 

 

The progress is saved in server's profile (if savingMethod is set to "Profile" in HG_Config.h), the only way to reset it is to either use that code above or delete the <name>.vars.Arma3Profile file

 

To avoid the hassle you could just setup a database, this way you can reset everything in one go... or nil out variables on server start like so (only works with "Profile" as savingMethod):

 


if(!isNil {parsingNamespace getVariable "HG_Profile"}) then
{
    private["_vars","_strs","_str"];

    _vars = parsingNamespace getVariable "HG_Profile";
    _strs = ["hg_cash","hg_bank","hg_xp","hg_kills","hg_gear","hg_garage"];

    {
        _str = _x;

        {
            if([_str,_x,false] call BIS_fnc_inString) then
            {
                profileNamespace setVariable [_x,nil];
                saveProfileNamespace;
            };
        } forEach _vars;
    } forEach _strs;
};

Put that code at the end of HG\Setup\fn_serverInitialization.sqf

 

On large scale missions I recommend using a database though...

 

Heya, sorry to keep bugging. I used the above script but I think it actually forced me to spawn naked and with $0, instead of the starter kit & starter money. Did I do something wrong, is there a way around this or should I just find the profiles and delete them?

Share this post


Link to post
Share on other sites

hoverguy  thank for the amazing script i really like it 

and i used it on many missions. but yesterday i tried to add your script to Ravage mod the problem i got i cant figure out

how to use ravage currency as default currency for the shop script

thank you

 

Share this post


Link to post
Share on other sites

if you use the extDB3 database will the garage function normally?

Share this post


Link to post
Share on other sites
On 2/29/2020 at 7:18 AM, Lynxman said:

hoverguy  thank for the amazing script i really like it 

and i used it on many missions. but yesterday i tried to add your script to Ravage mod the problem i got i cant figure out

how to use ravage currency as default currency for the shop script

thank you

 

 

You don't need to change anything.

 

On your HG Store config give Ravage's Back Notes a sell value, like 900 $.

 

Now you will be able to sell each Bank Notes you collect and earn 900 $ in HG Currency to buy whatever you want!

 

Problem solved no coding needed! 

Share this post


Link to post
Share on other sites

1.Perhaps it has already been implemented!?

I want to change the HC currency to game points and vice versa, for example, 30 points(score) = $ 1 (ATM-currency exchange) ?

 

2. Can I do if storeVehiclesOnDisconnect = false then a sanction, for example, $ 100?
The player himself must put the equipment in the garage.

Edited by VitalyTurboVaz
added a question

Share this post


Link to post
Share on other sites
On 4/3/2020 at 7:13 AM, basba66 said:

if you use the extDB3 database will the garage function normally?

 

Hi @basba66

 

Yes it will, note that if you were using profile saving before switching to extDB3 all you vehicles will be "lost" (not really lost, still saved in profile just not in database).

 

On 6/2/2020 at 3:07 PM, VitalyTurboVaz said:

1.Perhaps it has already been implemented!?

I want to change the HC currency to game points and vice versa, for example, 30 points(score) = $ 1 (ATM-currency exchange) ?

 

2. Can I do if storeVehiclesOnDisconnect = false then a sanction, for example, $ 100?
The player himself must put the equipment in the garage.

 

Hi @VitalyTurboVaz

 

1. That's actually a good idea, adding it to my todo list. 

2. Could you be more specific?

Share this post


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

 

Hi @basba66

 

Yes it will, note that if you were using profile saving before switching to extDB3 all you vehicles will be "lost" (not really lost, still saved in profile just not in database).

 

  

Hi @VitalyTurboVaz

 

1. That's actually a good idea, adding it to my todo list. 

2. Could you be more specific?

 

Hey dear @hoverguy

 

Since this has reactivated a little, may I ask for the functionality to use the newly pick able money that OLD MAN  introduced so we can drop money and money is actually a physical object in our inventory? 

 

That would be awesome! 😉

Share this post


Link to post
Share on other sites

Hey, @hoverguy, I'm getting an error with the trader (selling) system. 

 

If I have a primary or secondary weapon in my backpack, vest, or uniform I get an error in the "fn_getConfig.sqf" script in line 11.

 

I can remove all attachments and ammo from the weapon and still receive the error.

 

But when I move that weapon to the primary or secondary weapon slot, I can then see the weapon, and my set prices, and I no longer get the error.

 

 

.sqf location "HG\Functions\Client\Generic\fn_getConfig.sqf"

 

The error type stated is : Type array, expected String

 

|#| = error location in script.

case(isClass(configFile >> "CfgMagazines" |#|>> _item)): {"CfgMagazines"};

 

 

(RHSUSAF RHSAFRF RHSGREF weapon mods are being used)

 

Is there any known solutions I can use to fix this error?

Thank you for your time! 😁

Share this post


Link to post
Share on other sites
On 6/16/2020 at 10:19 AM, Kelsey Allen said:

Hey, @hoverguy, I'm getting an error with the trader (selling) system. 

 

If I have a primary or secondary weapon in my backpack, vest, or uniform I get an error in the "fn_getConfig.sqf" script in line 11.

 

I can remove all attachments and ammo from the weapon and still receive the error.

 

But when I move that weapon to the primary or secondary weapon slot, I can then see the weapon, and my set prices, and I no longer get the error.

 

 

.sqf location "HG\Functions\Client\Generic\fn_getConfig.sqf"

 

The error type stated is : Type array, expected String

 

|#| = error location in script.


case(isClass(configFile >> "CfgMagazines" |#|>> _item)): {"CfgMagazines"};

 

 

(RHSUSAF RHSAFRF RHSGREF weapon mods are being used)

 

Is there any known solutions I can use to fix this error?

Thank you for your time! 😁

 

Hi @Kelsey Allen

 

I added support for weapons in uniforms/vests/backpacks. Note that attached accessories and magazines won't show up in the list. I pushed the update on github, here is the modified file https://github.com/Ppgtjmad/SimpleShops/blob/master/HG/Functions/Client/Trader/fn_refreshTrader.sqf copy/paste it.

 

Thanks for using SimpleShops!

  • Like 2

Share this post


Link to post
Share on other sites
On 6/13/2020 at 12:26 PM, LSValmont said:

 

Hey dear @hoverguy

 

Since this has reactivated a little, may I ask for the functionality to use the newly pick able money that OLD MAN  introduced so we can drop money and money is actually a physical object in our inventory? 

 

That would be awesome! 😉

 

9 hours ago, hoverguy said:

 

Hi @Kelsey Allen

 

I added support for weapons in uniforms/vests/backpacks. Note that attached accessories and magazines won't show up in the list. I pushed the update on github, here is the modified file https://github.com/Ppgtjmad/SimpleShops/blob/master/HG/Functions/Client/Trader/fn_refreshTrader.sqf copy/paste it.

 

Thanks for using SimpleShops!

 

What about me :down: 😭

 

  • Haha 1

Share this post


Link to post
Share on other sites
On 6/13/2020 at 6:26 PM, LSValmont said:

 

Hey dear @hoverguy

 

Since this has reactivated a little, may I ask for the functionality to use the newly pick able money that OLD MAN  introduced so we can drop money and money is actually a physical object in our inventory? 

 

That would be awesome! 😉

 

17 hours ago, LSValmont said:

 

 

What about me :down: 😭

 

 

Hi @LSValmont

 

Could you share a link to this?

 

Share this post


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

 

 

Hi @LSValmont

 

Could you share a link to this?

 

 

OLD MAN content is already in the game, BI Devs are in the process of documenting it but you can already use the assets with a little experimentation.

 

In fact HALs Equipment Store is already using it and have a money dropping/pick up system implemented already. 

 

 

Share this post


Link to post
Share on other sites
On 6/18/2020 at 4:46 AM, hoverguy said:

 

Hi @Kelsey Allen

 

I added support for weapons in uniforms/vests/backpacks. Note that attached accessories and magazines won't show up in the list. I pushed the update on github, here is the modified file https://github.com/Ppgtjmad/SimpleShops/blob/master/HG/Functions/Client/Trader/fn_refreshTrader.sqf copy/paste it.

 

Thanks for using SimpleShops!

Thank you @hoverguy! Weapons in equipment can be sold now! But backpacks and vests in equipped the backpack not functioning. In the trader UI it says "truex" or "falsex" before each backpack or vest name. Displays price but the item can not be sold.

 

[error in line 237(arma) line 89 (in .sqf)

 

`... m]; (findDisplay 9200 displayCtrl 9204) |x|tvSetValue ...`

 

error type

[Error type bool, expected number]

 

Is there possibly any other files I need to update or reconfigure to get this to work? Or do you believe it is an issue within the "fn_refreshTrader" script?

  • Like 1

Share this post


Link to post
Share on other sites

Each side should have its own store with equipment and inventory.
Own currency that can be exchanged at an ATM at the exchange rate.
If there are several parties, then you need permission, which side sees the indicators on the display, in the store, in HUD, XP ... At the points of the trader you can sell and buy equipment the other side.

 

Share this post


Link to post
Share on other sites

installed the extDB3 database, but the destroyed vehicle still appears in the garage after the server restart.  this is normal ?

Share this post


Link to post
Share on other sites

Hi everyone,

 

I released an update that includes a units shop.

https://github.com/Ppgtjmad/SimpleShops/commit/1af64c6870a4e555d9a1bb1071edcdf4c629bed7

 

I'll work on a "garage system" to store/retrieve units as well for persistency (database saving only). 

 

On 8/20/2020 at 1:36 PM, basba66 said:

installed the extDB3 database, but the destroyed vehicle still appears in the garage after the server restart.  this is normal ?

 

Also spawning a thread that monitors the state of a vehicle and updates the database accordingly.

  • 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

×