Jump to content

Script: Get dense rating of specific settlement


Zorkaz

Recommended Posts

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

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

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 by DieFeM
Link to comment
Share on other sites

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

  • Recently Browsing   0 members

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