Results 1 to 6 of 6

Thread: adding addAction if player has item (bribe function)

  1. #1

    adding addAction if player has item (bribe function)

    I have an addAction where the player can bribe a local to get information..
    But i would like that option to be availible only to those who have $$ in their pockets.


    How can i write the code so that once the player only get the "bribe" option once he has some cash in his pocket?

    Have tried another script i has, but that gives the option to bribe everywhere, not just when standing face to face to the correct civilian.
    Last edited by Frosties; Sep 21 2011 at 16:10.
    //
    Commanding Officer
    Joint Special Operations Command
    SWEBAT-GAMING



    Visit our website

  2. #2
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    name the civilian, here he is civilianName, you can also replace == civilianName with in [civ1,civ2,civ3] etc to have it work on multiples.

    Code:
    _id = this addAction ["Bribe", "script.sqf", [], 1, false, true, "", "_target == _this AND cursorTarget == civilianName"];
    My scripts:
    Spoiler:

    what to do when posting any kind of code dammit!!

    Any new mission editor or scripter in Arma2 should have read Mr Murrays Editing Guide Deluxe at least once, it still applies for A2 even though it was made for Armed Assault.

  3. #3
    How does that script check if the player has the money or not?

    Ive tried it but i cant get the Bribe option to appear at all, with or without money.

  4. #4
    This only allows you to bribe if you have money (the money "item" (actually a weapon) with classname EvMoney) and person has not been bribed before:
    PHP Code:
    this addAction ["Bribe""bribe.sqf", [], 1falsetrue""" ""EvMoney"" in (weapons _this) && not (_target getVariable [""bribed"", false])"]; 
    If you want to prevent anyone from bribing this guy again then in bribe.sqf or whatever you call your file that get's run you should set the "bribed" to true. This also frees you from having to deal with removing the actions over MP which can be tricky if you have not done it before:
    PHP Code:
    //bribe.sqf
    _target _this select 0;
    _caller _this select 1;

    //He cannot be bribed again - you probably want to remove the money from _caller too.
    _target setVariable ["bribed"truetrue]; 
    EvMoney
    Last edited by Muzzleflash; Sep 21 2011 at 17:31.

  5. #5
    @Muzzleflash:
    Thank you, that worked like a charm!!

    @Demonized:
    thank you for your effort as well, but didnt get it to work..

  6. #6
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    Quote Originally Posted by Frosties View Post
    @Demonized:
    thank you for your effort as well, but didnt get it to work..
    i forgot to add in the cash bit in the post... anywho, MF to the rescue.

Posting Permissions

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