Jump to content

SetLinkedRef/Remote workshop event registration Help?


Recommended Posts

I'm having trouble with this one, which object do I need to call it from? I have a workshop object (Rack) that when built adds a perk to the player that uses a quest to override default Rack activation and instead show a menu that has various scripted functions (all called from the QuestScript by the Perk using the menu it shows) that can placeAtNode() another object(WindMill), and then other objects like (Flooring) get placeatNode()-ed into the Windmill's 3d, eventually placing Actors(Modified Turrets) into the resulting creaky mess. It works fine as long as you take it all apart every time using the Menu functions before you do anything to it in Workshop Mode like move it or scrap it but as you might imagine the whole thing is kinda touchy about the base Rack being moved or scrapped if you don't. Meaning stuff just floats there forever. The Rack has a script already, although not the one that injects the "remote" objects so I thought it'd be super-easy to use ItemRef.setlinkedref(Rack, RackLinkKeyword) or Rack.SetLinkedRef(ItemRef,RackLinkKeyword) when I place the objects/actors then Rack.GetLinkedRef(RackLinkKeyword).Disable() and Delete() in the base Rack's working OnWorkshopDestroyed Event as a workaround (at least then there wouldn't be floating turrets and windmills all over and the Injected Objects are free to make so you can just rebuild 'em np was my thought) but it's not so much, been fighting with it for days now. I suspect I might need to linkchain them more like a patrol, the turrets are 3 "steps" from the Rack, not properly attached to the base object and Actors to boot, not attached Activators or MoveableStatics like the other stuff, but any advice appreciated, I'm not having any luck, really, with what I'm trying.

 

As another option to accomplish this, I could possibly also use some help adding registrations for remote OnworkshopDestroyed events in the script that does inject the objects, atm this doesn't seem to be working at all. Is it possible to register a QuestScript for Workshop EVents with the right ObjectReference/Property/command? Anyone wanna reply with a snippet showing me how, with the resulting remote event? I come up with "RegisterForRemoteEvent(akRack, "OnWorkshopObjectDestroyed") in the receiving/Quest script and then "Event ObjectReference.OnWOrkShopObjectDestroyed(ObjectReference akActionRef, ObjectReference akItemRef) which atm don't work for me.

 

And finally, anyone know how to link my Turrets to their Settlement from a script so Their SafetyAV applies properly? Likely solved if you can answer the question in the first line, I could then use Settlement.SetLinkedRef(TurretRef[Count], WorkshopItemKeyword) in the while when I place them initially but again, it's not working quite how I thought, so I might have that backwards. Likely do, as that line exactly don't work in my scripts atm, in fact. But neither did inverting it, so idk what's up there, either, really.

Link to comment
Share on other sites

Form Property BirdBase auto const ;BirdCrow

Event OnWorkshopObjectPlaced(ObjectReference akReference)
	ObjectReference newbird = Self.PlaceAtNode("CritterPerch00", BirdBase, 1, True, False, False, True)
	Self.SetLinkedRef(newbird)
EndEvent

Event OnWorkshopObjectMoved(ObjectReference akReference)
	ObjectReference thatbird = Self.GetLinkedRef()
	thatbird.Delete()
	ObjectReference newbird = Self.PlaceAtNode("CritterPerch00", BirdBase, 1, True, False, False, True)
	Self.SetLinkedRef(newbird)	
EndEvent

Event OnWorkshopObjectDestroyed(ObjectReference akActionRef)
	ObjectReference thatbird = Self.GetLinkedRef()
	thatbird.Delete()
EndEvent

this is my code, its works fine.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...