Jump to content

Fusion Generators that drain your Fusion cores


Recommended Posts

Reference this post for more information:https://forums.nexusmods.com/index.php?/topic/6514711-fusion-generators-that-drain-your-fusion-cores/

 

 

It appears that I might have to take a crack at this myself. It will be my first mod for Fallout 4. Would anyone be willing to help guide me through making a mod that adds the ability to insert/remove a fusion core from a fusion reactor just like you do in power armor? It would then drain the fusion core when it is running over a configurable amount of time. Or dynamically based on how much power it uses, but I figured that over a static amount of time will be much easier for now.

 

Future plans: make a location that is in the glowing sea that was a fusion core manufacturing plant with a small quest that allows you to fire up the old assembly line to refill empty fusion cores. Then possibly the ability to find plans to make a "makeshift" version of the recharger at your settlement that recharges them much slower than the one in the manufacturing plant (again the rate being configurable).

 

Any discussion on how high level or "difficult" this mod would be to make?

 

how do I start?

 

I already have the creation kit but basically other than just poking around in it and reading some tutorials/youtube's I have no idea how to get going on this type of mod.

 

Thanks in advance.

 

Link to comment
Share on other sites

This really seems like quite a bit to take on for a first mod. I feel like you might want to start with making smaller mods and tweaks and learning everything you can about the Creation Kit and scripting.

 

 

What is a Base Object?

What is an Object Reference?

Papyrus primer from creation kit wiki

Cipscis scripting beginner guide

A demonstration of "attaching" a script to a Base Object

 

Explore the Creation Kit and google/youtube things you see in the CK that don't seem obvious based on their name alone. You will be reading and rereading the wiki constantly.The advice and ideas in the thread you linked were as good as I think anyone can do short of making the whole mod for you which probably isn't going to happen. But if I were in your shoes and had THE HUNGER I probably wouldn't listen to me either so these would probably be things I would try (and possibly fail):

 

Check out DLC02WorkshopGeneratorFusion in the Creation Kit, this is the the item that is actually made when you make a fusion generator. There are "actor values" on it, one of which is "100 power generated".

 

Actor values can be manipulated with scripts. I don't know if this is true for workshop items but it would be the approach I would try:

 

 

Try to get comfortable using the asterisk to find things; in the Creation Kit filter on the Object window I just typed gener*fusion which looked for anything with "gener" in it as well as "fusion." I had no idea if that would work but it did.

 

 

You can edit the vanilla generator directly since you probably won't be downloading any other mods that use it but it's generally considered bad form to edit vanilla items when an alternative is possible, to keep mods as conflict free as possible. Instead of editing the vanilla I would make a copy of DLC02WorkshopGeneratorFusion and rename it whatever you like. Set it's Power Generated actor value to 0. Or 1. I don't know if the game will let you use 0, modding is a lot of trial and error but give it a shot

 

Make a copy of the constructible object workshop_co_GeneratorFusion (I just found it using the same filter) that is used to create DLC02WorkshopGeneratorFusion and rename it whatever you like and have it create your copied generator instead of the old generator. Constructible objects are pretty much just recipes and are used to make weapon attachments, armor attachments, chems, workshop items, pretty much anything the player can make.

Constructible objects

 

Now this is where it unfortunately goes from instructions to general guidance.

 

My approach at this point would be a lot like what others said. I would add a new script onto the new Fusion generator with an OnActivate event.

 

The OnActivate event would look at the player's inventory and see if they have at least 1 fusion core. If player has at least 1 fusion core, script will then remove one fusion core and set the power generated actor value on the generator to 100 and start a timer. When the timer runs out the script will set the power generated actor value on the generator to 0 or 1 or whatever.

Actor value script functions

Count the items someone has

Remove item from someone

Starting a real time timer

Starting a game time timer

(Which timer to use? Advantages to each. Real timer is not messed up when people use custom timescales. Game timers are affected by sleeping and fast travel.)

 

 

That would be a basic basic basic basic prototype. With a lot of problems. There are lots of ways to approach the problems but this would be my initial rough draft:

 

1. I'm pretty sure the generator is going to start with the lit up "on" animation when you make it and so will be appear off when it's on etc

2. If we activate it again it will just take another fusion core rather than giving one back.

 

For personal use obviously you can skip a lot of the problem fixing and just not exploit the oversights.

 

