Jump to content

[LE] Need dynamic Message buttons based on loaded plugins


Recommended Posts

The title sums it up. I have a teleport mod that includes the availability to teleport to some custom content locations.

I am using Message forms for the menu. However I would like for some of the buttons to only show if the appropriate plugin is loaded.

 

I know I can check for installed plugins with Game.IsPluginInstalled("plugin.esp"). Is this something that would be possible to do using Conditions in the Message form to only show menu items for installed plugins?

Link to comment
Share on other sites

As far I can tell, there's no function like IsPluginInstalled(), instead you can use GetModByName().

Check on game load, if the plugin is loaded and set a global variable accordingly. This script needs to be on a player alias.

GlobalVariable Property PluginA_Loaded auto

Event OnPlayerLoadGame()
	if Game.GetModByName("PluginA.esp") == 255
		PluginA_Loaded.SetValueInt(0)      ;plugin not loaded
	else
		PluginA_Loaded.SetValueInt(1)      ;plugin loaded
	endif
EndEvent

The global variable can be used for the condition on the message button with GetGlobalValue function.

Link to comment
Share on other sites

As far I can tell, there's no function like IsPluginInstalled(), instead you can use GetModByName().

 

Here is the reference page for the IsPluginInstalled() function:

 

https://www.creationkit.com/fallout4/index.php?title=IsPluginInstalled_-_Game

 

While the page is listed for Fallout 4, the following discussion on the topic for Skyrim says that while a CK page hasn't been made for it, the function has been available for a while now.

 

https://forums.nexusmods.com/index.php?/topic/7404191-getmodbyname-and-getmodname-and-esl-flagged-plugins/

 

That being said, I will try out your code tomorrow. Keep in mind, per the second link above that there are problems with the GetModByName function with ESL flagged plugins that will cause a crash so I will probably modify the code for IsPluginInstalled.

 

Since I haven't worked with Conditions on a Message form, what would be the best way to implement this code in relation to setting a condition on the appropriate menu entries so they don't show up if the plugin check returns false?

Edited by MoomanFL70
Link to comment
Share on other sites

Here is the reference page for the IsPluginInstalled() function:

 

https://www.creationkit.com/fallout4/index.php?title=IsPluginInstalled_-_Game

 

While the page is listed for Fallout 4, the following discussion on the topic for Skyrim says that while a CK page hasn't been made for it, the function has been available for a while now.

This is for Fallout. There's no IsPluginInstalled function in Game.psc from SKSE. If it has been added to another script, I may have missed it.

 

Also, this is the forum for classic Skyrim.

Link to comment
Share on other sites

 

 

While the page is listed for Fallout 4, the following discussion on the topic for Skyrim says that while a CK page hasn't been made for it, the function has been available for a while now.

 

https://forums.nexusmods.com/index.php?/topic/7404191-getmodbyname-and-getmodname-and-esl-flagged-plugins/

 

This is the main thing I hate about papyrus: ineffective documentation. They tossed that wiki out there, and left it to the wild, never to be thought of again. I mean if this is in there, and people had to discover it by trial and error, what else is out there that nobody knows about?

 

 

This is for Fallout. There's no IsPluginInstalled function in Game.psc from SKSE. If it has been added to another script, I may have missed it.

 

 

Now go back and read the rest of his post AFTER the link to the function.

Link to comment
Share on other sites

Actually Monsto, it seems he is correct. I looked in the Game.psc and it is indeed not in there for Oldrim. I failed to see that my second link was for Skyrim SE, so while it may be in there for SE it certainly isn't for LE. That was my bad. Chalk it up to my being new to the modding scene for Skyrim and there being several versions with some crossover between those versions and even some other games from the same company. It is easy to get things mixed up for a newbie.

 

My only real issue now (after getting GetModByName working) is figuring out the proper way to get Conditions set on my buttons to take advantage of the info from GetModByName.

Edited by MoomanFL70
Link to comment
Share on other sites

This is the main thing I hate about papyrus: ineffective documentation. They tossed that wiki out there, and left it to the wild, never to be thought of again. I mean if this is in there, and people had to discover it by trial and error, what else is out there that nobody knows about?

I believe the wiki is still the best documentation available. And to be fair, it's not the responsibility of the developers to add information about third party tools or functions. Everyone can add to the wiki, if they see things are missing. Very few do it, because it takes time and effort.

 

The mix of LE an SE documentation can be confusing indeed, it happened to me as well.

But now things and games are hopefully separated, let's go back to topic.

 

My only real issue now (after getting GetModByName working) is figuring out the proper way to get Conditions set on my buttons to take advantage of the info from GetModByName.

The condition for the button should look similar to that:

 

 

Link to comment
Share on other sites

The condition for the button should look similar to that:

 

attachicon.gif 1.jpg

 

 

Thank you very much. That worked nicely. These were the major road blocks to getting this thing to work the way I wanted it. The rest is just the tedious coding grunt work to get all the items I want added in. Incidentally the teleport system works off of a spell, so this has been really fun and touched on a few different areas. My previous, less sophisticated version worked off of a teleport pad using a custom model and custom textures so after this is done I can really start to have fun with something larger.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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