Jump to content
Sign in to follow this  
MadranLamont

Arma 2 Money script help.

Recommended Posts

Hello, for some time now i have been looking and trying to make my own money and shop script for arma 2 and so far have had no luck. The type of script I am trying to make is a money script where you gain money over time and a shop script that will let you look at a menu to pick what weapons and things you want. Is there any script like this or tutorial that I can see to help me with this? Thank you in advance for any help you can offer.

Share this post


Link to post
Share on other sites

I'm no scripting expert, but I know some basic things that would help out.

Say the variable for the players money is called "cash"

When you buy a weapon you could have a script such as -

cash=cash-gun1price; player addweapon "gun"; player add magazine "ammo"

something like that.

Share this post


Link to post
Share on other sites

I'm actually working on the same sort of project. An easy way to keep track of a player's money is to simply store a variable called "Money" on the unit (important: make it the unit, not "player," as you run the risk of contaminating other units money variables doing that).

IE:

_u setVariable ["Money",100];

and then to modify that variable, simply set it again.

_curmoney = _u getVariable "Money";
_u setVariable ["Money",_curmoney + 100];

Doing the actual shopping is a bit more complicated but this should set you on the right path. I'm a novice at scripting myself, but I've found this to work rather well.

Share this post


Link to post
Share on other sites

sorry did not need to post this read the last post please

Edited by MadranLamont

Share this post


Link to post
Share on other sites

I found a script that was kinda what i was looking for but after picking it apart I can not seem to find how he did his shops so its back to where i started from.

Edited by MadranLamont

Share this post


Link to post
Share on other sites

can any one tell me if this script can be set to use money? and if so how? i seem to be stumped.

if (rating Player < 25) then
{
   Player groupChat "You do not have enough money";
} else {
   Player addrating -25;
   mygunlocker_1 addWeaponCargo ["ItemWatch",1];
   Hint "THE WEAPON IS NOW IN YOUR GUN LOCKER AT YOUR CAMP";
};

Share this post


Link to post
Share on other sites

Ok. so i got my money and shop working (here is the script if any one want to see it nothing to complex)

1.

MYmoney = 1000

2.(this is were the fun happens)

if (Mymoney < 250) then
{
   Hint "You do not have enough money";
} else {
   Mymoney = Mymoney -250;
   mygunlocker_1 addWeaponCargo ["AK_47_M", 1];
   mygunlocker_1 addMagazineCargo ["30Rnd_762x39_AK47", 5];
   Hint "You got an AKM and five mags";
};

What i need help with now is a give money command. This is what i have, can any one tell me how to fix it

_target = cursorTarget;

if (Mymoney < 250) then {
Mymoney = Mymoney - 250};

if (_target == !Alive) then {
_target Mymoney = Mymoney + 250};

Thank you in advance for help.

Edited by MadranLamont

Share this post


Link to post
Share on other sites

Sorry to bump an old thread but I need to know how to do this. More specifically, this doesn't look like a simple code to put into the Init field of a unit. Do I do this in an external Notepad document for example; then move it into the MPMisson folder or wherever?

Please help your assistance will be greatly appreciated as it would help a lot :)

Share this post


Link to post
Share on other sites

Each external script (such as those above) would need to be placed as .sqf documents (.txt document renamed to .sqf) and would then be placed into the mission folder with the mission.sqm file (mission.sqm is made by the editor when you press save in-game) then you would pack the mission file into a .pbo (by using this tool http://www.armaholic.com/page.php?id=1434) and placed into the mpmissions file in the main arma 2 directory... then you should be good to go :)

that may not have been very clear lol :D

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
Sign in to follow this  

×