hoverguy

[Release] Simple Weapon Shop System

176 posts in this topic


loadScreen = "core\img\btc.paa";
author = .;
onLoadName = ..;
onLoadMission = ..;

#include "core\def\dlg_def.hpp"
#include "core\fnc\fob\dlg.hpp"
#include "core\fnc\int\progress_bar.hpp"
#include "core\fnc\log\dlg.hpp"
//#include "core\fnc\rev\dlg.hpp"
#include "core\sounds\sounds.hpp"

#include "core\def\param.hpp"

#include "core\fnc\task\tasktypes.hpp"

#include "core\def\functions.hpp"

#include "core\fnc\eh\extended_InitPost_EH.hpp"

#include "HG\UI\HG_DialogsMaster.h"

class RscTitles {

	#include "HG\UI\Dialogs\HG_HUD.h"
    class Default {
        idd = -1;
        fadein = 0;
        fadeout = 0;
        duration = 0;
    };
	
	//#include "core\fnc\rev\rsc.hpp"
	#include "core\fnc\log\rsc.hpp"
};

class CfgClient
{
    #include "HG\Config\HG_Config.h"
};

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

2e1vhb5.jpg

 

v4o26c.jpg

 

Im always getting this error.. specially in class CfgFunctions. Pls help

Share this post


Link to post
Share on other sites

Hello,

 

Yes that's because you have CfgFunctions twice, I guess first one is in

#include "core\def\functions.hpp"

Second one is mine, so merge em together and you should be fine.

1 person likes this

Share this post


Link to post
Share on other sites

I'm adding this code in Hearts and Minds by BTC but im not getting any reward after killing AI, I only receive reward for X Time stay in game..

[_AI] call HG_fnc_aiSetup;

private ["_killer"];

_killer = (_this select 0) getVariable ["ace_medical_lastDamageSource", (_this select 1)];

if (!isDedicated && !hasInterface) then {
	[(_this select 0), _killer] remoteExec ["btc_fnc_mil_unit_killed",2];
} else {
	if (random 100 > btc_info_intel_chance) then {
		(_this select 0) setVariable ["intel",true];
	};

	if (isPlayer _killer) then {
         if (isServer) then {
            btc_rep_bonus_mil_killed call btc_fnc_rep_change;
			[_AI] call HG_fnc_aiSetup;
        } else {
            [btc_rep_bonus_mil_killed,"btc_fnc_rep_change",false] spawn BIS_fnc_MP;
        };
};
//{count units _x == 0} count allGroups;
//(allGroups select {count units _x == 0}) apply {deleteGroup _x}
//(_this select 0) spawn {sleep 0.5;{deleteVehicle _x} foreach (nearestObjects [_this, ["WeaponHolderSimulated"], 5]);};

 

Share this post


Link to post
Share on other sites

I suggest you to read this if you haven't already (main page):

 

https://github.com/Ppgtjmad/SimpleShops

 

You have to put this little function where you spawn AIs (you have to find out where exactly)

 

_AI is just a reference to the already created unit.

Share this post


Link to post
Share on other sites

New Shop request:

Object seller.

 

You could buy an object which then floats in front of the character (see ACE3 portable ladder functionality) and land it where you want and it becomes a placed object. 

This could be used for furnitures, ammo boxes, aesthetic items like sandbags. Also an Addaction to the item as well to remove it or re-lift up.

1 person likes this

Share this post


Link to post
Share on other sites

Hello, i download 1.6 version of script, in game does not work Vehicles Shop. I press to buy a car, money is spent but the car is not created and spawn point is busy.

P.S. Sorry for my English.

Share this post


Link to post
Share on other sites
31 minutes ago, stpain said:

Hello, i download 1.6 version of script, in game does not work Vehicles Shop. I press to buy a car, money is spent but the car is not created and spawn point is busy.

P.S. Sorry for my English.

 

Hello,

 

Yeah my bad, it's fixed now see latest commit:

 

https://github.com/Ppgtjmad/SimpleShops/commit/4f19b1032ce0eb1a0f79dfd1f01ffa3d1fea2f76

 

Quote

New Shop request:

Object seller.

 

You could buy an object which then floats in front of the character (see ACE3 portable ladder functionality) and land it where you want and it becomes a placed object. 

This could be used for furnitures, ammo boxes, aesthetic items like sandbags. Also an Addaction to the item as well to remove it or re-lift up.

 

That's a good idea, will think about it :)

Share this post


Link to post
Share on other sites

Hello, I'm using a collection of all your shops. But under MP, when players respawn, they lose the ability to give money. How to deal with this?

Share this post


Link to post
Share on other sites

Is there a way to add another type of weapons shop? Asking because I want to make a military and civilian shop.

 

All I need is a quick run down on how I could edit it to set up a second shop and I should be able to figure it out from there, hopefully.

Share this post


Link to post
Share on other sites

I can not use markers to spawn vehicles since I can not move editor made markers as an in-game Zeus. 

How can I change the code so that it accepts object position instead? I would rather have invisible object than pre-defined marker to define position for spawning and storing vehicles.

 

I use currently as a workaround this code:

[] spawn {
  while {true} do { "car_spawn_1" setmarkerdir getdir car_spawn_1A; "car_spawn_1" setmarkerpos getpos car_spawn_1A;  sleep 1; };
};

 

Which makes a check every 1 second for an object's location and updates the marker location based on it. But the problem is that it doesn't seem to be very precisely picking the correct coordinates. I have a garage where I try to spawn them and the cars collide with walls, spawning broken.

Share this post


Link to post
Share on other sites

Hey hoverguy,

 

I'm having a little bit of an issue with this system. The GUI that pops up when I enter a store is moved all the way to the side cutting it halfway.

 

2dkj1vs.jpg

 

Any ideas?

 

Kind regards,

MrCrazyDude115

Share this post


Link to post
Share on other sites

This is the best system !! love it bro :) Thanks.

