Zorkaz Posted November 28, 2020 Share Posted November 28, 2020 How ca. would I get a defense rating or food rating of a specific settlement by using a script? Or which values would I need to check?Tried using parts of the Min01 (Sanctuary) quest but it's too messy for me. Link to comment Share on other sites More sharing options...
SKKmods Posted November 28, 2020 Share Posted November 28, 2020 Workshop ratings can only be trusted for accuracy when the player is on site so all resource objects are loaded and ResetWorkshop has run to update the ratings. ActorValue pWorkshopRatingTotalSafety = Game.GetFormFromFile(0x00127245, "Fallout4.esm") as ActorValue ObjectReference ThisWorkshop = wherever your getting the workshop ref from Debug.Trace("Workshop Safety " + ThisWorkshop + " " + ThisWorkshop.GetValue(pWorkshopRatingTotalSafety) Some prefer to copy the base game scripts and get the actor value by calling ThisWorkshop.GetValue((pWorkshopParent as WorkshopParentScript).WorkshopRatings[(pWorkshopParent as WorkshopParentScript).WorkshopRatingSafety].resourceValue) but thats mad since WorkshopParentScript is massivley over comitted and spends most of its time locked. Link to comment Share on other sites More sharing options...
Zorkaz Posted November 28, 2020 Author Share Posted November 28, 2020 Thank you Link to comment Share on other sites More sharing options...
Zorkaz Posted November 28, 2020 Author Share Posted November 28, 2020 Have to admit that I'm a bit stumped here.When using this on a repeatable test quest only the second debug message shows up Scriptname TMCommunityQuestScr extends Quest ObjectReference Property ThisWorkshop Auto ActorValue Property pWorkshopRatingTotalSafety Auto Message Property TMDebugMessage Auto Message Property TMDebugMessage2 Auto Float Property Dontfill Auto Event OnQuestInit() pWorkshopRatingTotalSafety = Game.GetFormFromFile(0x00127245, "Fallout4.esm") as ActorValue Dontfill == ThisWorkshop.GetValue(pWorkshopRatingTotalSafety) as float If Dontfill >= 4.9 TMDebugMessage.show() Else TMDebugMessage2.show() Endif EndEvent Link to comment Share on other sites More sharing options...
DieFeM Posted November 28, 2020 Share Posted November 28, 2020 Because Dontfill is 0, you are using comparison (==) instead of assignation (=). Link to comment Share on other sites More sharing options...
Zorkaz Posted November 28, 2020 Author Share Posted November 28, 2020 You're right and I changed "Dontfill ==" to "Dontfill =" shortly afterwards,yet it won't make a difference. Link to comment Share on other sites More sharing options...
DieFeM Posted November 28, 2020 Share Posted November 28, 2020 (edited) I would use local variables for dontfill and pWorkshopRatingTotalSafety instead of properties.Additionally I would add some debug, like checking if the keyword is not none, and the reference is not none and is a workshopscript.I guess you already know there are debug notification and message functions. Scriptname TMCommunityQuestScr extends Quest ObjectReference Property ThisWorkshop Auto Message Property TMDebugMessage Auto Message Property TMDebugMessage2 Auto Event OnQuestInit() ActorValue pWorkshopRatingTotalSafety = Game.GetFormFromFile(0x00127245, "Fallout4.esm") as ActorValue If !pWorkshopRatingTotalSafety Debug.MessageBox("failed lookup for pWorkshopRatingTotalSafety") ElseIf !ThisWorkshop Debug.MessageBox("ThisWorkshop contains no reference") ElseIf !(ThisWorkshop As WorkshopScript) Debug.MessageBox("ThisWorkshop reference is not a workshop") Else Float Dontfill = ThisWorkshop.GetValue(pWorkshopRatingTotalSafety) as float If Dontfill >= 4.9 TMDebugMessage.show() Else TMDebugMessage2.show() Endif EndIf EndEvent Edited November 28, 2020 by DieFeM Link to comment Share on other sites More sharing options...
Zorkaz Posted November 28, 2020 Author Share Posted November 28, 2020 Still no luck there, debug TMDebugMessage2 gets still displayed Further info:-It doesn't matter wether the Defense is 0 or 10 at the start-I since ported the script to a Trigger with a loop and utiliy.wait(), so I get results faster Link to comment Share on other sites More sharing options...
Recommended Posts