Jump to content
thelegendarykhan

Arma 3 shop and money system?

Recommended Posts

Firstly, I have looked enough in forms here but nothing with a solution.

I need to add money system where it shows current money on one side of screen, and you earn a certain amount with kills, lose some when you are killed. Also how to make any civilian or a crate as a full fledged shop with weapons, ammo, accessories etc. I need to incorporate this in my Alive mission.

Please respond.

Share this post


Link to post
Share on other sites

What you're asking for is a very complex construct.

It is not something that can be answered with just a few posts, unless you narrow the questions down a little.

What part do you need help with? What do you already know? Are you running into any errors?

Most of the work on that will have to come from you.

If you haven't already, I suggest you start off by looking at and modifying an existing system, so you can get a hang of it.

Share this post


Link to post
Share on other sites

I have created what you're looking for, however there is no ready-to-deploy stand-alone version (yet). Of course you're free to dePBO my project (check my sig) and see if you can figure it out. Though I wouldn't recommend messing around with it if you still lack the basics of scripting and dialogs. As Tajin said, it's a long way to go to create these rather complex systems. And since my system is tied togetehr with other campaign systems (i.e. not stand-alone) I'm in no position to offer proper support or detailed explanations. An easily configurable and deployable version might come some day.

Share this post


Link to post
Share on other sites

If you want your money to show on the screen you're going to need to create a "Display", unless you just want an addAction that will hint your money variable

Share this post


Link to post
Share on other sites

Something like this? (I'll post a video link later)

I created this in a few hours and I'm not all that good at scripting so I guess it's doable with say, an intermediate amount of knowledge?

I would recommend that you read either Iceman77's Dialog Tutorial or Austin_Medics Dialog Guide to learn how to create/work with Dialogs! After this, you can then begin to move on to creating your own Dialog and progress from there!

Share this post


Link to post
Share on other sites

I would use Austin Medic's guide and KK's blog to learn dialogs. I wrote Dialog tutorial For Noobs for A2 and also wrote it while I was learning dialogs myself from the wiki. I'm in the middle of re-writing the tutorial however, to catch up with the times and my many levels of progress since I wrote the original tutorial.

Share this post


Link to post
Share on other sites
I would use Austin Medic's guide and KK's blog to learn dialogs. I wrote Dialog tutorial For Noobs for A2 and also wrote it while I was learning dialogs myself from the wiki. I'm in the middle of re-writing the tutorial however, to catch up with the times and my many levels of progress since I wrote the original tutorial.

Thanks. Will try.

---------- Post added at 04:56 ---------- Previous post was at 04:55 ----------

Something like this? (I'll post a video link later)

I created this in a few hours and I'm not all that good at scripting so I guess it's doable with say, an intermediate amount of knowledge?

I would recommend that you read either Iceman77's Dialog Tutorial or Austin_Medics Dialog Guide to learn how to create/work with Dialogs! After this, you can then begin to move on to creating your own Dialog and progress from there!

Ok thanks. Much appreciated.

---------- Post added at 05:15 ---------- Previous post was at 04:56 ----------

What you're asking for is a very complex construct.

It is not something that can be answered with just a few posts, unless you narrow the questions down a little.

What part do you need help with? What do you already know? Are you running into any errors?

Most of the work on that will have to come from you.

If you haven't already, I suggest you start off by looking at and modifying an existing system, so you can get a hang of it.

Yeah Im pretty much noob, but understand the basics of basics. I want to begin fresh. Lets say just help me with earning 100 bucks with each kill. Lets forget everything else.

Share this post


Link to post
Share on other sites
I want to begin fresh. Lets say just help me with earning 100 bucks with each kill. Lets forget everything else.

Your best bet is probably to go with a "killed" event handler and use set/getVariable due to it's ability to create a default value on-the-fly if one doesn't exist. Add this to each unit:

this addEventHandler ["Killed",
{
_killer = _this select 1;
if (_killer == player) then
{
	player setVariable ["player_money", (player getVariable ["player_money", 0]) + 100];
};
}];

Share this post


Link to post
Share on other sites
Your best bet is probably to go with a "killed" event handler and use set/getVariable due to it's ability to create a default value on-the-fly if one doesn't exist. Add this to each unit:

this addEventHandler ["Killed",
{
_killer = _this select 1;
if (_killer == player) then
{
	player setVariable ["player_money", (player getVariable ["player_money", 0]) + 100];
};
}];

Thank you. Will try tonight

Share this post


Link to post
Share on other sites
Your best bet is probably to go with a "killed" event handler and use set/getVariable due to it's ability to create a default value on-the-fly if one doesn't exist. Add this to each unit:

this addEventHandler ["Killed",
{
_killer = _this select 1;
if (isPlayer _killer) then
{
	_killer setVariable ["player_money",( (_killer getVariable "player_money") + 100),TRUE];
};
}];

Fixed.

Share this post


Link to post
Share on other sites
Fixed.

I like the changes you made, but my code worked just fine, now yours wouldn't be able to get money because you can't add anything to nil. You should go with the alternate syntax for getVariable, due to it's ability to set a default variable.

this addEventHandler ["Killed",
{
_killer = _this select 1;
if (isPlayer _killer) then
{
	_killer setVariable ["player_money",((_killer getVariable ["player_money",0]) + 100)]; //no need to make persistent
};
}];

Also, keep in mind that the event handler will fire on every client that has added it, which would be all of them since this EH is being added from the unit's init line. Therefore, as long as there's no way to actually spend the money you're getting, the values will be the same across each client, so there's no reason to create extra network traffic.

Share this post


Link to post
Share on other sites

True, mostly.

Except for this:

if (_killer == player) then

which is quite a bit different to this:

if (isPlayer _killer) then

Since you used the former in your version, each players money would only be saved locally for the player.

Share this post


Link to post
Share on other sites
True, mostly.

Except for this:

if (_killer == player) then

which is quite a bit different to this:

if (isPlayer _killer) then

Since you used the former in your version, each players money would only be saved locally for the player.

Right, this is what I had intended. That system can be easily integrated to multiplayer with a single PVEH that indicates the unit and amount of money, then each client can update that data locally

Share this post


Link to post
Share on other sites
Right, this is what I had intended. That system can be easily integrated to multiplayer with a single PVEH that indicates the unit and amount of money, then each client can update that data locally

Wow I just saw this post again and thank you for so many replies. I am a SP man (like I so-enthusiastically mention in other threads). And I use EOS. I am so sorry to bug you guys again. But by copying this script to only my player unit's init field will solve the purpose (coz i'll be playing it SP)? I mean there is no AI on editor if you use EOS. So now?

Edited by TheLegendaryKhan

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

×