1 person likes this

Share this post


Link to post
Share on other sites
On 3/30/2017 at 8:00 AM, Chris Smith said:

Is there a way to add another type of weapons shop? Asking because I want to make a military and civilian shop.

 

All I need is a quick run down on how I could edit it to set up a second shop and I should be able to figure it out from there, hopefully.

 

Hello Chris Smith,

 

You can follow the HG_DefaultShop example, just copy it & adjust to your needs.

 

10 hours ago, CptDezusa said:

This is the best system !! love it bro :) Thanks.

 

Not the best, not at all, but thanks for your support :)

 

On 4/13/2017 at 3:57 PM, Powershard said:

I can not use markers to spawn vehicles since I can not move editor made markers as an in-game Zeus. 

How can I change the code so that it accepts object position instead? I would rather have invisible object than pre-defined marker to define position for spawning and storing vehicles.

 

I use currently as a workaround this code:

[] spawn {
  while {true} do { "car_spawn_1" setmarkerdir getdir car_spawn_1A; "car_spawn_1" setmarkerpos getpos car_spawn_1A;  sleep 1; };
};

 

Which makes a check every 1 second for an object's location and updates the marker location based on it. But the problem is that it doesn't seem to be very precisely picking the correct coordinates. I have a garage where I try to spawn them and the cars collide with walls, spawning broken.

 

Am about to change how spawning is handled, it will accept STRING (markers), OBJECTS & POSITION ([x,y,z]), so stay updated https://github.com/

 

15 hours ago, MrCrazyDude115 said:

Hey hoverguy,

 

I'm having a little bit of an issue with this system. The GUI that pops up when I enter a store is moved all the way to the side cutting it halfway.

 

2dkj1vs.jpg

 

Any ideas?

 

Kind regards,

MrCrazyDude115

 

Hmmm, I'm completely aware of the issue, that's because of the GUI coordinates system I use. Working on a fix but don't have time atm to be 100% dedicated. All I can say for now is to check the github regularly.

 

Thanks you guys for using my shops!

Share this post


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

 

Hello Chris Smith,

 

You can follow the HG_DefaultShop example, just copy it & adjust to your needs.

 

 

Not the best, not at all, but thanks for your support :)

 

 

