Jump to content

How To Add A Custom Workshop Menu?


Recommended Posts

So I have had a good look around the forums, but haven't found any clear information on this.

So Simply put do you know how to add a custom workshop menu?

 

Preferably with the Creation Kit.

Unless Bethesda did there normal trick and did not think anyone would want to do that, and made it impossible to do with the software like they have done with most things! :laugh:

 

I found some FO4Edit tutorials, but most end up with you trying to guess what you have to do next and are missing hole sections.

Or assume you know what you're doing and don't give a very good explanation of what you are meant to do.

 

If you know how then please let us know! :thumbsup:

Link to comment
Share on other sites

 

 

Seen that, was a bit help full, but not a lot.

 

 

LOL. :wallbash:

 

I'm not saying that does not work. :happy:

 

But it doesn't explain anything! :pinch:

 

I have been Looking through its setup and code to backwards engineer it.

So I am doing ok.

 

But as a explanation it's like finding your ikea table assembly instructions are in chinese?

如果你明白 ok, but it is confusing to others.

Link to comment
Share on other sites

Basically, you have 2 approaches.

  • Making a single tier menu (no sub-menus) which requires only a recipe-filter keyword.
  • Making a multiple tier menu (and custom menu icon). This requires a FormList, and at least 2 recipe-filter keywords. (more keywords and formlists for sub-menus)

 

For a single menu you make a new keyword and set the type to 'recipe-filter', and write your mod menu name.

To add object to it you just put the keyword in the Recipe-Filter keywords in you Constructable Objects for your objects.

 

For a menu with submenus/custom icon. You make a Formlist and add the first recipe-filter keyword to it at the top with it's name (to this you also link any art-object icon). Then you add the second keyword (or a new formlist) which will become the sub-menu. Just link the constructable objects with these recipe-filter keywords instead for them to appear in their respective menus.

 

 

To add it to the game you'll have to make a Quest to run when the game is first loaded (default values: Start-Game enabled, and Run Once).

To it you add the following script, and pass in your keyword/formlist, and the main-menu formlist.

Scriptname <ModName>_Init extends Quest

FormList Property WorkshopMenuMain Auto Const
; Single menu keyword
Keyword Property <ModName_MenuRecipeFilterKeyword> Auto Const
; Menu with sub-menus/custom icon formlist
Formlist Property <ModName_MenuFormlist> Auto Const

Event OnQuestInit()
	WorkshopMenuMain.AddForm(Keyword or Formlist) ; which ever you wish to use
	Stop() ; No use having the quest running anymore
EndEvent

I hope that's sufficient with information to get you going with it. You should really add a Magic Effect on the actor with the event OnPlayerLoadGame() and check if your mod is still enabled, if not: call Revert(Your keyword or Formlist) to remove it from the menu. Or just implement a "uninstall" holotape or chem. But that's a different story for another time.

Link to comment
Share on other sites

Basically, you have 2 approaches.

  • Making a single tier menu (no sub-menus) which requires only a recipe-filter keyword.
  • Making a multiple tier menu (and custom menu icon). This requires a FormList, and at least 2 recipe-filter keywords. (more keywords and formlists for sub-menus)

 

For a single menu you make a new keyword and set the type to 'recipe-filter', and write your mod menu name.

To add object to it you just put the keyword in the Recipe-Filter keywords in you Constructable Objects for your objects.

 

For a menu with submenus/custom icon. You make a Formlist and add the first recipe-filter keyword to it at the top with it's name (to this you also link any art-object icon). Then you add the second keyword (or a new formlist) which will become the sub-menu. Just link the constructable objects with these recipe-filter keywords instead for them to appear in their respective menus.

 

 

To add it to the game you'll have to make a Quest to run when the game is first loaded (default values: Start-Game enabled, and Run Once).

To it you add the following script, and pass in your keyword/formlist, and the main-menu formlist.

Scriptname <ModName>_Init extends Quest

FormList Property WorkshopMenuMain Auto Const
; Single menu keyword
Keyword Property <ModName_MenuRecipeFilterKeyword> Auto Const
; Menu with sub-menus/custom icon formlist
Formlist Property <ModName_MenuFormlist> Auto Const

