RileyEvan Posted March 6, 2018 Share Posted March 6, 2018 I'm currently working on an ambitious mod to add the majority of the subway tunnels and stations to Boston following existing rail lines and those proposed to improve commuting in real life. I know of at least one other mod that does something like this, but for various reasons it didn't live up to my hopes.Currently, I'm cluttering the Blue line that runs from MGH station to Lynn, and I wanted my intact Nuka vending machines to require prewar money. In Fallout 3, I accomplished this by adding a script to the vending machine that triggers on activation, checks player prewar money amount, and shows a message asking if player wants to spend said money. If the player agrees, the money is removed and the machine is activated. If the player doesn't agree, the machine does nothing. If the player has insufficient funds, it shows a message saying so.I cut my modding teeth on Fallout 3 and could do this there no problem but I am clueless about doing this in Fallout 4. I'm sure there were good reasons for changing this way of scripting when upgrading to the newer game but I don't even know where to begin. Link to comment Share on other sites More sharing options...
Jojash Posted March 6, 2018 Share Posted March 6, 2018 This actually sounds like a pretty good project to get started with scripting - since you said you have experience with F3, you might find this to be useful: https://www.creationkit.com/fallout4/index.php?title=Differences_from_Previous_Scripting. Cipscis also has many good Skyrim scripting tutorials on his site - while there are differences between Skyrim and Fallout 4 they are similar enough that many of these tutorials are still very helpful. http://www.cipscis.com/skyrim/tutorials/beginners.aspx After that, this specifically tackles menu creation in Papyrus - again it's for Skyrim, but should be transferable to Fallout 4. https://www.creationkit.com/index.php?title=Options_Menu The best thing to do though is to try writing out your script and once you have errors in it, to work from there. It can be hard to know where to start with such a complete change from F3/NV's language to Papyrus, but once you start going you'll see how similar the two languages really are and that ought to make things a bit easier. If the links I've provided seem too daunting, try just looking at some vanilla scripts to get a general understanding of Papyrus, additionally you can try having a look at scripts that are closely related to what you're doing. Once you have some understanding of the language you can use this to find functions you'll need for your own scripts: https://www.creationkit.com/fallout4/index.php?title=Category:Papyrus. Good luck! :) Link to comment Share on other sites More sharing options...
kitcat81 Posted March 6, 2018 Share Posted March 6, 2018 (edited) You can begin with adding a new script to your machine. Then you can add Event OnActivate. You can google all events and functions and they all have their wiki page where you can check synthax and find examples. And looking at source scripts really helps a lot. You should be able to find them somewhere in the Data-Scripts - Source folder if you have the CK installed.It could raughly look like this : Message Property MyMessageBox Auto Const Message Property NoMoneyMessage Auto Const MiscObject Property PrewarMoney Auto Const Form Property ItemToGive Auto Const Actor Property PlayerRef Auto Const Event OnActivate(ObjectReference akActionRef) If akActionRef == PlayerRef SellMyItem() EndIf EndEvent Function SellMyItem() If PlayerRef.GetItemCount(PrewarMoney)>3 ; set required amount int ibutton= MyMessageBox.Show() If ibutton == 0 ; top button PlayerRef.RemoveItem(PrewarMoney, 3) ; set required amount PlayerRef.AddItem(ItemToGive, 1) ElseIf ibutton ==1 ; do something or do nothing EndIf Else NoMoneyMessage.Show() EndIf EndFunction Edited March 6, 2018 by kitcat81 Link to comment Share on other sites More sharing options...
Recommended Posts