1. You can try to use "states" and an Activate() function to switch it off real quick with an On Initiation event (OnInit) when it's first made. Or you could change the actor value in the creation kit back to 100 instead of starting at 0 or 1, and then in the constructible item make it cost an extra bunch of nuclear material or whatever amount of components you think balances this 100 power head-start. I don't remember if you can use a non component item like a fusion core in a recipe but give it a shot if you want.

Cipscis guide that explains what states are

 

2. You can use different "states" when the generator is activated/not activated or set a "property" 0 or 1 to tell us if it's activated or not and link these to some sort of logic or "if statements." You can check if it's already activated and if so, give the player back their fusion core, set the actor value to 0, and cancel the timer.

 

Cipscis guide that touches on what exactly is a property and how do I use it?

If statements in the wiki

Add item to someone

Activate function

Canceling timers

 

3. Now we have another problem made by fixing problem 1, the timer has not started when you placed the generator. Maybe just use OnInit() event to call the timer when it's first created.

 

4.) We have another problem made by fixing 2. The player could just activate the generator near the end of the timer and get a free fresh fusion core. I don't know how you could set the health of the core that the player gets but it doesn't seem like something that can be done with scripting.

 

4.) Awesome idea from you in the other thread was to use a new ammo type. Instead of fusion cores the generator could require 100 of your new ammo type (or whatever number). And whenever you turn off the generator it could return an amount proportional to the remaining timer. Your new ammo type could have a constructible object recipe in the chem bench where 100 new ammo requires 1 fusion core (again I can't remember if you can use non-components like fusion cores as recipe ingredients) and a reverse recipe with 100 new ammo to a new fusion core. As far as making the time configurable like you said, you could add a menu that asks for how many of the new ammo to take in.

Making an options menu in the wiki

 

5.) More problems what if I store the item and put it back down, it might start with a fresh timer from the OnInit() event (I'm actually not sure) and I can get 100 ammo from it. Maybe try storing the value of the timer or ammo on another script property like an array attached to a quest every so often so if the information is lost when a generator is put in workshop storage, it'll be stored safely on a quest instead. Testing if events or functions occur can be checked with different debug messages and functions and "papyrus logs." I'm a fan of debug.messagebox("your message here") for a lot of testing to see when an event or function has occured

Arrays

Looking at or changing things on one script from another script (fusion generator script communicating with quest script holding an array property)

Debug functions

Debug logging

 

6.) I'm sure there are more problems but I think that's plenty for a start

 

Just keep learning stuff and most importantly keep having fun and I'm sure you'll be able to pull off this mod eventually!

Edited by shatsnazzle
Link to comment
Share on other sites

4.) We have another problem made by fixing 2. The player could just activate the generator near the end of the timer and get a free fresh fusion core. I don't know how you could set the health of the core that the player gets but it doesn't seem like something that can be done with scripting.

 

As long as you can get the ObjectReference of the Core, you can always remove it and replace it with a lesser-charged one. That can be done by spawning a new core from a leveled list, giving it a new itemhealth% in the process. I have no clue how that would affect other scripts but it should result in a very short interrupt of power output, so that's a thing to watch out for with this approach. I think I'd want to check for that as soon as the generator is unloaded, e.g. you leave the uGrids around it. That way you could leave the core removable but still drain it over time. Immersion++, right?

Link to comment
Share on other sites

OK, sorry for the double post if anyone saw... LOL. I have been super busy at work and unable to check back each day as usual.

 

Gotta say,

 

This does not seem to super complicated, but for sure is going to suck up a TON of time for a newb as myself.

 

I do think it is totally fine to just create a new ammo type and use that for generator. AND YOU came up with a super great idea that you could just convert it back and forth via the chem bench. Honestly something dubbed like "fusion material" or FM would do the trick and yea just make 1 fusion core make like 100 FM... walla. But that would mean that once you use up your fusion core to make FM then it's GONE, never to be refilled. But maybe that's a good thing... maybe that makes it EVEN HARDER to manage power. However, a major hole in that idea is that it would mean you could not have figured out how to use a fusion core as a "battery" like the PA does and it seems like a simply smart dude could easily "copy" what a PA frame does into a home build generator. So why would he break down FC's to FM for a generator if he can just copy a PA frame? OH, CUZ COPYING A PA FRAME WOULD mean it's efficiency or "drain rate" would be tailored to that of a PA frame and that would simply waste fusion cores very very fast... so again, Im liking this whole new ammo idea. then you would never have to place anything back in your inventory as well. Simply FM generator would be able to be "filled up" with FM in the exact same way that the "generators need fuel" mod does with biogas.

 