Am about to change how spawning is handled, it will accept STRING (markers), OBJECTS & POSITION ([x,y,z]), so stay updated https://github.com/

 

 

Hmmm, I'm completely aware of the issue, that's because of the GUI coordinates system I use. Working on a fix but don't have time atm to be 100% dedicated. All I can say for now is to check the github regularly.

 

Thanks you guys for using my shops!

 

Sure man, take your time :smile_o:

Share this post


Link to post
Share on other sites
On 13/04/2017 at 11:57 PM, Powershard said:

I can not use markers to spawn vehicles since I can not move editor made markers as an in-game Zeus. 

How can I change the code so that it accepts object position instead? I would rather have invisible object than pre-defined marker to define position for spawning and storing vehicles.

 

I use currently as a workaround this code:

[] spawn {
  while {true} do { "car_spawn_1" setmarkerdir getdir car_spawn_1A; "car_spawn_1" setmarkerpos getpos car_spawn_1A;  sleep 1; };
};

 

Which makes a check every 1 second for an object's location and updates the marker location based on it. But the problem is that it doesn't seem to be very precisely picking the correct coordinates. I have a garage where I try to spawn them and the cars collide with walls, spawning broken.

 

Just a thought no idea if it will work but would attaching the marker to an object work for you? 

 

@hoverguyokay tah I'll give it ago. 

Share this post


Link to post
Share on other sites

@hoverguy

 

Hey! So aside from the GUI bug, I've not had much luck trying to figure out how to call each function and how to properly use them. If you find that you have the time someday, could you maybe give us some sort of insight on how to use them?

 

Never really used functions but I'm learning now :)

 

Kind regards,

MrCrazyDude115

Share this post


Link to post
Share on other sites

As i have understand it has been some new update on it, but if you go in and try adding this in the debug.
MrCrazyDude115
profileNamespace setVariable ["HG_XP",[(rank player),0]]; saveProfileNamespace

 

1 person likes this

Share this post


Link to post
Share on other sites
14 hours ago, CptDezusa said:

As i have understand it has been some new update on it, but if you go in and try adding this in the debug.
MrCrazyDude115
profileNamespace setVariable ["HG_XP",[(rank player),0]]; saveProfileNamespace

 

 

Yeah that's stated in the Updates section on github

 

On 4/18/2017 at 6:47 PM, MrCrazyDude115 said:

@hoverguy

 

Hey! So aside from the GUI bug, I've not had much luck trying to figure out how to call each function and how to properly use them. If you find that you have the time someday, could you maybe give us some sort of insight on how to use them?

 

Never really used functions but I'm learning now :)

 

Kind regards,

MrCrazyDude115

 

Hey MrCrazyDude115,

 

I just made a wiki -> Useful Functions

2 people like this

Share this post


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

 

Yeah that's stated in the Updates section on github

 

 

Hey MrCrazyDude115,

 

I just made a wiki -> Useful Functions

 

Amazing work dude!

 

Many thanks!

1 person likes this

Share this post


Link to post
Share on other sites

It's just super! But help me please, I do not understand how to sell the item and how to get a reward / money for murder?

1 person likes this

Share this post


Link to post
Share on other sites

Hi nice system and all but it's unclear to me how to add it to a unit the previous system had this thing where you do addAction, is that still the case? I used to get a _whatshop undefined error because of wrong parameters but I can't get it to do anything else.

 

//Remove old stuff
shopman addAction["<img image='HG\UI\gun.paa' size='1'/>Open Weapons Shop",{[shopman,player,1,"HG_DefaultShop"] call HG_fnc_dialogOnLoadItems},"",6,false,false,"",'(alive player) && !dialog'];
//This works

How do I add the whole shop functionality to a unit.

 

EDIT - Okay i got it.

Share this post


Link to post
Share on other sites

Posted (edited)

Hi, thanks for the updates! :)

 

 

[_vehicle,_unit] call HG_fnc_setOwner;  

is not injecting ownership correctly to vehicles, I am unable to store said vehicles or to lock them after I have acquired them.

