Jump to content
hoverguy

[Release] Simple Weapon Shop System

Recommended Posts

looks really nice... i think im going to add this to our king of the hill server too ^^

just need to figure out how to replace the money payment with a level based one..

get weapon x with level y etc

but what i have seen so far this should be possible to get it working with a few tweaks here and there...

 

keep up the good work! B)

 

Thanks man, yup weapon tier based on levels is something I wanted to implement, probably in a next release :)

 

I'll also release a XP system right after the vehicle shop, so stay tuned.

Share this post


Link to post
Share on other sites

Here are some ideas:

 

- blacklist mode - in this mode EVERY item is available in the shop, except for ones defined in some config or something

- combined with above: generic price for any item depending on type (ie. pistol is cheaper then rifle and so on), with ability to define price for specific items

- cash for completed tasks

Share this post


Link to post
Share on other sites

Here are some ideas:

 

- blacklist mode - in this mode EVERY item is available in the shop, except for ones defined in some config or something

- combined with above: generic price for any item depending on type (ie. pistol is cheaper then rifle and so on), with ability to define price for specific items

- cash for completed tasks

 

- You can already blacklist weapons/items/scopes etc... you just need to make your own shop in the config file

- You can already define your own prices

- That is a user specific request which is out of bound, the goal here is to provide a simple weapon shop not a complete cash system

 

Thanks for your suggestions tho, I appreciate :)

Share this post


Link to post
Share on other sites

Hi,

 

So basically you want different shops on different parts of the map? So you want to be able to choose what shop you want to display right? Will be in the next update, thanks for your suggestion.

 

So far next update will include:

- Configurable kits (recon, rifleman etc...)

- Ability to choose what shop you want to display (better shop customization)

 

sorry for the late reply  have been busy :(   thanks for implenting the multi shop system :)   can't wait for the update :) 

Share this post


Link to post
Share on other sites

Update
- v 1.2 -
Ability to choose what shop you want to display (better shop customization)
And some minor additions...

  • Like 3

Share this post


Link to post
Share on other sites

Really nice Script! Especially the UI stuff...

 

To make ACE items work i had to add the id '4096' in fn_handleItems.sqf

 

Question: This it not really cheat proof right? Do you plan to make the cash variable global (checked by server)?

Share this post


Link to post
Share on other sites

Really nice Script! Especially the UI stuff...

 

To make ACE items work i had to add the id '4096' in fn_handleItems.sqf

 

Question: This it not really cheat proof right? Do you plan to make the cash variable global (checked by server)?

Thanks for your feedback. I know I forgot to add some of the item types (4096 in your case), hence why I decided to display a hint when the script does not know what to do with this kind of items. I was waiting for feedback on this very point, now I know I'll update the script :)

As for the security side of things, thats not part of the system and never will be. But I can lay a hand if you can't live without it :p

Share this post


Link to post
Share on other sites

hoverguy, the shop window seems so small to me. How can I resize it (at least more width)?

And I don't see the price.

Share this post


Link to post
Share on other sites

As for the security side of things, thats not part of the system and never will be. But I can lay a hand if you can't live without it :P

No problem, i just take some snippets from my legacy code to use it with a player db...

Share this post


Link to post
Share on other sites

Great idea!

 

one question...how does the player aquire cash?

 

also...in the shop window i cant see the prices of weapons,nor how much cash the player currently has....is there a way to do this?

Share this post


Link to post
Share on other sites

Great idea!

 

one question...how does the player aquire cash?

 

also...in the shop window i cant see the prices of weapons,nor how much cash the player currently has....is there a way to do this?

You can add an eventhandler to the each npc/unit that adds cash on kill:

1. Yes you can compile all the fncs, or you can use the CfgFunctions method

2. disableSerialization is needed when you want to store displays/controls in variables

3. You set the variable HG_myCash on player's initialization using setVariable (player setVariable["HG_myCash",15000]), then maybe something like this:

 

[] 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;

};

To display cash, you just print the players HG_myCash variable.

Share this post


Link to post
Share on other sites

Great idea!

 

one question...how does the player aquire cash?

 

also...in the shop window i cant see the prices of weapons,nor how much cash the player currently has....is there a way to do this?

Thanks. How does the player earn money is up to you, check the 5th post there's a piece of answer.

Can you send a screenshot of what you see in game when you open the dialog? You can click the piggy bank icon in the dialog to display your current cash or print the HG_myCash variable whenever you want.

I can maybe add the amount of cash you have in the HUD if you'all guys want it?

Share this post


Link to post
Share on other sites

OK, I can see the right text in all the fields

 

 

in the shop window i cant see the prices of weapons

Check your stringtable.xml for the correct text existence  in sections.

 

hoverguy, how to increase the window width? some text doesn't hold in a field

d21bc8666ce356bde087e03fedcb038d.jpeg

Share this post


Link to post
Share on other sites

OK, I can see the right text in all the fields

 

 

Check your stringtable.xml for the correct text existence  in sections.

 

hoverguy, how to increase the window width? some text doesn't hold in a field

d21bc8666ce356bde087e03fedcb038d.jpeg

 

I didn't want to make it too big you know, that's why you can see a tooltip where you mouse hover over the items in the list. If you really want to see the whole name just decrease text size otherwise you'll have to make the whole dialog bigger...

Share this post


Link to post
Share on other sites

amazing looks brilliant and so easy to use excellent work looking forward to using it and seeing more of your work keep up the excellent work 

Share this post


Link to post
Share on other sites

amazing looks brilliant and so easy to use excellent work looking forward to using it and seeing more of your work keep up the excellent work cunt 

 

I don't know how am I supposed to take it but eh thanks anyways.

  • Like 1

Share this post


Link to post
Share on other sites

I don't know how am I supposed to take it but eh thanks anyways.

lol that word c*** doesnt feature in his original post any more. Maybe a typo.. forgive him :)

  • Like 1

Share this post


Link to post
Share on other sites

How can I remove action 'Open shop' after closing the dialog?

 

I has added

 

_player addAction["<img image=HG_SWSS\UI\gun.paa' size='1.5'/><t color='#FF0000'>Open Weapons Shop</t>", {["HG_DefaultShop] call HG_fnc_dialogOnLoadItems; id_shop = _this select 2},"",0,false,false,"",'(alive player) && !dialog']; - into 'initPlayerLocal'

and

player removeaction id_shop; - into 'fn_dialogOnLoadItems'

 

but the action removes after 2nd dialog's opening\closing only

Share this post


Link to post
Share on other sites

How can I remove action 'Open shop' after closing the dialog?

 

I has added

 

_player addAction["<img image=HG_SWSS\UI\gun.paa' size='1.5'/><t color='#FF0000'>Open Weapons Shop</t>", {["HG_DefaultShop] call HG_fnc_dialogOnLoadItems; id_shop = _this select 2},"",0,false,false,"",'(alive player) && !dialog']; - into 'initPlayerLocal'

and

player removeaction id_shop; - into 'fn_dialogOnLoadItems'

 

but the action removes after 2nd dialog's opening\closing only

 

Hi,

 

Download latest version from the link in the 1rst post. Then open fn_dialogOnLoadItems and add this:

player removeAction _id;

I changed the way the param is passed to the function using the native addAction way (_this select 3 for arguments), so now you can just remove it directly from there. Should be easier now.

 

Wheres the change you may ask? Here it is:

 

this addAction["<img image=HG_SWSS\UI\gun.paa' size='1.5'/><t color='#FF0000'>Open Weapons Shop</t>",{_this call HG_fnc_dialogOnLoadItems},"HG_DefaultShop",0,false,false,"",'(alive player) && !dialog];

 

Instead of:

 

this addAction["<img image=HG_SWSS\UI\gun.paa' size='1.5'/><t color='#FF0000'>Open Weapons Shop</t>",{["HG_DefaultShop] call HG_fnc_dialogOnLoadItems},"",0,false,false,"",'(alive player) && !dialog'];

Share this post


Link to post
Share on other sites

hoverguy, thanks, it works.

I hope, the shop will sell IED's, m-gun mags and rockets ("Titan_AA" etc) instead of 'This type of item is not handled at the moment' :)

Share this post


Link to post
Share on other sites

hoverguy, thanks, it works.

I hope, the shop will sell IED's, m-gun mags and rockets ("Titan_AA" etc) instead of 'This type of item is not handled at the moment' :)

 

Can you post the items you want to add? I'll add support for em.

Share this post


Link to post
Share on other sites

Can you post the items you want to add? I'll add support for em.

At the moment I need "100Rnd_65x39_caseless_mag", "200Rnd_65x39_cased_Box", "Titan_AA", "Titan_AP", "RPG32_F", "RPG32_HE_F", "NLAW_F", "SatchelCharge_Remote_Mag", "IEDUrbanBig_Remote_Mag".

In fact, I don't know what items can be necessary further. RHS weapons\mags, f.e.

Share this post


Link to post
Share on other sites

At the moment I need "100Rnd_65x39_caseless_mag", "200Rnd_65x39_cased_Box", "Titan_AA", "Titan_AP", "RPG32_F", "RPG32_HE_F", "NLAW_F", "SatchelCharge_Remote_Mag", "IEDUrbanBig_Remote_Mag".

In fact, I don't know what items can be necessary further. RHS weapons\mags, f.e.

 

As I said in a previous post, not all of the items type are listed in the script hence why you see the hint "This type of item (%1) is not handled at the moment, maybe in a next update..."

 

I need feedback from guys like you to add em one by one, that I did. As long as RHS weapons inherit from the right weapon base class it shouldn't be an issue.

 

You can now download the latest version using the link in the 1rst post.

Share this post


Link to post
Share on other sites

hoverguy, thanks.

 

I need feedback from guys like you to add em one by one

Ok, I'm a tester :)

I added "B_HuntingBackpack" into Items, the shop 'sells' it to me, but I don't see it in my inventory

 

Hmmm.... i have bought a machine-gan, after that - backpack, and the machine gun disappeared :blink: (at the same time - the backpack isn't present)

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

×