senterpat Posted February 2, 2024 Share Posted February 2, 2024 Heyo, not super familiar with quest aliases and such, but what I want to do is simple I think, I just want to assign a placed workshop item to a reference alias so I can do stuff with it after being placed, the first section fires fine, but it doesn't seem to be firing when placing the item (using a vanilla asset to test). Eventually I want it set up to use the decoration category keyword rather than I specific reference, but wanted to make sure I could trigger it, but can't even get that done   Scriptname TestScript extends Quest conditional ReferenceAlias Property ActiveObject Auto const Actor Property PlayerRef Auto const Activator Property Tester Auto const Event OnQuestStarted() Self.RegisterForRemoteEvent(Tester as ScriptObject, "OnWorkshopObjectPlaced") debug.messagebox("init") EndEvent Event ReferenceAlias.OnWorkshopObjectPlaced(ReferenceAlias akSource, ObjectReference akReference) ActiveObject.ForceRefTo(akReference) debug.messagebox("placed") EndEvent  Link to comment Share on other sites More sharing options...
LarannKiar Posted February 2, 2024 Share Posted February 2, 2024 (edited) I haven't tried to compile it or try it ingame but it should receive both events: Scriptname TestScript extends Quest conditional ; do you need this quest flagged as conditional? If all your properties are Const and you don't declare local variables ("non-property variables") you can safely rename conditional to Const (it is optional though). ReferenceAlias Property ActiveObject Auto const Actor Property PlayerRef Auto const Activator Property Tester Auto const Event OnQuestStarted() Self.RegisterForRemoteEvent(ActiveObject, "OnWorkshopObjectPlaced") ; you need to register the variable that is an actual ReferenceAlias: ActiveObject (Tester is an Activator, it can't receive ReferenceAlias events) debug.messagebox("init") EndEvent Event ReferenceAlias.OnWorkshopObjectPlaced(ReferenceAlias akSource, ObjectReference akReference) akSource.ForceRefTo(akReference) ; you can use akSource instead of ActiveObject here (optional) as akSource of the event is ActiveObject debug.messagebox("placed") EndEvent (You should also consider removing the reference from the alias OnWorkshopObjectDestroyed to prevent the ref from staying persistent until either you fill another reference to the alias or the quest this script is attached to receives OnQuestShutdown (i.e., it stops)). Edited February 2, 2024 by LarannKiar Link to comment Share on other sites More sharing options...
senterpat Posted February 3, 2024 Author Share Posted February 3, 2024 Thank you for your response  This is my first real foray into using quest aliases so I'm mostly working using trial and error  I do plan on cleaning it up, this was just a quick script to see if I could get it to trigger, which I'm still having trouble doing, but that is possibly because I'm assigning the Alias wrong. Right now its set up as: Name:ActiveObject Flags: Optional Unknown 00 00 00 00 I copied that from OutpostTutorial quest, as that deals with placing objects so I thought it might work  I tried adding several version of alias types, as well as "Force into Alias when Filled" but none would get the second debug message to fire.  Link to comment Share on other sites More sharing options...
LarannKiar Posted February 3, 2024 Share Posted February 3, 2024 (edited) I know it's a TestScript , as actually it can't fill akReference into the alias ActiveObject because it gets registered for the OnWorkshopObjectPlaced event sent by the alias at a time when the alias doesn't point to the reference. The ScriptObject Alias receives events by references filled into it ("aliased refs") so akReference would need to be in the alias first for this to be sent. You'll either need to attach an ObjectReference script to the Activator object "Tester", or use Alias conditions, or the Story Manager to the get reference into ActiveObject. (If you know what object it is then probably the ObjectReference script would be the easiest). Edited February 3, 2024 by LarannKiar Link to comment Share on other sites More sharing options...
senterpat Posted February 3, 2024 Author Share Posted February 3, 2024 (edited) No it's going to have set the reference to almost any deco item when they place it, and set them into the reference. I set the alias type to "Find Matching Reference from Event" with FromEvent to craft item, and the EventData to CreatedObject, it seemed to me that this would be what I needed, but it doesn't seem to be working. Is that how you get it from the story manager? Or will I need to send the story event manually? It doesn't really seem like I can register for story events from looking at other scripts.  I could just attach the script to each decoration item, but that would require patches for modded decor, so ideally getting the reference dynamically would be best.  I'll continue to mess with it, going to dig into xEdit and see if I can figure out how story manager event nodes work. Edited February 3, 2024 by senterpat Link to comment Share on other sites More sharing options...
LarannKiar Posted February 4, 2024 Share Posted February 4, 2024 (edited) I'm not familiar with Starfield's Story Manager (SM) to be honest, only with Fallout 4's but Craft Item is unlikely to be sent OnWorkshopObjectPlaced. From what I've seen so far, the native code is consistent about CraftItem and if this event actually works (I think it does) then it's most probably sent only after creating an inventory item at a Crafting workbench, like in FoodCraftingMenu for example. If BGS didn't expose the workshop placement event to the SM then unfortunately it won't help. In theory, if the console command AttachPapyrusScript works in Starfield you can use Debug.ExecuteConsole to attach a script to a form at runtime (whether it works or not, restricted to object references or accepts base forms, I don't know..). If you're interested and SFSE dependency isn't an issue, I can take a look at the native workshop placement event and try to pass the placed object's reference to Papyrus with an SFSE plugin. I recently wrote a plugin to pass ship fuel values to Papyrus so I could make one for the workshop events (in theory, I haven't tried yet). Edited February 4, 2024 by LarannKiar Link to comment Share on other sites More sharing options...
senterpat Posted February 5, 2024 Author Share Posted February 5, 2024 (edited) SFSE dependency is not an issue for me at all. Most of my mods end up requiring them anyways, and all mods require them right now  If you could make such an event that would be neato bandito and make my life easier for sure. I didn't have too much time to mess with it yesterday. But I'm off work today and have some time to test around with it.  AttachPapyrusScript does work in Starfield, I had to use it for another mod already using bat commands.  edit: This is unrelated, but you may know better than most. Is there any way to reset the players level to 1? If possible it seems it would require script extension, as all my research and attempts seem to point to it being impossible. Edited February 5, 2024 by senterpat Link to comment Share on other sites More sharing options...
LarannKiar Posted February 5, 2024 Share Posted February 5, 2024 (edited) I took a look at OnWorkshopObjectPlaced and yes I can pass the workshopRef and placedRef to Papyrus. Event callbacks I make usually work like this:   - one defines a scriptname in an INI (can be hardcoded in the plugin though)   - the SFSE plugin registers itself for the event   - calls a global function in the given script every time the event is received and pass the event data to this function (like OnWorkshopObjectPlacedEx(ObjectReference placedRef, ObjectReference workshopRef, (...)). An INI setting can be used to turn off the callback for the plugin, like [Events] bOnWorkshopObjectPlaced=0. I haven't checked out the scrap, grab and move events yet but supposedly their structures shouldn't be different.. As for the player level, patching the blocking condition to hide the "We don't support leveling down" message and let the code process the function instead of exiting isn't difficult but the game relies on the event "LevelIncrease" to let objects know about the player's new level. The Story Manager is also registered for it if I'm remembering right and I'm pretty sure when one of the developers left that error message it's because they didn't design the code to actually support leveling down. So, probably it'd take a more complex plugin to properly add this functionality to the game , e.g., to level down Leveled forms as well. For the player's level only, I'll see what I can do but chances are high it would end up breaking something.. Edited February 5, 2024 by LarannKiar Link to comment Share on other sites More sharing options...
senterpat Posted February 5, 2024 Author Share Posted February 5, 2024 That sounds good, I don't understand all of it, but I can probably work it out if the event can be triggered  As for the player level issues, the level change would (optionally) happen at the beginning of a NG+, letting the player start a Unity playthrough at level 1. I'm not sure as I can't test it, but I think most things get reset when going through unity, so the leveled lists and such shouldn't be an issue, if I reset the level before the player actually enters unity. Link to comment Share on other sites More sharing options...
aurreth Posted February 5, 2024 Share Posted February 5, 2024 18 minutes ago, senterpat said: As for the player level issues, the level change would (optionally) happen at the beginning of a NG+, letting the player start a Unity playthrough at level 1. I'm not sure as I can't test it, but I think most things get reset when going through unity, so the leveled lists and such shouldn't be an issue, if I reset the level before the player actually enters unity. I saw a mod maybe a week ago (?) that starts a brand new game as NG+ level one. Maybe not so much a mod as several bat files and instructions on how to use them. That might help you. Link to comment Share on other sites More sharing options...
Recommended Posts