Jump to content

Recommended Posts

Simple-Shops.png?raw=1

 

Description

Weapon shop

Gear shop

Units shop

Vehicles shop

Dealer, trader...

 

Installation/Usage/Download/Updates

GitHub

 

Notes

Works in MP

If you use RHS, weapons name in editor can't be used in the shop, see post #62

 

Screenshot

Click Me

 

Armaholic

Armaholic Topic

  • Like 11
  • Thanks 3

Share this post


Link to post
Share on other sites

 

overviewPicture_SWSS.png?raw=1

v 1.0

 

Description

Weapon shop dialog

Weapon shop functions

 

Installation

See included README.txt

 

Notes

Requested by a friend, might be useful to some of you.

Works in MP (script is local).

 

Download

[HG] Simple Weapon Shop System v1.0 (sample mission included)

 

Just what the community had been waiting for :D

  • Thanks 1

Share this post


Link to post
Share on other sites

It's a really really really (really?) simple weapons shop system, if people like it then I can add more features, just ask me.

  • Like 4

Share this post


Link to post
Share on other sites

It's a really really really (really?) simple weapons shop system, if people like it then I can add more features, just ask me.

I want to incorporate it in my SP missions. Hence some questions:

 

1. Can I take the entire code of initPlayerLocal.sqf and put it in a separate shopinit.sqf and run callcompile on shopinit.sqf in the init.sqf?

2. In the pursuit of changing it to SP friendly with mission load capability, can I let go of disableSerialization; in the line 104 of initPlayerLocal.sqf? I read it earlier somewhere that disableSerialization wont allow the code to execute at mission load.

3. I want to add a line just before the addaction line that will add cash after each AI that I kill. Something like:

[] spawn {
    {_x addeventhandler ["killed", {HG_myCash = HG_myCash + 200}]; // just made it up as I want to earn 200 cash at each kill
    } forEach allUnits;
};

Will it work?

 

 

Thanks :)

Share this post


Link to post
Share on other sites

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;

};

Share this post


Link to post
Share on other sites

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;

};

Great. Let me test. Thank you. :)

  • Thanks 1

Share this post


Link to post
Share on other sites

Man, I really hope that one day we will get a full Arsenal-like shop with lets you kit yourself out. A system for money gathering should also be created. For example you could have score based money (you kill enemies and their vehicles you get money), you could spice it up with looting from dead enemies.

 

Still, thanks for the script.

  • Like 2

Share this post


Link to post
Share on other sites

Man, I really hope that one day we will get a full Arsenal-like shop with lets you kit yourself out. A system for money gathering should also be created. For example you could have score based money (you kill enemies and their vehicles you get money), you could spice it up with looting from dead enemies.

 

Still, thanks for the script.

Check post#5 at the top man. Its SP friendly and does the same thing which you and I are craving for ;)

It will add 200 cash to your pocket at each kill.

 

I am modifying this script to include items and ammo also. But experiencing some hindrances. Hopefully hoverguy will reach there before me. ;)

 

Additionally you can put the addaction line to an object like a shop owner or flag instead of player to make it look like wasteland.

 

This is a very neat script indeed. :)

Share this post


Link to post
Share on other sites

Vehicle magazine request ;)  Is it possible to lock "buy ability" to specific units? Thank you for a script.

  • Like 1

Share this post


Link to post
Share on other sites

Man, I really hope that one day we will get a full Arsenal-like shop with lets you kit yourself out. A system for money gathering should also be created. For example you could have score based money (you kill enemies and their vehicles you get money), you could spice it up with looting from dead enemies.

 

Still, thanks for the script.

You're welcome, I have a similar system in my own mission where money is an inventory item (physical), you can drop/gather/loot it, buy stuff etc...

 

I am modifying this script to include items and ammo also. But experiencing some hindrances. Hopefully hoverguy will reach there before me. ;)

Planned feature :)

 

Vehicle magazine request ;)  Is it possible to lock "buy ability" to specific units? Thank you for a script.

You're welcome too!

What do you mean by "Is it possible to lock buy ability" to specific units, please be more precise.

New version is on the way which will include:

- Magazines / Items / Scopes support

- More weapon infos (instead of just the price...)

- Localization support

- And some minor additions...

  • Like 1

Share this post


Link to post
Share on other sites

Ex

