Jump to content

Im trying to add some variasbles to workshops and wondered what the best wayt of doing it was


JunkV3nd0r

Recommended Posts

this is mostly just me trying to ask a question of other modders to get how the creation kit and papyrus work,
But basically I was trying to store some variables for each indivdual workshop like which faction owns it.
They WAY of sorting the value is confusing me. At this point I'm thinking of just storing them all as global values, since that's all I know. I was also thinking about maybe making values in script and storing them in that way but I feel like all those values would get reset every time you close and open the game.

So this question is basically what are some ways of storing values for workshops, or at all I guess since all I know is global values.

Link to comment
Share on other sites

You can store them as script properties, by adding a new script to the base object, in this case the WorkshopWorkbench container.

Lets say that you name this new script as MyWorkshopProperties, and the property that stores the faction is named WorkshopFaction, it would look like that:

Scriptname MyWorkshopProperties extends ObjectReference
Faction Property WorkshopFaction Auto

Then you have another script where you want to access this property from a given workshop reference, lets say the variable for the object reference of this workshop is called WorkshopRef:

;Get the property
Faction ThisWorkshopFaction = (WorkshopRef As MyWorkshopProperties).WorkshopFaction
;Set the property
(WorkshopRef As MyWorkshopProperties).WorkshopFaction = PlayerFaction
Link to comment
Share on other sites

For a centralised approach attach ActorValues to each WorkshopREF ObjectReference.

 

As they only hold numbers, they would need to point at the index of formlists or arrays of factions.

 

Create FormList, drag faction in, use Find() to get the index and store in the ActorValue.

Link to comment
Share on other sites

what is a "WorkshopREF ObjectReference"?
Is it the script inside entries like "SanctuaryWorkshopREF" that can be found in settlement cells so I add the values via script? or is it something else?

 

EDIT 1 ok. so I added a custom script to sanctuary SanctuaryWorkshopREF and am trying to reference that script in another script that fires events when the workshop menu is opened.

Currently using:
WorkshopScript WorkshopREF = pWorkshopParent.GetWorkshopFromLocation(pPlayerRef.GetcurrentLocation())
(WorkshopREF As SOM_WorkShopAdditions).Test()

returns: cannot cast a workshopscript to a som_workshopadditions, types are incompatible

And using: SOM_WorkShopAdditions AdditionsREF = pWorkshopParent.GetWorkshopFromLocation(pPlayerRef.GetcurrentLocation())
returns type mismatch while assigning to a som_workshopadditions (cast missing or types unrelated)

does extending workshopscript instead of object referance make senes? I have no idea what I'm doing sorry if these replies are kinda frazeled.

edit 2 Making my script extend workshopscript makes the first option work but the second optin gets the same error message.
I'm reluctant to do this option as it could limit the amount of stuff I could do or have unintedned consiquneces (but... probably not I'm just a catastophist)
though the other option is to learn a way to referance scripts based on what settlment your in, or learn how the whole look up process in worhshopparentsscript works. both options are basically the swame thing. I'll still with this for this second and see what happens. I'll go see if it works I guess.

 

edit 3 ok that worked. now how do I add actor values to a script.... I guess I can try and see if/how workshopscript does it. im worried about them all changing and sharing the same value but... I feel like that's not how actor values work just based on the name. guess I'll find out.

Edited by JunkV3nd0r
Link to comment
Share on other sites

  • Recently Browsing   0 members

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