Jump to content

Using global variables to toggle scrap output


Recommended Posts

Hi guys,

 

I've been working on adding some functionality to a little scrapping mod that I've built.

 

I want to make it so that the user can use a holotape to choose what scrap they get from scrapping certain objects, if any.

 

I figured I could create a number of scrap recipes and add a match condition to the global variable and then just have a holotape set the global variable.

 

I've done that and the holotape sets the global variable just fine, the problem is that no matter what the variable is, the scrap output doesn't change. It's like the match condition isn't actually working.

 

Here's some screenshots of what I've got...

 

Global variable:

http://prntscr.com/epkjhz

 

Examples of the terminal script

http://prntscr.com/epkjxa

http://prntscr.com/epkk6g

 

The scrap recipes:

http://prntscr.com/epkla3

http://prntscr.com/epklhw

http://prntscr.com/epklvv

http://prntscr.com/epkloi

 

Can anyone figure out what's going on?

Link to comment
Share on other sites

Did some testing, seems the game ignores that conditional for scrapping purposes. I'm starting to think it ignores all ( or at least most) conditionals when determining scrap yields.

 

I got that conditional to work fine for determining if I could craft something or not, but it ignores it completely when it comes to scrapping. I made a test mod (with a test global, set with the console) with 2 different recipes for the same thing, one with a =0 comparison value and one with a >0 value. I changed the crafting reqs between them so I could know whether or not it was changing the COBJ. Changing the global made it change between the recipes when I was crafting it, but the scrap yield was determined by the last one to load (later FormID).

 

This was after I tried a number of different conditional settings, started wondering if the game used that conditional for COBJs at all, searched the COBJs* and found some that did, eventually found what I said above: it works for crafting, but not for scrapping.

 

One thing I did find was that if the first recipe had the "Scrap" keyword as its FNAM value it was used for determining the scrap yield instead of the last recipe. So if you can figure out a script that will add/remove the value for the FNAM field using your Quest that should let you accomplish what you want.

 

Alternatively, you could make your recipes use a group of FLSTs that are blank by default. Then use your terminal script to add your object (whether an FLST or a base record) to the relevant blank formlist, turning that recipe into a recipe for that/those object(s). And make sure that when you add it to one formlist you remove it from the others.

 

I think you would be able to canibalize the needed code from DarthWayne's workshop category script, though you might need to make some changes to the "uninstall" part of his script for use in removing removing the entries from formlists when you change to a different setting. I haven't looked at it, so I can't be sure.

 

*I made a text dump of Fallout4.esm a while back, so I could do this kind of text search.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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