Jump to content

Food Actor Value Runtime Modification


Tompoolk

Recommended Posts

Hey there, I have a problem with my latest mod regarding the actor value "Food".

 

Basically when the object that provides food has been placed on the ground I would like to manipulate/modify the value during the game.

 

So one day it would be a value of 1, other days 3 reacting to events.

 

Now I have it working in the sense that the actor value has changed, that when you hover over the placed object it will say "Supplies x food" which is the correct value, however this Food value does not seem to supply to the settlement as the available food does not change.

 

I am changing the value by using the commands "SetActorValue" and "GetActorValue".

 

So I tried to "reset" the object when the value changed by treating the object as an actor and toggling it's unconscious state, which so far hasn't worked.

 

I'm hesitant about editing the actual workshop script as it may interfere with other mods and it seems too extreme for such a small mod.

 

Thanks for reading, if you have any other ideas or suggestion please go ahead.

 

I searched for if anyone else had this particular problem but couldn't find any real help.

Link to comment
Share on other sites

It may not be the object, but the interface. That is to say, it may be providing the correct amount of food, but the settlement build menu just doesn't reflect it. To test this, try building some in a settlement with no connecting supply lines, with enough settlers that if your object is at its lower value, it doesn't produce enough food for the settlement. Then, when it's at its higher value, see if the number for food produced stays red. If it doesn't, you are producing enough food for your settlers, even if the number doesn't reflect this. You can see this effect with supply lines set up, a settlement may produce no food, but the zero food number will be green, as supply lines provide enough food for the settlers.

Link to comment
Share on other sites

It may not be the object, but the interface. That is to say, it may be providing the correct amount of food, but the settlement build menu just doesn't reflect it. To test this, try building some in a settlement with no connecting supply lines, with enough settlers that if your object is at its lower value, it doesn't produce enough food for the settlement. Then, when it's at its higher value, see if the number for food produced stays red. If it doesn't, you are producing enough food for your settlers, even if the number doesn't reflect this. You can see this effect with supply lines set up, a settlement may produce no food, but the zero food number will be green, as supply lines provide enough food for the settlers.

 

Thanks for the response and your suggestion!

 

I set up the settlement as you described, both scenarios produced red numbers. I also attempted this with the starting quest in Sanctuary, the one where you have to supply enough food to feed the settlers. The quest completion percentage did not move when the object was at it's higher value.

 

Though you mentioning the ui element is something I did not consider, so that may be something to consider.

Edited by Tompoolk
Link to comment
Share on other sites

AFAIK the objects resource-AV will be copied in a private variable of the attached workshopobjectscript at the time the item is placed. The value can't be changed externally and the variable will not be updated when the AV changes.

 

Edit:

 

Maybe it could be possible to write a script which extends workshopobjectscript and replaces the functions HasMultiResource() and GetMultiResourceValue(). These two functions are used to copy and/or access the ActorValue and the private variable.

Edited by deadbeeftffn
Link to comment
Share on other sites

AFAIK the objects resource-AV will be copied in a private variable of the attached workshopobjectscript at the time the item is placed. The value can't be changed externally and the variable will not be updated when the AV changes.

 

Well, that sucks. I am working on a similar mod object that changes its defense rating. Time to dig into the workshopobjectscript and see what I can come up with.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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