OK, so I dont know the rules about modding... can i simply just copy that "generators need fuel" mod and change it to include a fusion generator for my game? but then of course not upload as my work, or even upload it as a mod at all...? really, i have no idea whats politically correct in this world.

 

If so, do you have any suggestions on how you can guide me through just modifying his mod to fit my liking?

 

i think it would go something like this:

 

find the large generator in his mod. copy it and rename it "fusion material generator" (FMG)

find his bio gas ammo type in his mod. copy it and rename it "fusion material" (FM)

 

change the texture of the FMG to the same as the vanilla fusion generator.

change the texture of the FM to the same as a vanilla nuke material.

 

now i need to get the FMG to draw FM from inventory when you press (fill generator) from the options list rather than bio gas. <<< struggling with how to find how this is accomplished in his mod,,, once i do, then i believe i could muster my way through changing the values to match the new needs. Is this done through assigning the bio gas in a script and such? meaning changing and ENTIRE scripts words of anything that says "biogas" to "fuisionmaterial" (do i kinda have this right?)

 

now i need to set change the crafting requirements in the chem station from biomass stuff (or whatever it takes) to 1 fusion core instead. but also set it to make 100 FM or so.<< again no clue on this... but if pointed in the right direction i could probably dink with it enough to get it to work right... maybe?

 

now i need to get the timer to work properly for example: 100 FM is equal to 100 in game timer hours. <<< his mod must have something like this already set up as well because the generators run out of biogas over time... so I assuming again that I could just blanket change the scripts to my new ammo type and change the "rate" of time or what ever the units each equal.

 

I dont even care about the storing and re dropping thing... I would just not do that, then that would avoid it all together... if i had to store the FMG and then build it again, I would just take 100 FM and throw it away to compensate in the rare occasion of that happening.

 

 

Honestly, after typing all this, it still seems like that if someone more experienced would download: https://www.nexusmods.com/fallout4/mods/14193 ,,,, they could simply duplicate the mod but instead of vanilla generators needing new ammo type "biomass canisters" that are crafted in chem station by collecting "bio-gas" from a workshop construct able item "biomass container" that you put food items in (that make biomass over time). Also FYI, the vanilla "gas canister" item is also a form a fuel equal or close to the "biomass canister".

 

it would be:

 

vanilla fusion generator (could be renamed to "nuclear fusion reactor") needing new ammo type "fusion material" that are crafted in chem station by collecting "fusion matter" (or some other name) from a workshop construct able item "fusion splitter" that you put fusion core into (that breaks down the fusion core charge in materials over time) . Hell we could even duplicate the FYI above to make it so the "nuclear material" item is also a form of fuel equal or close to the "fusion material"

 

 

or even easier:

 

vanilla fusion generator needing new ammo type "fusion material" that are crafted in chem station by turning one fusion core into 100 FM.

 

 

either way, tweek the "tank full" number on the generator, and the timing of how long it lasts... because we would want it to last a bit longer that the large generator does in his mod (but it also would produce 100 power while on rather than just 10 like the large gen).

 

THANKS AGAIN FOR ALL THE HELP!

Link to comment
Share on other sites

Without going into further detail, what you describe sounds needlessly complicated for questionable results.

 

To reiterate my suggestion:

 

* Create a copy of the Fusion Gen, attach an invisible container to it, one that only accepts FCs to be put into. This is where our script will work inside.

 

* Attach a script to the Fusion Gen that does these things:

 

* Get the ObjectReference to the core sitting in the container

 

* If suitable core found: Enable a dummy FC that sits in the generator slot to indicate the generator being operational

 

* Regulate Power output depending on FC charge > 0

 

* On Cell load: Check for when this check ran the last time, then multiply the difference by some charge% to lose over a day (hour/minute, whatever). Remove the current core and generate a new core with the appropriate itemhealth% through a leveled list

 

* Run the "operational" check again and decide if the charge is still enough to keep the generator running

 

This wouldn't update while you're traveling, so your settlement would still have power with an empty core, as long as you don't revisit the settlement. It should be easier to implement and keep compatible though.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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