Jump to content

My script RegisterForSingleUpdateGameTime is not working, help is welcome


Recommended Posts

Yep first of all your script works perfectly...Just tested it...however as you mentioned the 24 hours lapse is no longer in the script I am starting over with your script and think of ways to implement the time lapse...Thanks again. Will report wit my "hopefully" final script.

Link to comment
Share on other sites

One thing you might have to realize is that your initial idea did not guarantee it either.     I.e. if  last OnUpdateGameTime  happened 23 game hours before the quest got completed, the house would get disabled just one game hour later.

Scriptname aaaDisableFarmhouse02DestroyedScript extends ObjectReference

GlobalVariable Property GameDaysPassed Auto ; filled with GameDaysPassed
Float Property CompletionTime = 0.0
Quest Property CollegeQuest Auto

Event OnLoad()
  If isEnabled()
    If CollegeQuest.IsCompleted() && (GameDaysPassed.GetValue() - CompletionTime) >=1.0
  	  Self.Disable()
    EndIf
  EndIf
EndEvent

Function SetCompletionTime()
  CompletionTime = GameDaysPassed.GetValue()
EndFunciton

So the question now is to find some way to call that SetCompletionTime() function.  One nice option is take a line of dialogue that WILL be said right before quest completion.

In MG08 quest, PlayerDialoguie tab, Stage50TandilFreeBranch/MG08Stage50TandilFreeTopic   ("We knew you would succeed"), does not have a script attached 
So you can add a fragment to it - general process is you put a semicolon in the fragment window, click compile, it will generate a script.    Then, you add a property called, say, 'FarmHouse' of ObjectReference type, filled with that house ref.

Then you edit the fragment:

(FarmHouse as aaaDisableFarmhouse02DestroyedScript).SetCompletionTime()

 

Link to comment
Share on other sites

Hi everyone and thank you all for your help. I finally made it work. Basically our script will not work in a pristine manner because if I understand correctly you can not make a static/building a persistent ref.

The work arround is to use a xMarker attached the script below and link your building with the xMarker (enable parent). 

Scriptname aaaDisableDestroyedFarmhouse extends ObjectReference

Quest Property CollegeQuest Auto  
ObjectReference Property MyXMarker Auto  ; Reference to the XMarker linked to the destroyed building

Event OnCellLoad()
    Debug.Trace("aaaDisableDestroyedFarmhouse - OnCellLoad triggered")  
    if MyXMarker.IsEnabled()
        CheckQuestCompletion()
    endif
EndEvent

Function CheckQuestCompletion()
    Debug.Trace("aaaDisableDestroyedFarmhouse - Checking quest completion")
    if CollegeQuest.IsCompleted()
        Debug.Trace("aaaDisableDestroyedFarmhouse - Quest completed, disabling in 48h")
        RegisterForSingleUpdateGameTime(48.0)  
    else
        Debug.Trace("aaaDisableDestroyedFarmhouse - Quest not completed, checking in 24h")
        RegisterForSingleUpdateGameTime(24.0)  
    endif
EndFunction

Event OnUpdateGameTime()
    Debug.Trace("aaaDisableDestroyedFarmhouse - OnUpdateGameTime triggered")
    if CollegeQuest.IsCompleted()
        Debug.Trace("aaaDisableDestroyedFarmhouse - Disabling XMarker (and destroyed building)")
        MyXMarker.Disable()
    else
        Debug.Trace("aaaDisableDestroyedFarmhouse - Quest not completed, checking again in 24h")
        RegisterForSingleUpdateGameTime(24.0)  
    endif
EndEvent
 

What I wanted to do is disable this building and enable a brand new one at the same place. The above script is for disabling but by now you understand how it works. I believe that's the way they handle it in earthfire dlc

Thank you guys without  you I would have stopped looking for a solution.

 

Edited by MasterAub
Link to comment
Share on other sites

  • Recently Browsing   0 members

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