markyrocks Posted August 23, 2018 Share Posted August 23, 2018 I'm a noob to modding but I thought I knew something about scripting and normally I can get by but I'm having a rough time. I made basically a blank workbench,.. I can place it in game ect. Menu shows nothing.. I expected that. I've just now wrapped my mind around registering events. Do I basically have to register an event for any function I run? Or do I have to load every function I call into the item function list ahead of time? Also how would I find the reference of an object? I realize how to do it with an object I place in the editor but how to I get like unique references of an object that could be placed wherever. What are the rules for looping through an array? Where in my script is it legal? The wiki doesn't explain these rules. This language is crazy formal, I'm assuming is like one layer away from c++, but geez c++ isn't this formal. Link to comment Share on other sites More sharing options...
SKKmods Posted August 23, 2018 Share Posted August 23, 2018 I would like to help, but the questions are rather generalised with too many entry points. Suggest you describe what it is you would like to do as an outcome to frame context for more helpful answers. Link to comment Share on other sites More sharing options...
deadbeeftffn Posted August 23, 2018 Share Posted August 23, 2018 Recommended reading: https://www.creationkit.com/fallout4/index.php?title=Category:Papyrus Link to comment Share on other sites More sharing options...
markyrocks Posted August 23, 2018 Author Share Posted August 23, 2018 (edited) Event OnInit() ; Register for Activate event from the secret door RegisterForRemoteEvent(SecretDoor, "OnActivate") EndEvent  ; Special event to receive when the door is activated ; Note the type in the event name matches the type of the first parameter, and is also the script where the ; event is originally defined. Event ObjectReference.OnActivate(ObjectReference akSender, ObjectReference akActionRef) Debug.Trace(akSender + " was activated by " + akActionRef) EndEvent Ok so in the above example anyone would assume SecretDoor was previously declared as objectreference property SecretDoor Auto. Where does the value for SecretDoor come from? I'm assuming that this script would be on the form of the SecretDoor. Does the game automatically assume that the item that the script is attached to is the SecretDoor? Edited August 23, 2018 by markyrocks Link to comment Share on other sites More sharing options...
SKKmods Posted August 23, 2018 Share Posted August 23, 2018 There are sooooo many different ways of doing stuff you need to be clear about the outcome before getting granular on the implementation: As a < type of user >, I want < some goal > so that < some reason >. As a quest script I want to know every time a specific door has been opened so I can spawn a hostile radroach nearby. PS this is trying to be helpful not difficult. Link to comment Share on other sites More sharing options...
markyrocks Posted August 23, 2018 Author Share Posted August 23, 2018 I have a workbench, I want to open the menu...have it do stuff. Does the registerforremote event basically define the reference. LikeObjectreference ref Autoregisterforremoteevent(ref,"event") ;this like essentially defines ref as the unique object reference associated with the object the script is attached to? Am I correct in saying this? Link to comment Share on other sites More sharing options...
markyrocks Posted August 23, 2018 Author Share Posted August 23, 2018 I have a pretty good understanding of how other languages operate. The reason this bothers me is bc of the way the variable is defined. The only way I can describe it in every language I've used it is usually clear where a variable definition comes from. You can literally track a variable from the moment its defined to the moment its deleted. I guess the part that was/is confusing is the fact that it's not possible for the variable to be defined until runtime. Even in a situation like that the data would be coming from a user input or a iniread, something that you could physically see in the script. Link to comment Share on other sites More sharing options...
markyrocks Posted August 23, 2018 Author Share Posted August 23, 2018 Ok I'm carefully reading though the reference literature and I think the issue I'm have is that I need to set the property of the script to point at the specific object that I created...omg I'm so dumb. I have no idea how I overlooked that. I was even using that some last night. Me personally I'd rather just type in the ID of the object inside the script, it would be less confusing for me. But whatever. Link to comment Share on other sites More sharing options...
payl0ad Posted August 23, 2018 Share Posted August 23, 2018 You'll soon learn that it's pretty dumb to hard-code FormIDs into a script. In a perfect world, your script doesn't contain any values by itself. Maybe some local variables. have it do stuff. Please specify "stuff". Do you need a crafting workbench or do you need the workbench to do something besides making new items? Link to comment Share on other sites More sharing options...
markyrocks Posted August 23, 2018 Author Share Posted August 23, 2018 I wanted to just figure out that specific concept b4 I worried about "stuff". Honestly I want it to show a menu and then create custom objects from menus and submenus but I'm just taking it one step at a time Link to comment Share on other sites More sharing options...
Recommended Posts