Jump to content

Need help with scripting (Activator inventory title)


Recommended Posts

Hi all,

i wanna change the inventory title on the top of a Activator(like when you open a container inventory),

to be clear not the title of the activator itself.

The problem is that the Activator is linked to a settlement Workshop

so i can only change it if i change the title of the Workshop but don't want change that.

So here is the script i using:

Scriptname DCF_SupplyCrateFactory extends ObjectReference

ObjectReference Property MasterContainer Auto

auto STATE closedPosition
	EVENT onActivate(objectReference triggerRef)
 		gotoState("busy")
		
		; Wait for the open animation to complete.
		Utility.wait(0.1)
		
		; Activate the Master Container.
		MasterContainer.Activate(akActivator = Game.GetPlayer(), abDefaultProcessingOnly = True)

		; Wait till the Inventory Menu closes. The wait function pauses when the game is in menu mode.
		Utility.wait(0.1)
		
		; Set the container as opened and re-activate it to end the animation.
		gotoState("openedPosition")
		Self.activate(Game.getPlayer())
	endEVENT
endSTATE

STATE busy
	EVENT onActivate(objectReference triggerRef)
		; Do Nothing.
	endEVENT
endSTATE

STATE openedPosition
	EVENT onActivate(objectReference triggerRef)
		; Perform the closing container animation and sound.
		gotoState("busy")
		Utility.wait(0.01)
		gotoState("closedPosition")
	endEVENT
endSTATE

What line should i put and where?

hope i explained well if not i have here 2 images for more clarity:

1. help01.jpg 2. help02.jpg

Edited by H3S
Link to comment
Share on other sites

For my global workshop storage mod I could not find a way to over-ride the remote activator/workbench/container name connected to a Workshop with WorkshopItemKeyword, so a klunky out of the box (or container) approach was:

 

Replace the activator with a container which will show its own inventory name.
OnActivate() RemoveAllItems() from the local workshop to the container.
Disable() to kick the player from the menu, Enable() , Activate(), RegisterForMenuOpenCloseEvent("ContainerMenu")
OnMenuOpenCloseEvent(ContainerMenu, abOpening = False) RemoveAllItems() back to the workshop.

 

This is a concept, not a compilable script. F4SE may have some smoother options, but I don't use that.

Link to comment
Share on other sites

Thnx for your reply,

I don't realy know mutch about scripting where should i put that lines?

And i forget to say that the Activator is a craftable object in workshopmode and about replacing the Activator with a container,

I start it with that in the first place but was imposible to link it to the workshop cos the workshop has his own container. So would be nice if i can do it without replacing the Activatpe,some simple script line that i can put inside my script.. Thnx again for your time.

Link to comment
Share on other sites

Apologies that solution is rather horribly complex in its scripting, so probably not that useful.

 

Here is another concept that may be easier to use quest alias name replacement (not tried it myself but worth a go):

Scriptname DCF_SupplyCrateFactory extends ObjectReference

ObjectReference Property pDCF_WorkshopWorkbench Auto Const Mandatory 
ReferenceAlias Property Alias_Workshop Auto Const Mandatory

Event OnActivate()
  Debug.Trace("DCF_SupplyCrateFactory.OnActivate " + Self) 
  Alias_Workshop.ForceRefTo(pDCF_WorkshopWorkbench)
  RegisterForMenuOpenCloseEvent("ContainerMenu")
  pDCF_WorkshopWorkbench.Activate() 
EndEvent

Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)
   if (asMenuName== "ContainerMenu") && (abOpening == FALSE)
      UnregisterForAllEvents
      Alias_Workshop.Clear()
      Debug.Trace("DCF_SupplyCrateFactory.OnMenuOpenCloseEvent " + Self)
EndIf

endEvent

Link to comment
Share on other sites

Apologies that solution is rather horribly complex in its scripting, so probably not that useful.

 

Here is another concept that may be easier to use quest alias name replacement (not tried it myself but worth a go):

Scriptname DCF_SupplyCrateFactory extends ObjectReference

ObjectReference Property pDCF_WorkshopWorkbench Auto Const Mandatory 
ReferenceAlias Property Alias_Workshop Auto Const Mandatory

Event OnActivate()
  Debug.Trace("DCF_SupplyCrateFactory.OnActivate " + Self) 
  Alias_Workshop.ForceRefTo(pDCF_WorkshopWorkbench)
  RegisterForMenuOpenCloseEvent("ContainerMenu")
  pDCF_WorkshopWorkbench.Activate() 
EndEvent

Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)
   if (asMenuName== "ContainerMenu") && (abOpening == FALSE)
      UnregisterForAllEvents
      Alias_Workshop.Clear()
      Debug.Trace("DCF_SupplyCrateFactory.OnMenuOpenCloseEvent " + Self)
EndIf

endEvent

i replaced my script with this one but get some errors and my craftable object is not working anymore:

 

Papyrus Compiler Version 2.8.0.4 for Fallout 4

Copyright © ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "DCF_SupplyCrateFactory"...
C:\Users\H3S\AppData\Local\Temp\PapyrusTemp\DCF_SupplyCrateFactory.psc(10,25): argument akactivator is not specified and has no default value
C:\Users\H3S\AppData\Local\Temp\PapyrusTemp\DCF_SupplyCrateFactory.psc(6,0): the parameter types of function onactivate in the empty state on script dcf_supplycratefactory do not match the original script objectreference
C:\Users\H3S\AppData\Local\Temp\PapyrusTemp\DCF_SupplyCrateFactory.psc(15,6): variable UnregisterForAllEvents is undefined
No output generated for DCF_SupplyCrateFactory, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on DCF_SupplyCrateFactory

did i do something wrong ? :sad:

Maybe ill try one more time if you know why it didn't work.

If not ill give up. But still I appreciate it a lot that you take your time to help me out. :thumbsup:

Edited by H3S
Link to comment
Share on other sites

Hey I'm sharing concepts not ready to cut 'n paste scripts as I tend to hand out fishing rods not fish. The compile errors are simple to lookup and fix in the creationkit documentation ...

 

https://www.creationkit.com/fallout4/index.php?title=Activate_-_ObjectReference

 

https://www.creationkit.com/fallout4/index.php?title=OnActivate_-_ObjectReference

 

https://www.creationkit.com/fallout4/index.php?title=UnregisterForAllEvents_-_ScriptObject

Link to comment
Share on other sites

Hey I'm sharing concepts not ready to cut 'n paste scripts as I tend to hand out fishing rods not fish. The compile errors are simple to lookup and fix in the creationkit documentation ...

 

https://www.creationkit.com/fallout4/index.php?title=Activate_-_ObjectReference

 

https://www.creationkit.com/fallout4/index.php?title=OnActivate_-_ObjectReference

 

https://www.creationkit.com/fallout4/index.php?title=UnregisterForAllEvents_-_ScriptObject

Ok thnx all check if i can find something on the links you gave me .

Link to comment
Share on other sites

  • Recently Browsing   0 members

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