Looking inside fn_setOwner.sqf file there is nothing that sets the locked state to 0 or 2, leaving lock state addaction into limbo of no state.

So I added as a fix there  

_vehicle lock 0;

But I was unable to make "setOwnered" vehicles to store in a garage. It has something to do with _index not existing when trying to save a vehicle. It does delete the vehicle but does not add it into a garage when trying to do so.

 

 

It could also be helpful if when buying vehicles, that I could put them in garage automatically from the shop window instead of spawning them in the game world.

I prefer to use the shop spawn marker, garage spawn marker and garage store marker at same individual marker to avoid confusions.

 

 

 

On github, a long lingered "bug" is on https://github.com/Ppgtjmad/SimpleShops/wiki/Usage where there are those addactions:

this addAction["<img image='HG\UI\garage.paa' size='1.5'/><t color='#FF0000'>Open Garage</t>",{_this call HG_fnc_dialogOnLoadGarage},"HG_DefaultGarage",0,false,false,"",'(alive player) && !dialog && player distance _target < 3'];

the image path is outdated in them, it is supposed to be HG\UI\ICONS\garage.paa

I would imagine some people could get confused of it.

 

 

On version 2.1 I am not able to open Admin Menu no matter what button I change it to for some reason. I have the config as:

Got it fixed, the PUID was supposed to be in " " tags :) Like this:

admins[] = {"76561198140652154"};
not like this:
admins[] = {76561198140652154};

 

 

Edited by Powershard
fixes

Share this post


Link to post
Share on other sites
2 hours ago, Powershard said:

Hi, thanks for the updates! :)

 

Hello, you're welcome.

 

2 hours ago, Powershard said:

 


[_vehicle,_unit] call HG_fnc_setOwner;  

is not injecting ownership correctly to vehicles, I am unable to store said vehicles or to lock them after I have acquired them.

Looking inside fn_setOwner.sqf file there is nothing that sets the locked state to 0 or 2, leaving lock state addaction into limbo of no state.

So I added as a fix there  


_vehicle lock 0;

But I was unable to make "setOwnered" vehicles to store in a garage. It has something to do with _index not existing when trying to save a vehicle. It does delete the vehicle but does not add it into a garage when trying to do so.

 

 

Yup fixed the index error, forgot this one :) You may be able to store it properly now.

 

2 hours ago, Powershard said:

It could also be helpful if when buying vehicles, that I could put them in garage automatically from the shop window instead of spawning them in the game world.

I prefer to use the shop spawn marker, garage spawn marker and garage store marker at same individual marker to avoid confusions.

 

I'll add this one, thanks for the suggestion. Added.

 

2 hours ago, Powershard said:

On github, a long lingered "bug" is on https://github.com/Ppgtjmad/SimpleShops/wiki/Usage where there are those addactions:


this addAction["<img image='HG\UI\garage.paa' size='1.5'/><t color='#FF0000'>Open Garage</t>",{_this call HG_fnc_dialogOnLoadGarage},"HG_DefaultGarage",0,false,false,"",'(alive player) && !dialog && player distance _target < 3'];

the image path is outdated in them, it is supposed to be HG\UI\ICONS\garage.paa

I would imagine some people could get confused of it.

 

Yup also fixed, it's fine in the mission I provide but forgot to add it to the addActions samples when I done the wiki...

 

2 hours ago, Powershard said:

On version 2.1 I am not able to open Admin Menu no matter what button I change it to for some reason. I have the config as:

Got it fixed, the PUID was supposed to be in " " tags :) Like this:


admins[] = {"76561198140652154"};
not like this:
admins[] = {76561198140652154};

 

 

 

As you can see here https://github.com/Ppgtjmad/SimpleShops/wiki/How-to-configure it's clearly enclosed in quotes, see getPlayerUID command.

 

Thanks for you reports :)

 

EDIT: https://github.com/Ppgtjmad/SimpleShops/commit/ef44b0d4586ca777da3adf3690efe10ea8aae410

Share this post


Link to post
Share on other sites

Oh wow, now that was some quick fixing :D Thank you very much, I really appreciate all of this.

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