Hoamaii Posted July 12, 2018 Share Posted July 12, 2018 Hi guys, Haven't played around much with workshop yet. A few questions if any of you can enlighten me... 1 - OnWorkshopObjectPlaced(), OnWorkshopObjectDestroyed(), OnWorkshopObjectGrabbed(): can't get any of these to return when used in scripts attached to the base form of a new furniture object.Wiki says: "akReference: If the script is on a Workshop reference, the ObjectReference that was just placed. If the script is on the placed reference, this is the Workshop reference", so my understanding of that is it should return when my objectreference has been placed - it does not. 2 - OnInit() only runs the first time a reference is created in any settlement, after that it never runs again, behaving as if the form was stored somewhere (as an alias maybe?) even after all objects were destroyed. Does that mean all new objects added to the workshop recipe remain stored in your game and your saves no matter what? And if so, any idea where they are stored? Couldn't find that info in the workshop quests... 3. I'm trying to limit the placement of my new forms to only one per settlement - for that I added a condition to the recipe as "GetWorkshopItemCount == 0". Problem is after I destroyed them, the workshop still won't let me create a new form, even though the count obviously equals zero now... It still lets me create one form per settlement, which means "GetWorkshopItemCount" returns the proper count per settlement, but that count never reverts to zero even after all placed forms have been destroyed. Any idea for a work around? Many thanks in advance!.. :) Link to comment Share on other sites More sharing options...
BlahBlahDEEBlahBlah Posted July 12, 2018 Share Posted July 12, 2018 Not much help here, but I can confirm 1 does work (along with lalaMoved()), we use them extensively on built actors, furniture, etc. so not sure what might be happening there. 3, even if you disable/delete the object in lalaDestroyed() (if you get the event to work for you at all eventually)?I can imagine a few workarounds, like noting something on the Workshop in build that the recipe looks for at build time for example, but that would be a wacky way to track it. Link to comment Share on other sites More sharing options...
Hoamaii Posted July 12, 2018 Author Share Posted July 12, 2018 OnWorkshopObjectPlaced() or Moved or Destroyed works for you on placed references? Damn... I must be doing something wrong - can't figure out what tho'... 3. I solved that one : not that much a strike of genius on my part thought... :blush: all I had to do was wait a few seconds to give time to the Workshop to update its placed objects count and the count went back to zero... Sometimes you're so focused on issues, you forget the obvious!.. :whistling: Link to comment Share on other sites More sharing options...
wim95 Posted July 12, 2018 Share Posted July 12, 2018 1.Events OnWorkshopObjectX come from ObjectReference script. Your script inherits from the parent? If not, you need RegisterForRemoteEvent. From my practice: grandson: Scriptname wim95Script extends WorkshopObjectScript son: Scriptname WorkshopObjectScript extends ObjectReference father: Scriptname ObjectReference extends Form What family of HoamaiiScript? Link to comment Share on other sites More sharing options...
BlahBlahDEEBlahBlah Posted July 12, 2018 Share Posted July 12, 2018 Oh, might try the same (a short wait) for those events then, or maybe (if what you want can support it) try a while loop while isinworkshopmode (or whatever it was)? Link to comment Share on other sites More sharing options...
Hoamaii Posted July 13, 2018 Author Share Posted July 13, 2018 @ Wim95: My scripts are attached to custom forms (furnitures and activators) - so you'd probably call that the fathers, but of course I also want them to run on the reference when they're being used. Since onInit() seems to runs only the first time a form is placed into the world as a reference, I tried to move my functions to onLoad(). As a matter of facts, I need my scripts to run as separate script instances on each separate object instance once placed. The fact that the same script seems to run only once is a bit of an issue for me: I need to use states and make sure every new script instance starts in the auto state once placed, and not be already in another state because it's already been activated several times in other workshops... I realised I'm also having issues between Sanctuary, Red Rocket and Abernathy, it seems these settlements are so close that actions in Red Rocket for instance tend to affect Sanctuary and vice versa - I already noticed that in the vanilla game, you guys found any workaroudnt ot that? Link to comment Share on other sites More sharing options...
deadbeeftffn Posted July 13, 2018 Share Posted July 13, 2018 Every placed item has it's own virtual machine, they do not share a single script or any variables. Each one is forking a seperate instance.OnInit() is called only once for every instance (Except if the item has a damage model - in that case OnInit() will be called when the item gets repaired)Actually, i'm using OnWorkshopObjectPlaced(), OnWorkshopObjectMoved(), OnWorkshopObjectGrabbed() etc. a lot. So i can assure you that this functions are working fine. Link to comment Share on other sites More sharing options...
wim95 Posted July 13, 2018 Share Posted July 13, 2018 The right words about inheritance (Im call that the fathers):Extending Scripts. Scriptname wim95:SpawnSettlerButton extends WorkshopObjectScript ;Scriptname WorkshopObjectScript extends ObjectReference Event OnWorkshopObjectPlaced(ObjectReference akReference) trace(self, "Event OnWorkshopObjectPlaced") SelfREF = Self as ObjectReference Self.BlockActivation(True, True) ButtonAddREF = SelfREF.PlaceAtNode("ButtonAddNode", SpawnSettlerButton_Yellow, 1, false, false, false, false) StartTimer(1) EndEvent I have an activator. The activator has an FormID = "AA000800".After I create an activator in the workshop mode, Game place a temporary reference to activator. FormIDRef = "FF000001".Second activator has other temporary reference FormIDRef = "FF000002". My script always receive OnWorkshopObjectPlaced event. I not use onLoad or onInit, only OnWorkshopObjectPlaced. In trace log:[...][FF000001] Event OnWorkshopObjectPlaced[...][FF000002] Event OnWorkshopObjectPlaced If your script dont extends ObjectReference himself or through parents, you not receive OnWorkshopObjectPlaced event. Link to comment Share on other sites More sharing options...
Hoamaii Posted July 13, 2018 Author Share Posted July 13, 2018 Thanks guys. Wim95, I'm assuming you attach this script which extends WorkshopObjectScript to the base form of your placed object, right? Never needed to extend scripts yet, I'll check your link, thanks! Link to comment Share on other sites More sharing options...
wim95 Posted July 13, 2018 Share Posted July 13, 2018 (edited) Never needed to extend scripts yet, I'll check your link, thanks! You always did. Look at your scripts. Scriptname wim95Script extends Quest Scriptname Quest extends Form Native Hidden Scriptname Form extends ScriptObject Native Hidden Scriptname ScriptObject Native Hidden ScriptObject = Matriarch Form = Grandfather Quest = Father wim95Script = Son Wim95, I'm assuming you attach this script which extends WorkshopObjectScript to the base form of your placed object, right? Edited July 13, 2018 by wim95 Link to comment Share on other sites More sharing options...
Recommended Posts