Results 1 to 9 of 9

Thread: Arma 2 Money script help.

  1. #1

    Arma 2 Money script help.

    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.

  2. #2
    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.

  3. #3
    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:
    Code:
    _u setVariable ["Money",100];
    and then to modify that variable, simply set it again.
    Code:
    _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.

  4. #4
    sorry did not need to post this read the last post please
    Last edited by MadranLamont; Jun 25 2011 at 22:08.

  5. #5
    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.
    Last edited by MadranLamont; Jun 27 2011 at 21:23.

  6. #6
    can any one tell me if this script can be set to use money? and if so how? i seem to be stumped.
    Code:
    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";
    };

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

    1.
    Code:
    MYmoney = 1000
    2.(this is were the fun happens)
    Code:
    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

    Code:
    _target = cursorTarget;
    
    if (Mymoney < 250) then {
    	Mymoney = Mymoney - 250};
    	
    if (_target == !Alive) then {
    	_target Mymoney = Mymoney + 250};
    Thank you in advance for help.
    Last edited by MadranLamont; Jun 30 2011 at 20:48.

  8. #8
    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

  9. #9
    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
    RP-Mods Dev Team

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •