TerrorOnes Posted May 31, 2019 Share Posted May 31, 2019 Hi i need help with scripting... like turn on the light by pressing button... playing animation by entering trigger, or initiate the quest... i know how do these with New Vegas but in FO4 i don't know where to start. Link to comment Share on other sites More sharing options...
DieFeM Posted May 31, 2019 Share Posted May 31, 2019 (edited) turn on the light by pressing button Let's say you have a model that will act as button, you'll need to create a new object in the object window in order to be able to place it in the world, since it is going to be used as a button, you need to create an activator.Create a new activator, select your button model and set a name for it. The name is important because if you don't set a name the activation will not appear.Now you have a button that shows an activation option that you can use in game, but it does nothing.In your activator there's a place where you can attach a script, right click on it, click "add script" and select the option for a "new script".You can attach scripts on base objects (the objects in the object window) or in a reference (the object in the render window).When you add a new script you can right click on it to edit the script source and write your code. Now you are editing the script file, there's only a header that looks like: Scriptname MyNewScript extends ObjectReferenceYou need to find out what functions you can use on this type of object, look for ObejectReference in the wiki at creationkit.com, is the best place to start; Click on fallout 4 and then search for ObjectReference, which is the type of script we are using now. You'll find ObjectReference Script: https://www.creationkit.com/fallout4/index.php?title=ObjectReference_Script There are functions and events, you want turn on the light when you press the button, or said with "CK terminology", Play the animation of the light when you activate your button, so you need to use the event OnActivate: Scriptname MyNewScript extends ObjectReference Event OnActivate() ;turn on the light EndEventNow you need to find out how to turn on the light. The light will be an object in the world, so it is an ObjectReference, you need a property in the script that will point to the light in the world,and run the "On" animation in this reference by calling the function PlayGamebryoAnimation on it: Scriptname MyNewScript extends ObjectReference ObjectReference Property MyLight Auto Event OnActivate() MyLight.PlayGamebryoAnimation("On") EndEventNow save the script and it will be compiled automatically, edit the properties of the script and fill MyLight with the actual light reference.You can find out what animations are available for this model by opening it with NifSkope. Edited May 31, 2019 by DieFeM Link to comment Share on other sites More sharing options...
Recommended Posts