You're welcome, I have a similar system in my own mission where money is an inventory item (physical), you can drop/gather/loot it, buy stuff etc... Planned feature :) You're welcome too!What do you mean by "Is it possible to lock buy ability" to specific units, please be more precise.New version is on the way which will include:- Magazines / Items / Scopes support- More weapon infos (instead of just the price...)- Localization support- And some minor additions...

Excited. I'll put my SP wasteland project on hold till then ;)

Share this post


Link to post
Share on other sites

Update
- v 1.1 - 
Magazines / Items / Scopes support
Custom shops support
More weapon infos (instead of just the price...)
Localization support
And some minor additions...

  • Like 3

Share this post


Link to post
Share on other sites

 

Update

- v 1.1 - 

Magazines / Items / Scopes support

Custom shops support

More weapon infos (instead of just the price...)

Localization support

And some minor additions...

 

Really appreciate man. Thank you. :)

Share this post


Link to post
Share on other sites

What do you mean by "Is it possible to lock buy ability" to specific units, please be more precise.

Thank you.  It is not necessary for weapons but may be useful for vehicle shop. Just a feature request if you gonna make something similar with vehicles. I mean make it possible to specify who can buy vehicles.

P. S. We play one life TvT missions and that ability may give more diversity to gameplay if you give HQ some credits and list of vehicles to buy.

Share this post


Link to post
Share on other sites

Thank you.  It is not necessary for weapons but may be useful for vehicle shop. Just a feature request if you gonna make something similar with vehicles. I mean make it possible to specify who can buy vehicles.

P. S. We play one life TvT missions and that ability may give more diversity to gameplay if you give HQ some credits and list of vehicles to buy.

So you want a proper vehicle shop? With control of who can buy what vehicle? Based on rank? Side? Tell me more...

Really appreciate man. Thank you. :)

YW, next update will include configurable kits (recon, rifleman etc...).

  • Like 1

Share this post


Link to post
Share on other sites

is there a way to include several shops  on a map with this ? 

 

i would like to implent a gun shop (this excelent script) but also some small shops with custom items wich you can buy (using the items list fom this script) (its for starting a campaign where the player becomes a resistance member) 

Share this post


Link to post
Share on other sites

is there a way to include several shops  on a map with this ? 

 

i would like to implent a gun shop (this excelent script) but also some small shops with custom items wich you can buy (using the items list fom this script) (its for starting a campaign where the player becomes a resistance member) 

 

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)

  • Like 2

Share this post


Link to post
Share on other sites

Hi,

 

So basically you want to 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)

Thank you for the constant support man. Just a suggestion, make the addaction configurable from outside. Like "add this line to the init of desired unit or object to make it/him a shop."

This may help those who are beginners with scripting

:)

Share this post


Link to post
Share on other sites

Thank you for the constant support man. Just a suggestion, make the addaction configurable from outside. Like "add this line to the init of desired unit or object to make it/him a shop."

This may help those who are beginners with scripting

:)

 

I'll add it to the README.txt ;)

  • Like 3

Share this post


Link to post
Share on other sites

So you want a proper vehicle shop? With control of who can buy what vehicle? Based on rank? Side? Tell me more...

Yes. We need whitelist for vehicles and whitelist for players (unit name placed in editor is enough for our purposes). For example, you name units (HQ_1) and (HQ_2) and they have ability to buy any whitelisted vehicle. The best variant will be if they get that ability in some zone (marker maybe).

  • Like 1

Share this post


Link to post
Share on other sites

Yes. We need whitelist for vehicles and whitelist for players (unit name placed in editor is enough for our purposes). For example, you name units (HQ_1) and (HQ_2) and they have ability to buy any whitelisted vehicle. The best variant will be if they get that ability in some zone (marker maybe).

I will make the vehicle shop, but I have to think global you know, the final product has to be pretty straightforward and has to work in both SP & MP environments.

So knowing this, a PUID whitelist is the best I can think of right now (with ability to add PUID on the go, which is good to setup a reward system for example where you unlock vehicles).

Of course you will need markers to spawn said vehicles (configurable).

Don't worry, I think you'll be pleased :)

  • Like 2

Share this post


Link to post
Share on other sites

Yeah plz dnt abandon SP players..

Share this post


Link to post
Share on other sites

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)

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

×