Jump to content

SetScript help.


DuskWulf

Recommended Posts

I prefer to be self-sufficient so I don't have to be a bother but I'm hitting a brick wall here and it's upsetting. So I have to be a bother, sorry about that.

 

I want to use SetScript on a few NPCs to add to what their scripts do. I've replicated the functionality and there's no problem there at all. I've made a few projects as a sort of a... test run for a bigger project I have in the wings.

 

Currently, one of the test projects I'm working on for the bigger project is a mod to restore Primm's reputation but scripted, I don't like editing forms unless it's absolutely necessary (every mod that does that means more work for their users).

 

So here's what I'm doing...

 

 

    If GetGameRestarted
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, PrimmPowderGangerOutside
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, LvlPowderGangerGunNVBisonSteve01
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, LvlPowderGangerNVBisonSteve01Sleeping
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, LvlPowderGangerNVBisonSteve01Flamer
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, PrimmPowderGangerRifle
    EndIf

 

...and...

 

 

scn INHIBPrimmPowderGangerOverrideSCRIPT

short noCount
short maxDone

BEGIN OnLoad
    Print "Testing OnLoad."

    If GetDead == 1
        Disable

    ElseIf nvPrimmDeputyConv.iTownState == 1
        Let noCount := 1

        Kill
    EndIf

    If maxDone == 0
        Print "maxDone 0"

        If IsInInterior == 1
            Print "Interior +1"

            Let INHIBOnUpdateQUEST.primmCleanupInsideMax += 1

            Let maxDone := 1

        Else
            Print "Exterior +1"

            Let  INHIBOnUpdateQUEST.primmCleanupOutsideMax += 1

            Let maxDone := 1
        EndIf
    EndIf
END

BEGIN OnDeath
    Print "Testing OnDeath."

    If noCount == 0
        If IsInInterior == 1
            Let INHIBOnUpdateQUEST.primmCleanupInsideCount += 1

        Else
            Let  INHIBOnUpdateQUEST.primmCleanupOutsideCount += 1
        EndIf
    EndIf
END
 
BEGIN GameMode
   Print "Testing GameMode."
END

 

...it has interesting results.

 

If I load a save that mod hasn't run on prior, it works perfectly. It does everything it needs to. If, however, I do a quicksave, close the game, then reopen the game it stops working. Not even the testing prints work.

 

I've read the NVSE was broken a bit back in regards to SetScript and that after a reload it strips scripts from actors and they no longer work. Is this still true?

 

Any help would be appreciated. Thank you.

Link to comment
Share on other sites

    If GetGameRestarted
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, PrimmPowderGangerOutside
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, LvlPowderGangerGunNVBisonSteve01
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, LvlPowderGangerNVBisonSteve01Sleeping
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, LvlPowderGangerNVBisonSteve01Flamer
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, PrimmPowderGangerRifle
    EndIf

Hey, where do you run this query?

 

It would be best to do it in

Begin MenuMode 4
    If GetGameRestarted
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, PrimmPowderGangerOutside
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, LvlPowderGangerGunNVBisonSteve01
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, LvlPowderGangerNVBisonSteve01Sleeping
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, LvlPowderGangerNVBisonSteve01Flamer
        SetScript INHIBPrimmPowderGangerOverrideSCRIPT, PrimmPowderGangerRifle
    EndIf
End

I recommend to check the warnings of this function on the Geck Wiki:

https://geckwiki.com/index.php/SetScript#Warning

Link to comment
Share on other sites

  • Recently Browsing   0 members

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