Jump to content
hoverguy

[Release] Simple Weapon Shop System

Recommended Posts

I don't know BMR system so I will assume that no Killed EVH is set.

 

Put it where you spawn AIs:

_AI addEventHandler // _AI -> spawned AI for reference, can be what you want in your script
[
    "Killed",
    {
        params["_unit","_killer"];
        
        if(isPlayer _killer) then
        {
            [200,0] remoteExecCall ["HG_fnc_addOrSubCash",(owner _killer),false];
        };
    };
];

You can use forEach if you spawn groups of AIs. You may also want to whitelist HG_fnc_addOrSubCash function (CfgRemoteExec) to be used remotely. You don't need remoteExec whitelist as long as you use it to execute things from the server.

Share this post


Link to post
Share on other sites

let me be a little bit more clear is the EOS, so when i get ner of the object the AI spawn in to the map.
You can use forEach if you spawn groups of AIs. You may also want to whitelist HG_fnc_addOrSubCash function (CfgRemoteExec) to be used remotely.I don't understand what you mean about this. can you post a sample where to put this.

 

_AI addEventHandler // _AI -> spawned AI for reference, can be what you want in your script
[
    "Killed",
    {
        params["_unit","_killer"];
        
        if(isPlayer _killer) then
        {
            [200,0] remoteExecCall ["HG_fnc_addOrSubCash",(owner _killer),false];
        };
    };
];

can it be in the initPlayerLocal.

Share this post


Link to post
Share on other sites

Send me your mission via PM, I'll send it back to you with the above stuff implemented ok? I'll also leave code comments so you understand what I did.

Share this post


Link to post
Share on other sites

I'm new to the forums and I can't make my own topic post yet so I figured I'd ask someone who was working on the shop system for Wasteland; I'm currently installing Nato SF and Russian Spetsnaz weapons and Wander Panzer WAP to my Altis Wasteland server but I don't know how to implement them in the shop. (I also have IdentiZee but I don't think I need to edit the server mission to use that?) Anyone think they could explain some mission editing to me? (I have the tools to extract the Wasteland pbo and view/edit its contents, I just don't know how.)

Share this post


Link to post
Share on other sites

Great stuf Hoverguy !

 

I implemented the weapons and the clothing shop on of of my missions. One earns 750 per infantry kill on the mission.

I was wondering if someone already drafted a list of class and prices which I could, shamelessly but thankfull, paste into my missions shop configs.

 

Also, this might be a bit of a side step here, but is kinda related to your shop system;  player stat persistence. And i have to add i'm running the server on a linux dedicated. I've looked into some options inidbi, extdb3, socket-rpc. I am having a hard time finding libraries and good documentation how to get this going on a linux server from scratch. I have a fair understanding of sqf and SQL servers. Any hints to get me going?

 

 

regards,

 

Patrick

 

Share this post


Link to post
Share on other sites

Alright i have this in my initPlayerLocal.sqf

params["_player"];


/*
    Author - HoverGuy
© All Fucks Reserved
*/


/*
    Money variable
*/
_player setVariable["HG_myCash",800];




[] 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 + 300;
                    _killer setVariable ["HG_myCash",_newCash];
                };
           
            }
        ];
    } forEach allUnits;


};

Im trying to make a cs round based pvp mission. Im testing with ai, since like you said the killed eventhandler thing shouldnt matter if ai or player dies. But its not working. Money doesnt get added :-(

Share this post


Link to post
Share on other sites

Update


- v 1.3 -

Redo parts of dialog (some were complaining about the dialog being too small)

Support for different currency, see HG_ShopCfg.h

Altered fn_handleItems.sqf file, it does now handle items better

Ability to whitelist shops by ranks (waiting for feedback, is it a good idea?), see HG_ShopCfg.h

Better comments

Share this post


Link to post
Share on other sites

Great work. Really enjoying this script. I would like to implement an addAction or an ATM that you can view your cash outside of being "in" the store. Many thx.

Share this post


Link to post
Share on other sites

Great work. Really enjoying this script. I would like to implement an addAction or an ATM that you can view your cash outside of being "in" the store. Many thx.

Hi and thanks for your feedback.

I can add a simple HUD with cash display in the lower left corner of the screen that can be enabled/disabled.

What you think ?

Also will add persistent cash.

Share this post


Link to post
Share on other sites

How would i go about adding the prices of items to the shop? It doesn't currently display how much an item costs so players are going in blind. Also would it be possible to make money persistent and make it editable by an admin.

Share this post


Link to post
Share on other sites

How would i go about adding the prices of items to the shop? It doesn't currently display how much an item costs so players are going in blind. Also would it be possible to make money persistent and make it editable by an admin.

 

Hi,

 

Sorry that was not intended, it was meant to show the price when you move hover over an item in the list (tooltip). Now it is fixed (re-dl it from the link on the first page).

 

I will release an update tomorrow with:

 

- Persistent cash (toggleable)

- Cash display in HUD  (toggleable)

Share this post


Link to post
Share on other sites

Awesome, looking forward to it. Will be super useful for me. When you add persistent cash would it save when i restart my server and also would I be able to edit the amount of money people have? I'm running a PMC milsim unit and I want to use the money system in this to pay people so they can buy guns, but if their money doesnt save when the server restarts and I cant edit their money then I will need to find an alternative way.

 

Every other way I have seen requires a database but Liberation.Altis has money and supplies that stay persistent after server restart and I want to try and do that without a database.

Share this post


Link to post
Share on other sites

Awesome, looking forward to it. Will be super useful for me. When you add persistent cash would it save when i restart my server and also would I be able to edit the amount of money people have? I'm running a PMC milsim unit and I want to use the money system in this to pay people so they can buy guns, but if their money doesnt save when the server restarts and I cant edit their money then I will need to find an alternative way.

 

Every other way I have seen requires a database but Liberation.Altis has money and supplies that stay persistent after server restart and I want to try and do that without a database.

 

most likely the cash system will save in the profileNameSpace so will be saved locally. i have it setup on my server with this shop system. so you wont be able to give the players cash because you wont have access to their file obviously. 

Share this post


Link to post
Share on other sites

Well actually you can give em cash that is then saved in profileNamespace. I added a way to do so in the most up to date files, will release when am back home.

Share this post


Link to post
Share on other sites

Awesome. I absolutely love your work hoverguy. DO the new files have persistent cash as well? if so I will love you forever.

Share this post


Link to post
Share on other sites

Thank you and great work hoverguy, both this and the vehlicle shop are working very well for me! For anybody wondering about a cash system who may be using EOS, I have found one online that works with EOS and uses the HG_myCash variable that hoverguy has already made for the shops.

 

It converts the EOS kill counter to a kill reward system, the only issue I am having is that in a miltiplayer game with friends I was the only person receiving the rewards, regardless if I got the kill or any of my friends got the kill. If anybody knows how to reward the person who got the kill, please help me. For now I will post the code I have.

 

Put this code in the EOS_killcounter.sqf file of the functions folder in the EOS script.

 

 

private ["_eosKills"];
_eosKills=server getvariable "EOSkillCounter";

    if (isnil "_eosKills") then {_eosKills=0;}else{
        _eosKills=server getvariable "EOSkillCounter";
                };        
                


_eosKills=_eosKills + 1;
server setvariable ["EOSkillCounter",_eosKills,true];
 
            [400,0] remoteExecCall ["HG_fnc_addOrSubCash",player,false];
            hint format["%1 Enemy Killed +$400",profileName];

 

 

(the script will reward you $400 per kill, to change the amount earned by each kill, change the 400 in [400,0] to any desired number)

 

Again, I do not have enough knowledge to make the script reward the specific player who killed the AI, I would appreciate any help resolving this issue. Thanks.

  • Like 1

Share this post


Link to post
Share on other sites

Update

- v 1.4 -
Persistent cash (toggleable), see HG_SVSS\Config\HG_Config.h
Cash display in HUD  (toggleable), see HG_SVSS\Config\HG_Config.h
Ability to set start cash, see HG_SVSS\Config\HG_Config.h
Ability to give money to other players

  • Like 1

Share this post


Link to post
Share on other sites

Yes, thank you for new release it works well, although I cant see weapon prices in the shop, but that may have something to do on my end. ill try to confirm later.

 

for the EOS money system I have found out that putting

 

"if (EOS_KILLCOUNTER) then {_unit addMPEventHandler ["MPkilled", "null=[] execVM ""eos\functions\EOS_KillCounter.sqf"""]};" 

 

 

in setSkill.sqf found inside the functions folder of EOS, will make AI kills reward everybody for each ai killed, not exactly what I was going for but it will work for now, the end goal is to make it reward the specific player who killed the AI.

 

Any help is appreciated, thanks again hoverguy for very useful script.

Share this post


Link to post
Share on other sites

Heyy hoverguy.. been long eh :)

 

I wanted to know if there could be a way to reflect the weapon and item image sizes as they are? I mean currently they appear stretched in the preview window of the shop.

Share this post


Link to post
Share on other sites

UPDATE: can you please tel me where the starting cash gets saved? its like a pema save where even after restarting the pc, in the mission editor, i always start with the cash left after the last session's preview. I deleted all the cache, deleted my custom scripts from your scripts and replaced with your original. I guess somewhere in the remote corners of the pc the data is saved??

 

its getting very VERY annoying..

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

×