Event OnQuestInit()
	WorkshopMenuMain.AddForm(Keyword or Formlist) ; which ever you wish to use
	Stop() ; No use having the quest running anymore
EndEvent

I hope that's sufficient with information to get you going with it. You should really add a Magic Effect on the actor with the event OnPlayerLoadGame() and check if your mod is still enabled, if not: call Revert(Your keyword or Formlist) to remove it from the menu. Or just implement a "uninstall" holotape or chem. But that's a different story for another time.

 

And there it is, a clear answer! :thumbsup:

 

I will need to test this, but it looks like I was on the right road. :D

 

But the mane point of this page was not just to help me, but to make something others can find to help them!

 

Have this as a reward, and as a representation of what you are

https://www.youtube.com/watch?v=2DaY8-Mui0I

 

:dance: :dance: :dance:

Link to comment
Share on other sites

You need to add your custom menus every time the game loads, otherwise you will get into strife if another mod were to call Revert() on the vanilla FormLists (e.g. when another mod with scripted menus is uninstalled), inadvertently erasing your own added menus in the process..

Scriptname <ModName>_Init extends Quest

FormList Property WorkshopMenuMain Auto Const
; Single menu keyword
Keyword Property <ModName_MenuRecipeFilterKeyword> Auto Const
; Menu with sub-menus/custom icon formlist
Formlist Property <ModName_MenuFormlist> Auto Const

Event OnQuestInit()
	RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
	install()
EndEvent

Event Actor.OnPlayerLoadGame(Actor actorref)
	Install()
EndEvent

Event Install()
	WorkshopMenuMain.AddForm(Keyword or Formlist) ; which ever you wish to use
EndEvent

Function uninstall()
{Call this uninstall function using your uninstall chem, holotape etc}
	WorkshopMenuMain.RemoveAddedForm(Keyword or Formlist) ; which ever chose to used
EndFunction
Link to comment
Share on other sites

 

You need to add your custom menus every time the game loads, otherwise you will get into strife if another mod were to call Revert() on the vanilla FormLists (e.g. when another mod with scripted menus is uninstalled), inadvertently erasing your own added menus in the process..

Scriptname <ModName>_Init extends Quest

FormList Property WorkshopMenuMain Auto Const
; Single menu keyword
Keyword Property <ModName_MenuRecipeFilterKeyword> Auto Const
; Menu with sub-menus/custom icon formlist
Formlist Property <ModName_MenuFormlist> Auto Const

Event OnQuestInit()
	RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
	install()
EndEvent

Event Actor.OnPlayerLoadGame(Actor actorref)
	Install()
EndEvent

Event Install()
	WorkshopMenuMain.AddForm(Keyword or Formlist) ; which ever you wish to use
EndEvent

Function uninstall()
{Call this uninstall function using your uninstall chem, holotape etc}
	WorkshopMenuMain.RemoveAddedForm(Keyword or Formlist) ; which ever chose to used
EndFunction

You are correct in the Revert() case, and I mentioned this under my post.

 

Though your code will work, it's not a good way to do due to leaving the script in the save game and not giving it a way to exit. And if the mod user ever deactivates the mod (even if they use the uninstall) the code will be there and continue to fail each time the player loads the game (and enabling the mod again won't remedy this). Just adding Stop() at the end of the uninstall() function should remedy this if the user were to use the function (and that's a big if).

 

The proper way to do it would be to make a Magic effect and attach a script with the event and have it call your function. To deliver it, you have to create a Magic Effect (the one with the script), a Spell (in the form of an ability) and a Perk (to add to the player) in the CK. The perk adds the ability spell, which applies the magic effect, upon which the script and thereby function is run.

The script should check to see if your mod is installed first (using IsPluginInstalled) and if it's not, Dispel itself and RemovePerk; otherwise just run your code (which I find is easiest done by starting another quest will all your scripts etc.) The Init quest should just add the perk to the actor and start the "DoerQuest" and then stop itself (as should the "DoerQuest").

 

With that method you don't have any saved stuff in-game even if the mod user decides to disable/remove the mod without running the Uninstall (which most users will).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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