Jump to content

Photo

Help with vending machine script?

vendor vending machine dispenser terminal mod refrigerator purchase shop store

  • Please log in to reply
4 replies to this topic

#1
jahgaminginc

jahgaminginc

    Journeyman

  • Members
  • Pip
  • 39 posts

Hey guys, my second mod is currently WIP and I am trying to figure out how to make a vending machine in the GECK.

I am quite experienced with the GECK for making interiors and can learn new skills if I need too but as a beginner scripter I fear this may be a complicated start.

I know this isn't exactly a mod request but I figured this is the most appropriate place to put it as I couldn't find a script help section.

 

So I am thinking of having a refrigerator or vending machine with an accompanying terminal situated on a desk next to it.

The idea is that when you select one of the items from the terminal that it will spawn in the container (the fridge)

 

I would also like to make it remove caps when an item is purchased but for now I will concentrate on getting the rest of the script to work!

 

Alternatively when the player selects the option (e.g. Cram [10 Caps] ) the item will automatically be put into their inventory

(maybe it could use the player.Additem command?)

 

Thanks in advance for any of the suggestions you have it will really help!

 

P.S. I have seen a mod like this in FO3 where you can buy three different types of Nuka-Cola from a terminal and it takes Pre-Way money.



#2
jazzisparis

jazzisparis

    The baby-eating Bishop of Bath and Wells

  • Premium Member
  • 2,635 posts

Every Menu Item you add to a terminal has an optional Item Result Script box. You can use it to accomplish both options you mentioned.

 

First, place the vending machine in the cell, tick Persistent Reference, then give it a unique Reference Editor ID (I will use jahVendingMachineREF in my script example).

 

As for the result scripts mentioned above, the following is an example for a Nuka-Cola menu item:

player.RemoveItem Caps001 10
jahVendingMachineREF.AddItem NukaCola 1

You would probably also want to add an Item Condition (in the above case, GetItemCount Caps001 >= 10) for each Menu Item, checking if the player has enough caps in order to complete the purchase (if he doesn't, that option will not be selectable).



#3
jahgaminginc

jahgaminginc

    Journeyman

  • Members
  • Pip
  • 39 posts

Thanks very much!!

I'm sure your script must be right - but I did alter it a bit and now it isn't working :sad:

I think the problems are either I need to tick Persistent Reference on the terminal too, or that I shouldn't be using the Refrigerator and Cabinet containers. Is this the case, do I have to use the Vending Machine specifically?

 

Thanks again very much,

J

 

 

Link to video: http://www.youtube.c...h?v=2It1A3ye7us (Hope it helps)

 

Edit: If anybody else can help please respond!


Edited by jahgaminginc, 29 August 2013 - 02:18 PM.


#4
uberlux

uberlux

    Enthusiast

  • Members
  • PipPip
  • 156 posts

An alternative would to be just adding it to the player inventory, its easier for you and the player.

 

Might also want to keep in mind that message boxes are more professional than using terminals (eww terminals), try them out.

 

Theres good tutorials on making functioning world objects, all over youtube.



#5
devinpatterson

devinpatterson

    Resident poster

  • Supporter
  • PipPipPipPipPip
  • 7,635 posts

Thanks very much!!

I'm sure your script must be right - but I did alter it a bit and now it isn't working :sad:

I think the problems are either I need to tick Persistent Reference on the terminal too, or that I shouldn't be using the Refrigerator and Cabinet containers. Is this the case, do I have to use the Vending Machine specifically?

 

Edit: If anybody else can help please respond!

 

OK go ahead and post the script, so we can see what you changed.

The reason Jazzisparis (who know more about scripting than I do) had you tick the container as persistent is because it's required if it's used in a script (and the results scripts are indeed scripts).

Any container ref should work, it doesn't have to be a vending machine only per se. 







Also tagged with one or more of these keywords: vendor, vending machine, dispenser, terminal, mod, refrigerator, purchase, shop, store

IPB skins by Skinbox
Page loaded in: 1.052 seconds