Jump to content

Selection Settlement Worksbench for the first time after quest.


Recommended Posts

Hi,

 

I would like to detect when the player select the settlement workbench (the first time) after completing the settlement ownership quest.

 

 

I'm not sure how to approach this one. Any ideas will be appreciated.

Edited by F4ll0uta
Link to comment
Share on other sites

The first time a red WorkShop is activated the script event OnActivate() will trigger, although you should check if the workshop is infact owned.




Self.RegisterForRemoteEvent(thisWorkshop, "OnActivate")

Event ObjectReference.OnActivate(ObjectReference akSender, ObjectReference akActivator)
If (akActivator == Game.GetPlayer()) && (akSender as WorkshopScript).OwnedByPlayer == True)
Self.UnRegisterForRemoteEvent(akSender, "OnActivate")
;do stuff
EndIIf
EndEvent


After the first activation it does not trigger OnActivate as the workshop enters building menu mode.




Self.RegisterForRemoteEvent(thisWorkshop, "OnWorkshopMode")

Event ObjectReference.OnWorkshopMode(ObjectReference akSender, bool aStart)
;stuff
EndEvent


Link to comment
Share on other sites

Yes you will need to register each individual object reference by iterating the registered workshop list:

 

 

 

 

While (pWorkshopParent.GetStage() < 20) ; not finished registering
   Utility.WaitmenuMode(5.0) 
EndWhile 

WorkshopScript[] WorkshopREFs = (pWorkshopParent as WorkshopParentScript).Workshops

Int iIndex = 0 
While (iIndex < WorkshopREFs.Length)
   ObjectReference thisWorkshop = WorkshopREFs[iIndex] as ObjectReference 
   Self.RegisterForRemoteEvent(thisWorkshop, "OnActivate")
   iIndex +=1 
EndWhile

Endif

Link to comment
Share on other sites

If your mod is loaded in a new game start the workshops may not have registered with WorkshopParentScript which can take up to TWO MINUTES from the initial mirror scene looks menu to complete. Not many mod authors consider or understand the new game start conditons which is why so much stuff doesnt actually work or inventory items are missing.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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