Jump to content

Custom workshop require quest before being available


mikvat

Recommended Posts

 

1. Create a quest: MyMod_HandlerQuest. In the Quest Data tab, check the checkboxes of: Start Game Enabled and Run Once. Quest Prority: 0.
2. Open the Scripts tab >> Add >> New Script. Name: HandlerScript. Namespace: MyMod_Scripts.
Paste this code:
Scriptname MyMod_Scripts:HandlerScript extends Quest Const

Quest Property DLC04DryRockGulch Auto Const
{High Noon at the Gulch.}
ObjectReference Property MyWorkshopWorkbenchRef Auto Const
{Object Reference of your Workshop Workbench.}


Event OnQuestInit()
	If !DLC04DryRockGulch.GetStageDone(2000)      ;2000: completion stage.
		RegisterForRemoteEvent(DLC04DryRockGulch, "OnStageSet")
	Else
		Initialize()
	EndIf
EndEvent


Event Quest.OnStageSet(Quest akSender, int auiStageID, int auiItemID)
	If (akSender == DLC04DryRockGulch) && (auiStageID == 2000)
		UnRegisterForRemoteEvent(DLC04DryRockGulch, "OnStageSet")
		Initialize()
	EndIf
EndEvent


Function Initialize()
	MyWorkshopWorkbenchRef.SetOwnedByPlayer(true)
	(Self as Quest).Stop()
EndFunction

3. Fill the Script properties.

4. Load your settlement, right click on your workbench (the property MyWorkshopWorkbenchRef should point to this). Scripts tab >> EnableAutomaticPlayerOwnership: set to False.

 

Hi!

 

Finally I had time to try this but I can´t get it to work. When I have filled in the properties I get this error message:

The parent script doesn´t exist, please choose one that does

 

I guess I am doing something wrong. Can anybody help me out?

Link to comment
Share on other sites

I'd do it the dummy way:

Copy the SetownedTriggerScript and alter it a little bit

Quest Property DryRockGulchQuest Auto

Event OnTriggerEnter(ObjectReference akActionRef)
If DryRockGulchQuest.iscomplete()
	if akActionRef == Game.GetPlayer()
		WorkshopScript myWorkshop = GetLinkedRef() as WorkshopScript
		if myWorkshop
			myWorkshop.SetOwnedByPlayer(true)
			Delete()
		endif
	endif
Endif
EndEvent


 

Link to comment
Share on other sites

 

 

1. Create a quest: MyMod_HandlerQuest. In the Quest Data tab, check the checkboxes of: Start Game Enabled and Run Once. Quest Prority: 0.
2. Open the Scripts tab >> Add >> New Script. Name: HandlerScript. Namespace: MyMod_Scripts.
Paste this code:
Scriptname MyMod_Scripts:HandlerScript extends Quest Const

Quest Property DLC04DryRockGulch Auto Const
{High Noon at the Gulch.}
ObjectReference Property MyWorkshopWorkbenchRef Auto Const
{Object Reference of your Workshop Workbench.}


Event OnQuestInit()
	If !DLC04DryRockGulch.GetStageDone(2000)      ;2000: completion stage.
		RegisterForRemoteEvent(DLC04DryRockGulch, "OnStageSet")
	Else
		Initialize()
	EndIf
EndEvent


Event Quest.OnStageSet(Quest akSender, int auiStageID, int auiItemID)
	If (akSender == DLC04DryRockGulch) && (auiStageID == 2000)
		UnRegisterForRemoteEvent(DLC04DryRockGulch, "OnStageSet")
		Initialize()
	EndIf
EndEvent


Function Initialize()
	MyWorkshopWorkbenchRef.SetOwnedByPlayer(true)
	(Self as Quest).Stop()
EndFunction

3. Fill the Script properties.

4. Load your settlement, right click on your workbench (the property MyWorkshopWorkbenchRef should point to this). Scripts tab >> EnableAutomaticPlayerOwnership: set to False.

 

Hi!

 

Finally I had time to try this but I can´t get it to work. When I have filled in the properties I get this error message:

The parent script doesn´t exist, please choose one that does

 

I guess I am doing something wrong. Can anybody help me out?

 

 

Sorry.. Replace this line:

MyWorkshopWorkbenchRef.SetOwnedByPlayer(true)

with this:

(MyWorkshopWorkbenchRef as WorkshopScript).SetOwnedByPlayer(true)
Link to comment
Share on other sites

  • Recently Browsing   0 members

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