markyrocks Posted August 30, 2018 Share Posted August 30, 2018 So I'm actually making progress on the mod I'm working on. I've changed up my strategy and I really feel like I can do what I want to do now. Well one hurdle is starting in the way. Like the title says I'm looking to pass an object reference through multiple menus and submenus, fragment scripts ect. The point of this is say I wanted to placeactoratme() an npc then add like cloths options or armor guns ammo ect. If I can pass the obj ref along I can manipulate it almost infinitely though the menus. My thoughts are either make a global variable, which I'm not confident can actually store a obj ref. I could just keep passing the form as an object reference and do a couple checks on it to make sure it's the right ref, which would be annoying but doable. I only think about the possibility of multiple refs created in a small group around a terminal...it would be hard to determine which one you're actually working on without the specific ref. Any help would be great thanks. Link to comment Share on other sites More sharing options...
Reneer Posted August 30, 2018 Share Posted August 30, 2018 Just use a quest and call on the quest from your terminals. Link to comment Share on other sites More sharing options...
SKKmods Posted August 30, 2018 Share Posted August 30, 2018 Trying to manage logic in terminal script fragments is a PITA. Far better to decouple terminal UI calls to manageable functions in quest scripts by setting variable flags or passing references. I use hundreds of these type of switches: pSKK_476LootChance.SetValue(0) pSKK_476MainQuestScript.SwitchLootChance() pSKK_476LootChance.SetValue(100) pSKK_476MainQuestScript.SwitchLootChance() have standardised on GlobalVariables rather than script or function variables for speed, quality and management. You can not store an object reference in a Global, but you can refer to an index in an array of ObjectReferences or ReferenceCollectionAlias. Really to HOW is secondary to the WHAT you are trying to achieve as there are so many ways to do this stuff from quick, dirty and unmaintainable to structured elegance designed for live updates and change. Link to comment Share on other sites More sharing options...
markyrocks Posted August 30, 2018 Author Share Posted August 30, 2018 As always great advice. Thanks Link to comment Share on other sites More sharing options...
SKKmods Posted August 30, 2018 Share Posted August 30, 2018 My pleasure. Some may ask why bother with the global and just call: pSKK_476MainQuestScript.SwitchLootChance(0) pSKK_476MainQuestScript.SwitchLootChance(100) To which the answer is UX: one will probably want to filter the presented choice(s) based on its conditions: Container loot None 0% [make normal] Container loot Normal 100% [make none] So a variable will be needed to drive that condition filter. I have found that looking up remote property conditioned GetVMQuestVariable or GetVMScriptvariable is noticably slower than GetGlobalValue and the terminal screen takes an age to refresh (run a high iTerminalDisplayRate setting) Link to comment Share on other sites More sharing options...
Recommended Posts