pepperman35 Posted November 16, 2020 Share Posted November 16, 2020 After a rather long hiatus, I have decided to come back to FO4 modding for the purpose of finishing my Spectacle Island Institute mod. Sadly, what little progress I had made learning scripting seems to have disappeared from my memory banks. Here’s what I’d like to be able to do: 1. When a player or NPC enters a certain trigger box a door will open if and only if the workshop is owned by the player. If the workshop is NOT owned by player, then a message will be echoed out informing the player they need to acquire the workshop before they can gain access. As mentioned this is for Spectacle Island. 2. When a player or NPC leaves the trigger box the door will close. Seems simple enough, right? I can get the door to open and close but unfortunately, I can’t figure out the conditional part of the requirement. Scriptname SpecIslandInstReborn:AOCDTriggerOnCondition extends ObjectReference Const {A trigger that watches for a target to enter and exit the trigger volume and opens and closes the door if the workshop is owned by player} Group Required_Properties ObjectReference property myDoor01 auto const mandatory {The door that we want to open/close when entering/exiting the trigger.} Message Property OwnershipChallengeMessage Auto Const Mandatory EndGroup Event OnTriggerEnter(ObjectReference akActionRef) ; Get the workshop reference for Spectacle Island ; Test to see if the workshop is owned by the player ; Conditional IF ; IF workshop on Spectacle Island is owned by the player then ; open the door myDoor01.SetOpen(True) ElseIf ;inform the player they need to own the workshop in order to enter OwnershipChallengeMessage.show() EndIf EndEvent Event OnTriggerLeave(ObjectReference akActionRef) ; close the door myDoor01.SetOpen(False) EndEvent I would assume I need to link the trigger box to the Spectacle Island workshop and then use a function or two thereafter. From SKK50's response to another thread I saw what appears to be the solution; however, my attempts to implement it was unsuccessful. - ObjectReference WorkshopREF = Self.GetLinkedRef(pWorkshopItemKeyword) - If ((WorkshopREF as WorkshopScript).OwnedByPlayer == FALSE) I couldn't decipher the *Self." Sad, I know. Link to comment Share on other sites More sharing options...
pepperman35 Posted November 16, 2020 Author Share Posted November 16, 2020 As I said I forgot a lot, including how to read the error reports. I am happy to report the following script seems to work. Scriptname SpecIslandInstReborn:AOCDTriggerOnCondition extends ObjectReference Const Group Required_PropertiesObjectReference Property myDoor01 Auto Const MandatoryQuest Property pWorkshopParent Auto Const MandatoryKeyword Property pWorkshopItemKeyword Auto Const MandatoryMessage Property OwnershipChallengeMessage Auto Const MandatoryEndGroup Event OnTriggerEnter(ObjectReference akActionRef)ObjectReference WorkshopREF = self.GetLinkedRef(pWorkshopItemKeyword); Check to see if workshop is owned by player If ((WorkshopREF as WorkshopScript).OwnedByPlayer == TRUE) ; open the door myDoor01.SetOpen(True) Else ;inform the player they need to own the workshop in order to enter OwnershipChallengeMessage.show() EndIfEndEvent Event OnTriggerLeave(ObjectReference akActionRef) ; close the door myDoor01.SetOpen(False)EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts