Jump to content

Release/Tutorial - Vending Machine


Recommended Posts

  On 10/13/2014 at 8:39 AM, Thug said:

ZeroK00L, thanks

Question and not trying to be smart, but why would you charge for sodas when in my chernarus server i am tripping over them?

 

On my server, the vending machines have a little under a 10% chance to spawn an orange sherbert. You pay 10oz silver and if you get the orange sherbert, you can sell it to the rare food and drinks trader I created and sell it for 1oz of gold. It's kind of like gambling. :)

Link to comment
Share on other sites

  On 10/13/2014 at 10:50 AM, BetterDeadThanZed said:

On my server, the vending machines have a little under a 10% chance to spawn an orange sherbert. You pay 10oz silver and if you get the orange sherbert, you can sell it to the rare food and drinks trader I created and sell it for 1oz of gold. It's kind of like gambling. :)

See, endless possebilities! :D

Like the way you think BetterDeadThanZed

Link to comment
Share on other sites

  On 10/13/2014 at 10:55 AM, Proximus said:

See, endless possebilities! :D

Like the way you think BetterDeadThanZed

 

After installing this script, I had another idea... place an object, such as a cash register, and players have to pay a set amount and in return they get some money back. It might be more than they paid, or it might be less, or it might be something useless like a tin can or a razor. A sort-of slot machine.

Link to comment
Share on other sites

  On 10/13/2014 at 10:50 AM, BetterDeadThanZed said:

On my server, the vending machines have a little under a 10% chance to spawn an orange sherbert. You pay 10oz silver and if you get the orange sherbert, you can sell it to the rare food and drinks trader I created and sell it for 1oz of gold. It's kind of like gambling. :)

I like that ideal

Link to comment
Share on other sites

So if all i want to sell is Beer (ItemSodaRabbit) in the machines, what would the script  be then and i mean ZeroKOOL's script. In the mean time i will be looking in the forums for the anwser. I thank you in advance for any help.

Link to comment
Share on other sites

//by ZeroK00L
private["_playerPos","_canVend"];

call gear_ui_init;
_playerPos = getPosATL player;
_canVend = count nearestObjects [_playerPos, ["MAP_vending_machine"], 4] > 0;
_soda = ["ItemSodaRabbit","ItemSodaOrangeSherbet","ItemSodaLvg","ItemSodaClays","ItemSodaSmasht","ItemSodaPepsi","ItemSodaMdew","ItemSodaCoke","ItemSodaLemonade"];

if (_canVend) then {
            
            playsound "vendingmachine";
            sleep 2;
            player playActionNow "PutDown";
            player addMagazine 'ItemSodaRabbit';
            cutText ["You received a Soda from the Vending Machine!", "PLAIN DOWN"];
};

I think the original script from ZeroK00l only puts ItemSodaRabbit in the players inv. (look at the player addMagazine line)

The version BetterDeadThanZed posted randomly picks a soda defined in the list

Link to comment
Share on other sites

  Reveal hidden contents

//by ZeroK00L
private["_playerPos","_canVend"];

call gear_ui_init;
_playerPos = getPosATL player;
_canVend = count nearestObjects [_playerPos, ["MAP_vending_machine"], 4] > 0;
_soda = ["ItemSodaRabbit","ItemSodaOrangeSherbet","ItemSodaLvg","ItemSodaClays","ItemSodaSmasht","ItemSodaPepsi","ItemSodaMdew","ItemSodaCoke","ItemSodaLemonade"] call BIS_fnc_selectRandom;

if (_canVend) then {
            
            playsound "vendingmachine";
            sleep 2;
            player playActionNow "PutDown";
            player addMagazine _soda;
            cutText ["You received a Soda from the Vending Machine!", "PLAIN DOWN"];
};

done

Link to comment
Share on other sites

  • 1 month later...
  On 10/10/2014 at 4:41 PM, Spodermayt said:

Modified this a bit ;)

Only for SingleCurrency

 

SelfActions:

  Reveal hidden contents

Vending\vending_foods.sqf:

  Reveal hidden contents

Vending\vending_drinks.sqf:

  Reveal hidden contents

Will this work with Zupas V3 coin? Would all i have to do is change CurrencyName to cashMoney?

Link to comment
Share on other sites

  • 2 weeks later...

Hey did anyone have a problem with the sound for the vending machine? Everything else works. I just don't hear anything when i buy.

I have the file vendingmachine.ogg in the vending folder. All my other sounds work i.e. Origins doors, metal gates.

This is what i have in my description.ext

 
#include "custom\extra_rc.hpp"
 
class CfgSounds
{
sounds[] = {};
 
class DoorCreak
    {
name="DoorCreak";
sound[]={sounds\doorCreak.ogg, 0.1, 1};
titles[] = {};
    };
class metalGates
    {
name="metalGates";
sound[]={sounds\metalGates.ogg, 0.1, 1};
titles[] = {};
    };
class stronghold
{
name = "stronghold";
sound[] = {sounds\vrata_sound.ogg,0.1,1};
titles[] = {};
    };
class vendingmachine
    {
    name="vendingmachine";
    sound[]={Vending\vendingmachine.ogg,0.9,1};
    titles[] = {};
};
};
 
#include "custom\snap_pro\snappoints.hpp"
Link to comment
Share on other sites

  On 12/24/2014 at 12:05 PM, Thug said:

 

Hey did anyone have a problem with the sound for the vending machine? Everything else works. I just don't hear anything when i buy.

I have the file vendingmachine.ogg in the vending folder. All my other sounds work i.e. Origins doors, metal gates.

This is what i have in my description.ext

 

 

this is how I have sounds 

 

class CfgSounds
{
sounds[] ={doorCreak,metalGates,vrata_sound,vendingmachine};


class DoorCreak
    {
name="DoorCreak";
sound[]={sounds\doorCreak.ogg, 0.1, 1};
titles[] = {};
    };
class metalGates
    {
name="metalGates";
sound[]={sounds\metalGates.ogg, 0.1, 1};
titles[] = {};
    };
class stronghold
{
name = "stronghold";
sound[] = {sounds\vrata_sound.ogg,0.1,1};
titles[] = {};
    };
class vendingmachine
    {
    name="vendingmachine";
    sound[]={Vending\vendingmachine.ogg,0.9,1};
    titles[] = {};
};
};

shows in instructions to have a \vending\

 

sound[]={\Vending\vendingmachine.ogg,0.9,1};

 

not so sure why there is that \vending

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...