Jump to content

WTF is wrong with "LET"?


JustChill

Recommended Posts

Solved.

______________________________________________________________________________________________________________________________________________________

 

So,

 

I've this script (added the corrections already, wrong code still there as comment):

 

 

scn GSFarmFarmingAdditionalScript

short Button
short bHDisplay
short bODisplay
ref GSFarmMutFungiD
ref GSFarmDaturaID
Short GSFbrocFCount
Short GSFXandCount
Short GSFBuffCount
Short GSFAgavCount
String_Var GSFbrocF
String_Var GSFXand
String_Var GSFBuff
String_Var GSFAgav
String_Var GSFSacDat
String_Var GSFCFung
String_Var GSFMCFung
String_Var GSFMessageText
Short GSFInitVar
Short GSFRemoveCounter

BEGIN GameMode
    if GSFInitVar == 0 ;=> This is the current maximum amount of plants available.
        Set GSFbrocFCount to 2 ;=> If more plants are placed this needs to be changed.
        Set GSFXandCount to 2 ;=> Including the activation of the plants. Need to be changed either.
        Set GSFBuffCount to 2
        Set GSFAgavCount to 3
        Set GSFarmPatchQuest.GSFcfungCount to 4
        Set GSFarmPatchQuest.GSFsacdatCount to 3
        Set GSFarmPatchQuest.GSFmcfungCount     to 3
        Set GSFInitVar to 1 ;=> We only have to set the maximum amount once per playthrough / mod activation.
    endif

    if GetGameLoaded
        if IsModLoaded "HonestHearts.esm" == 0 ;=> Oh, you think you are fancy huh?
            if GSFarmDaturaREF1.GetDisabled == 0    ;=> So... Why the hell have you disabled the DLC after planting?
                GSFarmDaturaREF1.Disable        ;=> You could forcefully enable the plants through console commands.
                GSFarmDaturaREF2.Disable        ;=> WON'T FIX! Have fun with stupid exclamation marks!'
                GSFarmDaturaREF3.Disable
                Set GSFarmPatchQuest.GSFsacdatCount to 3    ;=> Available plant amount is reset too!
            endif
            Set bHDisplay to 0
        else
            Set bHDisplay to 1
        endif
        if IsModLoaded "OldWorldBlues.esm" == 0
            Set bODisplay to 0
        else
            Set bODisplay to 1
        endif
    endif
END

begin OnActivate player
    if GSFbrocFCount > 0
        Let GSFBrocF := sv_construct "%.0fx " GSFBrocFCount    ;=>Dynamic message box buttons.
        Let GSFBrocF := GSFBrocF + GetName BrocFlower        ;=> They somehow just work. oO
    else
        Let GSFbrocF := GetName BrocFlower
    endif
    if GSFXandCount > 0
        Let GSFXand := sv_construct "%.0fx " GSFXandCount
        Let GSFXand := GSFXand + GetName XanderRoot
    else
        Let GSFXand := GetName XanderRoot
    endif
    if GSFBuffCount > 0
        Let GSFBuff := sv_construct "%.0fx " GSFBuffCount
        Let GSFBuff := GSFBuff + GetName BuffaloGourdSeed
    else
        Let GSFBuff := GetName BuffaloGourdSeed
    endif
    if GSFAgavCount > 0
        Let GSFAgav := sv_construct "%.0fx " GSFAgavCount
        Let GSFAgav := GSFAgav + GetName NevadaAgaveFruit
    else
        Let GSFAgav := GetName NevadaAgaveFruit
    endif
    if bHDisplay
        if GSFarmDaturaID == 0
            Set Button to GetModIndex "HonestHearts.esm"
            Set GSFarmDaturaID to BuildRef Button, 38075
            Set Button to -1
        endif
    if GSFarmPatchQuest.GSFSacDatCount > 0
        Let GSFSacDat := sv_construct "%.0fx " GSFarmPatchQuest.GSFSacDatCount
        Let GSFSacDat := GSFSacDat + GetName GSFarmDaturaID
    else
        Let GSFSacDat := GetName GSFarmDaturaID
    endif
    if GSFarmPatchQuest.GSFCFungCount > 0
        Let GSFCFung := sv_construct "%.0fx " GSFarmPatchQuest.GSFCFungCount
        Let GSFCFung := GSFCFung + GetName CaveFungus
    else
        Let GSFCFung := GetName CaveFungus
    endif
    endif
    if bODisplay
        if GSFarmMutFungiD == 0
            Set Button to GetModIndex "OldWorldBlues.esm"
            Set GSFarmMutFungiD to BuildRef Button, 74046
            Set Button to -1
        endif
    if GSFarmPatchQuest.GSFMCFungCount > 0
        Let GSFMCFung := sv_construct "%.0fx " GSFarmPatchQuest.GSFMCFungCount
        Let GSFMCFung := GSFMCFung + GetName GSFarmMutFungiD
    else
        Let GSFMCFung := GetName GSFarmMutFungiD
    endif
    endif

    Let GSFMessageText := sv_construct "Which seeds do you want to plant? [You need at least one of the shown seeds, of which you can't plant more than the shown amount.]|"+GSFbrocF+"|"+GSFXand+"|"+GSFBuff+"|"+GSFAgav+"%{|"+GSFSacDat+"|"+GSFCFung+"%}%{|"+GSFMCFung+"%}|Nothing"

    MessageboxEx $GSFMessageText bHDisplay, bODisplay

;"    Let GSFbrocF := sv_destruct        => Destroying things is so much fun. :D
;    Let GSFXand := sv_destruct        => Here it is also helpful, simply as these strings would uselessly bloat the savegame.
;    Let GSFBuff := sv_destruct
;    Let GSFAgav := sv_destruct
;    Let GSFSacDat := sv_destruct
;    Let GSFCFung := sv_destruct
;    Let GSFMCFung := sv_destruct
;    Let GSFMessageText := sv_destruct"
    sv_destruct GSFbrocF, GSFXand, GSFBuff, GSFAgav, GSFSacDat, GSFCFung, GSFMCFung, GSFMessageText
end

BEGIN MenuMode 1001        ;=>>> OMG THE FORMATTING SUCK! Yeah, and? I took it over like that and kept it. Now cry!

        set Button to GetButtonPressed

    if ( Button == 0 )
    
    if ( GSFbrocFCount == 0 )        ;=> So, everything is planted?
        ShowMessage GSFarmAlreadyPlanted    ;=> Fine, now move on. Nothing to see here.
    elseif (player.GetItemCount BrocFlower == 0)
        ShowMessage GSFarmNoSeeds        ;=> Dude why don't you bring the weeds?
    else
    While GSFbrocFCount > 0 && Player.GetItemCount BrocFlower > 0    ;=> Don't do that unless you know what you are doing,
        player.RemoveItem BrocFlower 1 1            ;=> like me. :P This cannot end in an endless loop.
        Set GSFbrocFCount to GSFbrocFCount - 1    ;=> The player may lose all seeds or plant all plants.
        if GSFarmBroc1.GetDisabled                    ;=> Whatever happens, if one of these conditions is zero the loop is left.
            GSFarmBroc1.Enable        ;=> Thanks to ELSEIF this works one by one.
        elseif GSFarmBroc2.GetDisabled    ;=> Planting per seed.
            GSFarmBroc2.Enable
        endif
        Set GSFRemoveCounter to GSFRemoveCounter + 1    ;=> I am faking the regular ingame message.
    Loop                                                                    ;=> Counter is necessary to show the proper amount.
    if GSFRemoveCounter > 1
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|%g " GSFRemoveCounter
        Let GSFMessageText := GSFMessageText + GetName BrocFlower +"(s) removed"
        MessageExAlt 2 $GSFMessageText
    else
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|"+GetName BrocFlower+" removed"
        MessageExAlt 2 $GSFMessageText
    endif
;"    Let GSFMessageText := sv_destruct"
    sv_destruct GSFMessageText
    Set GSFRemoveCounter to 0
    PlaySound UIItemGenericDown
    endif

    endif
    
    if ( Button == 1 )
        
    if ( GSFXandCount == 0 )
        ShowMessage GSFarmAlreadyPlanted
    elseif (player.GetItemCount XanderRoot == 0)
        ShowMessage GSFarmNoSeeds
    else
    While GSFXandCount > 0 && Player.GetItemCount XanderRoot > 0
        player.RemoveItem XanderRoot 1 1
        Set GSFXandCount to GSFXandCount - 1
        if GSFarmXander1.GetDisabled
            GSFarmXander1.Enable
        elseif GSFarmXander2.GetDisabled
            GSFarmXander2.Enable
        endif
        Set GSFRemoveCounter to GSFRemoveCounter + 1
    Loop
    if GSFRemoveCounter > 1
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|%g " GSFRemoveCounter
        Let GSFMessageText := GSFMessageText + GetName XanderRoot +"(s) removed"
        MessageExAlt 2 $GSFMessageText
    else
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|"+GetName XanderRoot+" removed"
        MessageExAlt 2 $GSFMessageText
    endif
;"    Let GSFMessageText := sv_destruct"
    sv_destruct GSFMessageText
    Set GSFRemoveCounter to 0
    PlaySound UIItemGenericDown
    endif

    endif

    if ( Button == 2 )

    if ( GSFBuffCount == 0 )
        ShowMessage GSFarmAlreadyPlanted
    elseif (player.GetItemCount BuffaloGourdSeed == 0)
        ShowMessage GSFarmNoSeeds
    else
    While GSFBuffCount > 0 && Player.GetItemCount BuffaloGourdSeed > 0
        player.RemoveItem BuffaloGourdSeed 1 1
        Set GSFBuffCount to GSFBuffCount - 1
        if GSFarmBuffalo1.GetDisabled
            GSFarmBuffalo1.Enable
        elseif GSFarmBuffalo2.GetDisabled
            GSFarmBuffalo2.Enable
        endif
        Set GSFRemoveCounter to GSFRemoveCounter + 1
    Loop
    if GSFRemoveCounter > 1
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|%g " GSFRemoveCounter
        Let GSFMessageText := GSFMessageText + GetName BuffaloGourdSeed +"(s) removed"
        MessageExAlt 2 $GSFMessageText
    else
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|"+GetName BuffaloGourdSeed+" removed"
        MessageExAlt 2 $GSFMessageText
    endif
;"    Let GSFMessageText := sv_destruct"
    sv_destruct GSFMessageText
    Set GSFRemoveCounter to 0
    PlaySound UIItemGenericDown
    endif

    endif

    if ( Button == 3 )

    if ( GSFAgavCount == 0 )
        ShowMessage GSFarmAlreadyPlanted
    elseif (player.GetItemCount NevadaAgaveFruit == 0)
        ShowMessage GSFarmNoSeeds
    else
    While GSFAgavCount > 0 && Player.GetItemCount NevadaAgaveFruit > 0
        player.RemoveItem NevadaAgaveFruit  1 1
        Set GSFAgavCount to GSFAgavCount - 1
        if GSFarmAgave1.GetDisabled
            GSFarmAgave1.Enable
        elseif GSFarmAgave2.GetDisabled
            GSFarmAgave2.Enable
        elseif GSFarmAgave3.GetDisabled
            GSFarmAgave3.Enable
        endif
        Set GSFRemoveCounter to GSFRemoveCounter + 1
    Loop
    if GSFRemoveCounter > 1
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|%g " GSFRemoveCounter
        Let GSFMessageText := GSFMessageText + GetName NevadaAgaveFruit +"(s) removed"
        MessageExAlt 2 $GSFMessageText
    else
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|"+GetName NevadaAgaveFruit+" removed"
        MessageExAlt 2 $GSFMessageText
    endif
;"    Let GSFMessageText := sv_destruct"
    sv_destruct GSFMessageText
    Set GSFRemoveCounter to 0
    PlaySound UIItemGenericDown
    endif

    endif

    if ( Button == 4 ) && ( bHDisplay )
    if ( GSFarmPatchQuest.GSFSacDatCount == 0 )
        ShowMessage GSFarmAlreadyPlanted
    elseif (player.GetItemCount GSFarmDaturaID == 0)
        ShowMessage GSFarmNoSeeds
    else
    While GSFarmPatchQuest.GSFSacDatCount > 0 && Player.GetItemCount GSFarmDaturaID > 0
        player.RemoveItem GSFarmDaturaID 1 1
        Set GSFarmPatchQuest.GSFSacDatCount to GSFarmPatchQuest.GSFSacDatCount - 1
        if GSFarmDaturaREF1.GetDisabled
            GSFarmDaturaREF1.Enable    
        elseif GSFarmDaturaREF2.GetDisabled
            GSFarmDaturaREF2.Enable
        elseif GSFarmDaturaREF3.GetDisabled
            GSFarmDaturaREF3.Enable    
        endif
        Set GSFRemoveCounter to GSFRemoveCounter + 1
    Loop
    if GSFRemoveCounter > 1
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|%g " GSFRemoveCounter
        Let GSFMessageText := GSFMessageText + GetName GSFarmDaturaID +"(s) removed"
        MessageExAlt 2 $GSFMessageText
    else
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|"+GetName GSFarmDaturaID+" removed"
        MessageExAlt 2 $GSFMessageText
    endif
;"    Let GSFMessageText := sv_destruct"
    sv_destruct GSFMessageText
    Set GSFRemoveCounter to 0
    PlaySound UIItemGenericDown
    endif
    elseif ( Button == 4 ) && ( bODisplay )
    if ( GSFarmPatchQuest.GSFMCFungCount == 0 )
        ShowMessage GSFarmAlreadyPlanted
    elseif (player.GetItemCount GSFarmMutFungiD == 0)
        ShowMessage GSFarmNoSeeds
    else
    While GSFarmPatchQuest.GSFMCFungCount > 0 && Player.GetItemCount GSFarmMutFungiD > 0    
        player.RemoveItem GSFarmMutFungiD 1 1
        Set GSFarmPatchQuest.GSFMCFungCount to GSFarmPatchQuest.GSFMCFungCount - 1
        if GSFarmFungRef1.GetDisabled
            GSFarmFungREF1.Enable
            GSFarmFungAddREF1.Enable
            GSFarmFungAddREF2.Enable
            GSFarmFungAddREF3.Enable
            GSFarmFungAddREF4.Enable
        elseif GSFarmFungRef2.GetDisabled
            GSFarmFungREF2.Enable
        elseif GSFarmFungRef3.GetDisabled
            GSFarmFungREF3.Enable
        endif
        Set GSFRemoveCounter to GSFRemoveCounter + 1
    Loop
    if GSFRemoveCounter > 1
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|%g " GSFRemoveCounter
        Let GSFMessageText := GSFMessageText + GetName GSFarmMutFungiD +"(s) removed"
        MessageExAlt 2 $GSFMessageText
    else
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|"+GetName GSFarmMutFungiD+" removed"
        MessageExAlt 2 $GSFMessageText
    endif
;"   Let GSFMessageText := sv_destruct"
    sv_destruct GSFMessageText
    Set GSFRemoveCounter to 0
    PlaySound UIItemGenericDown
    endif

    endif

    if ( Button == 5 ) && ( bHDisplay )
    if ( GSFarmPatchQuest.GSFCFungCount == 0 )
        ShowMessage GSFarmAlreadyPlanted
    elseif (player.GetItemCount CaveFungus == 0)
        ShowMessage GSFarmNoSeeds
    else
    While GSFarmPatchQuest.GSFCFungCount > 0 && Player.GetItemCount CaveFungus > 0
        player.RemoveItem CaveFungus 1 1
        Set GSFarmPatchQuest.GSFCFungCount to GSFarmPatchQuest.GSFCFungCount - 1
        if GSFarmMushREF1.GetDisabled
            GSFarmMushREF1.Enable
            GSFarmMushAddREF1.Enable
            GSFarmMushAddREF2.Enable
            GSFarmMushAddREF6.Enable
        elseif GSFarmMushREF2.GetDisabled
            GSFarmMushREF2.Enable
        elseif GSFarmMushREF3.GetDisabled
            GSFarmMushREF3.Enable
            GSFarmMushAddREF3.Enable
            GSFarmMushAddREF4.Enable
            GSFarmMushAddREF5.Enable
        elseif GSFarmMushREF4.GetDisabled
            GSFarmMushREF4.Enable
        endif
        Set GSFRemoveCounter to GSFRemoveCounter + 1
    Loop
    if GSFRemoveCounter > 1
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|%g " GSFRemoveCounter
        Let GSFMessageText := GSFMessageText + GetName CaveFungus +"(s) removed"
        MessageExAlt 2 $GSFMessageText
    else
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|"+GetName CaveFungus+" removed"
        MessageExAlt 2 $GSFMessageText
    endif
 ;"   Let GSFMessageText := sv_destruct"
    sv_destruct GSFMessageText
    Set GSFRemoveCounter to 0
    PlaySound UIItemGenericDown
    endif

    endif

    if ( Button == 6 ) && ( bODisplay )
    if ( GSFarmPatchQuest.GSFMCFungCount == 0 )
        ShowMessage GSFarmAlreadyPlanted
    elseif (player.GetItemCount GSFarmMutFungiD == 0)
        ShowMessage GSFarmNoSeeds
    else
    While GSFarmPatchQuest.GSFMCFungCount > 0 && Player.GetItemCount GSFarmMutFungiD > 0
        player.RemoveItem GSFarmMutFungiD 1 1
        Set GSFarmPatchQuest.GSFMCFungCount to GSFarmPatchQuest.GSFMCFungCount - 1
        if GSFarmFungRef1.GetDisabled
            GSFarmFungREF1.Enable
            GSFarmFungAddREF1.Enable
            GSFarmFungAddREF2.Enable
            GSFarmFungAddREF3.Enable
            GSFarmFungAddREF4.Enable
        elseif GSFarmFungRef2.GetDisabled
            GSFarmFungREF2.Enable
        elseif GSFarmFungRef3.GetDisabled
            GSFarmFungREF3.Enable
        endif
        Set GSFRemoveCounter to GSFRemoveCounter + 1
    Loop
    if GSFRemoveCounter > 1
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|%g " GSFRemoveCounter
        Let GSFMessageText := GSFMessageText + GetName GSFarmMutFungiD +"(s) removed"
        MessageExAlt 2 $GSFMessageText
    else
        Let GSFMessageText := sv_construct "Interface\Icons\Message Icons\glow_message_vaultboy_neutral.dds|"+GetName GSFarmMutFungiD+" removed"
        MessageExAlt 2 $GSFMessageText
    endif
;"    Let GSFMessageText := sv_destruct"
    sv_destruct GSFMessageText
    Set GSFRemoveCounter to 0
    PlaySound UIItemGenericDown
    endif

    endif

end

 

 

 

Everything works as intended.

I actually already skipped this step and continued with my container (of which I recently opened a topic), but now I checked the console after activating the farm tools.

Tons of errors.

WHY?

 

Working script, but I still get spammed with error messages in the console?

This is preposterous!

 

 

 

 

In addition:

Hm, it may be jazzi's angel dust... ehm JIP LN, which allows me to have working message boxes and functions, when there is a script error.

However, I still don't get why the script actually works as intended when there are errors.

If that's all JIP LN NVSE plugin's fault then this is not just a simple gamefix and NVSE enhancement, but a magic moving caslte. oO

 

Yet is there a way to turn off these annoying messages?

Link to comment
Share on other sites

I would start adding print checks after everything. If it's not giving you anything more specific than which script has the error, you should still know which line is causing the problem by the order in which things are printed to the console. So, for example, if there are print checks every once in a while, and the first error occurs after the print check that you know is at line 12 but before like 18, you can look for Let lines in that range. That's how most code trouble-shooting is done if the problem isn't obvious at first glance. Or at least, that's what real programmers (as in, people that are not myself) have told me more than once. And what errors are you getting? Are they all the same? What do they say and when do you get them?

 

Edit: Hadn't remembered to watch the video first. I don't really have time to look through that whole script unfortunately, but I'm getting that at some point, you must have forgotten to do a check that makes sure you're not using an empty variable somewhere. This could be of use, or you may know everything that's here:
https://geckwiki.com/index.php/NVSE_Error

Edited by EPDGaffney
Link to comment
Share on other sites

Please see the 'TIP: Debugging data to file' and 'TIP: Pass a variable number into a script message' entries under the "Scripting" section of the wiki "Getting started creating mods using GECK" article. As suggested, those are the most common and useful methods of debugging similar problems. (It's not uncommon for debugging statements to outnumber the number of actual code lines.)

 

-Dubious-

Link to comment
Share on other sites

Well thanks for the input. :smile:

 

The thing is that I actually didn't even know about the issues as when I tested the function, everything worked.

I simply didn't check the console until now.

 

Basically I would love to clear all console messages. XD

I mean the game doesn't crash and the function works as intended.

Still "LET" produces console entries. -.-

 

This really doesn't make sense, but I'm gonna use some console prints to check which exact LET does have "issues".

Thanks you.

 

 

 

In Addition:

Much, much thanks again to get me into looking over it again.

Fault was on my side. Actually, when I got instructed into scripting I was told to destroy a string variable everytime after usage by

Let myString := sv_destruct

Which was of course the wrong syntax. :awkward:

sv_destruct myString

Error message gone now.

 

 

My apologies to "LET". You're a fine function. :D

 

Oh, I've also updated the script in the OP, by making "comments" of the wrong code and including the working fix.

Link to comment
Share on other sites

Those are what we call "non-fatal errors". They don't break the program/script, but are still things that should be corrected as they mean things are not going to work quite as desired. Be happy you caught them now. The vanilla game and DLC are riddled with them.

 

-Dubious-

Link to comment
Share on other sites

Is it possible you confused strings and arrays? Arrays are nullified with

Let aArray := Ar_Null

Thanks for commenting the code with the solution. Someone's life will probably be easier one day.

Actually my "mentor" told me to do that.

Maybe he confused it with Oblivion? He did a lot with scripts there too. Guess if that's a legit syntax there he simply took it over which is wrong in the case of NV.

 

I don't know, I am just happy that I will do one mistake less in the future. ^^

 

 

 

Even though it has nothing to do with the topic, it's still about the same script...

I've added some additions to the plant activation:

 

 

 

    While GSFXandCount > 0 && Player.GetItemCount XanderRoot > 0
        player.RemoveItem XanderRoot 1 1
        Set GSFXandCount to GSFXandCount - 1
        if GSFarmXander1.GetDisabled
            GSFarmXander1.Enable
          "GSFarmXander1.Activate Player 1    ;=> This would show the "Xander Root added" message.
          ClearMessageQueue                   ;=> The message is not shown as the queue is cleared.
          Player.RemoveItem XanderRoot 1 1"
        elseif GSFarmXander2.GetDisabled
            GSFarmXander2.Enable
          "GSFarmXander2.Activate Player 1
          ClearMessageQueue
          Player.RemoveItem XanderRoot 1 1"
        endif
        Set GSFRemoveCounter to GSFRemoveCounter + 1
    Loop

 

 

 

The highlighted code will ensure that the plant is already harvested (without the player knowing he had a plant in his inventory as "ClearMessageQueue" removes the pending "AddItem" message from the activation.

Yet, I've an issue with the plants performing "OnReset", everytime I enter a building and get back out.

Normally they should respawn in 3 days, no?

 

This happens with all exterior plants. Only the mushrooms in the basement stay harvested after a few visits.

But outside they regrow as soon as I enter and leave the house.

 

Is that normal vanilla behavior? As I haven't used any other plant activators than vanilla there.

Link to comment
Share on other sites

Ah, just figured a solution. It may need a bit work in worldspace (ugh), but I'll create now an unique activator for any plant instead of using the vanilla one.

These ones will have the highlighted addition to the code:

 

 

 

SCN GSFarmScaredDaturaScript

INT State
Ref GSDaturaRootDLC02
Short sModIndex
"float GSFGameDays"

BEGIN onActivate
    if State == 0 && GetActionRef == player
        Set sModIndex to GetModIndex "HonestHearts.esm"
        Set GSDaturaRootDLC02 to BuildRef sModIndex, 38075
        if IsFormValid GSDaturaRootDLC02
            player.additem GSDaturaRootDLC02 1
        endif
        set State to 1
        "Set GSFGameDays to GetGameDaysPassed"
        playGroup Backward 1
        setdestroyed 1
    endif
END

BEGIN onLoad
    if State == 0
        playGroup Forward 1
    elseif State == 1
        playGroup Backward 1        
    endif
END

BEGIN onReset
    if State == 1
        "if GetGameDaysPassed >= (GSFGameDays + 3)
            playgroup Forward 1
            set State to 0
            setdestroyed 0
        endif"
    endif
END

 

 

 

Now the plants can only be harvested every 3 days.

 

 

 

Interesting observation:

I just checked the plants behind Doc Mitchell's house.

The Agave, the Maize both don't respawn, when I enter Doc's house or any other.

 

The difference to my plants is, that these are persistent references and initially disabled, but the ones behind Doc's house only generic ones. So maybe that has something to do with OnReset firing too early.

Seems the regular script works on regular plants, but unique ones will respawn over and over. With the awkward exception of having unique plants inside an interior, but these don't fire up the OnReset block wrongfully.

(Well I've still added that failsafe to the script of the mushrooms. :tongue:)

 

One more reason to make them real unique activators. :smile:

 

 

 

 

Another addition:

Alright, I scrapped OnReset and switched to GameMode.

Even though that's not recommended as it is firing everytime, but there are only 2 conditions to be taken care of.

First the State then the days passed.

 

So with this low amount of plants it is acceptable.

 

 

A pitty, that OnReset doesn't run properly.

Link to comment
Share on other sites

OnLoad and OnReset are both unreliable, I will ask jazz for something like On3DLoaded that should work, and maybe he can fix OnReset.

 

I had the very same issue with plants respawning and DLC has the same issue.

 

Now if only the picking sound wouldn't always get overridden with the default take sound...

Link to comment
Share on other sites

Hey Roy, that would be awesome. :D

 

My enhancement of the house mod actually is relying onto some JIP LN functions, so it will be perfect to have a functional OnReset block too with that DLL plugin.

Hopefully jazz finds some time for. :smile:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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