Jump to content

[LE] Help with making a new stat?


Recommended Posts

Hello, everyone. I'm really new to Papyrus, but am an experienced software developer - that said, I don't need anybody to hold my hand through what I'm about to ask, I just need a push in the right direction.

 

I'm hoping to make a mod that adds a new stat for the PC. I'd break what I want down like so:

 

  1. A number that changes over time, saves, and can be accessed elsewhere
  2. Adding new behavior to vanilla player actions, causing those actions to increase the stat.
  3. Causing certain vanilla items to increase in sell price based on the stat, and certain weapons to increase in attack power based on the stat
  4. Creating a power (similar to werewolf transformation) that becomes available to the PC after the stat reaches a certain value

It seems like this sort of mod isn't something a whole lot of people do, so I haven't been able to find any tutorials on it. If anyone can point me to the kinds of things I should generally be trying to emulate in making this mod, I would greatly appreciate it <3

 

Oh, and to clarify, I don't want to add a stat that contributes to player level or uses perk points. Think more along the lines of the "Become a Bard" mod's bard prestige level.

Edited by ctenochaetus
Link to comment
Share on other sites

For the "stat" you would be best to track it with a global value at least in my modest opinion, see creationkit.com for info on global. That way you'll be able to change and reference the current value from multiple scripts or quests as necessary.

 

You can even when crafting your "transformation" script to check in papyrus if your global is at an appropriate value, say => 100 as a condition so when it goes through the cycle it could reset and you have to build it back up to transform again.

 

You can control the duration of your transformation a variety of ways, but using an int property you can set a timer so to speak via a Utility.Wait(timerint) command before reverting, so that way you can bump up the duration to whatever you want.

 

For your third bullet point, you'll want to make possibly a series of ranks of a custom perk that have whatever modifier you want so 1.1x, 1.2x, etc. And then you could use your global to reference which perk the player gets.

 

As far as the second point, I'm not sure exactly what you have in mind, but you can build a quest that runs and checks for whatever you need to justify an increase or decrease to your global.

Link to comment
Share on other sites

Thanks for the response!

 

I think what I had in mind is that there are items associated with this stat, so crafting those items or dealing damage with the ones that are weapons will increase the stat, just as those items all become more effective when the stat is higher. A similar progression to the main stats in the game.

 

With globals, I'm not sure how this one should be initialized. Obviously, when the mod is installed or a new save is started, the stat should be 0 or 1 or whatever I set the starting value as, and the value shouldn't re-initialize every time a save is opened if the stat has been saved as something else. I can't find any reference to static casting in Papyrus or anything along those lines. Do we have an idea of how I can initialize and save a global in the way that I need?

 

But I think the rest has been very helpful, especially on the transformation and perks. Thanks!

Link to comment
Share on other sites

A GlobalVariable is a specific kind of form in the CK. The game has a bunch of them. You define it's starting value there and then you can modify it the functions listed here:

 

https://www.creationkit.com/index.php?title=GlobalVariable_Script

 

Variables in Skyrim, of this sort or ones in scripts, are retained in the savegame. They will have the same value after a game is loaded as they did when it was saved unless you code something specifically to re-initialize them. Script variables can either be initialized immediately (if they are global to a script and initialized as part of their declaration, something only possible with the primitives (int, bool, float, and string) and properties, or have to be initialized in some event in the script, typically the OnInit() event.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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