Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY] Campsite that fades out over time


bleakraven
 Share

Recommended Posts

Hey TESA!

 

You might remember me posting in Script Requests about a campfire that fades over time... Well, I managed to get something like it working, but I keep getting it stuck on stage 2. I can't find the problem anywhere...

Perhaps you can help me sort out what's wrong here?

I'll post an abridged version of my script, so that you only see the parts regarding the fading/stages.

 

Scriptname aBleakCampfireScript extends ObjectReference 
{Script for the custom campfire}

ObjectReference Property Stage1 Auto ;Fully Lit
ObjectReference Property Stage2 Auto ;Going down
ObjectReference Property Stage3 Auto ;Embers
ObjectReference Property Stage4 Auto ;Ash
ObjectReference Property CampfireLight Auto ;Light that is on when any fire is
ObjectReference Property Brazier_Light1 Auto ;Light from the BrazierFunction ShelterManagement()
    int ibutton1
    
    if (aBleakShelterAreaNumber.GetValue() == 1)
        ibutton1 = aBleakShelterBuildingMenu_Campfire1.Show()
    elseif (aBleakShelterAreaNumber.GetValue() == 2)
        ibutton1 = aBleakShelterBuildingMenu_Campfire2.Show()
    elseif (aBleakShelterAreaNumber.GetValue() == 3)
        ibutton1 = aBleakShelterBuildingMenu_Campfire3.Show()
    elseif (aBleakShelterAreaNumber.GetValue() == 4)
        ibutton1 = aBleakShelterBuildingMenu_Campfire4.Show()
    EndIf
        
        if (ibutton1 == 0) ;Build Shelter
            BuildShelterMenu()
        ElseIf (ibutton1 == 1) ;Upgrade
            UpgradeMenu()
        ElseIf (ibutton1 == 2) ;Kindle
            if (Game.GetPlayer().GetItemCount(Firewood01) >= 2)
                Game.GetPlayer().RemoveItem(Firewood01, 2)
                Kindle()
                Return
                
            ElseIf (Game.GetPlayer().GetItemCount(aBleakDriftWoodItem) >= 2)
                Game.GetPlayer().RemoveItem(aBleakDriftWoodItem, 2)
                Kindle()
                Return
            Else
                aBleakKindle_NotEnoughResources.Show()
            EndIf
        EndIf
EndFunction;**********FADE**********

Function Kindle()
    if Stage1.IsDisabled()
        ;UnregisterForUpdateGameTime()
        Utility.Wait(0.2)
        StartFading()
    Else
        RegisterForSingleUpdateGameTime(3)
        Debug.Notification("Hi! Stage 1! Wait 3 hours now.")
    EndIf
EndFunction

Function StartFading()
        Stage1.Enable()
        CampfireLight.Enable()
        Brazier_Light1.Enable()
        CampfireLight.Enable()
        RegisterForSingleUpdateGameTime(3)
        Debug.Notification("Hi! I'm back. Wait 3 hours.")

EndFunction

Event OnUpdateGameTime()
    if (Stage1.IsEnabled())
        Stage1Function()
        RegisterForSingleUpdateGameTime(3)
        Debug.Notification("Stage2")
        
    ElseIf (Stage2.IsEnabled())
        Stage2Function()
        RegisterForSingleUpdateGameTime(3)
        Debug.Notification("Stage3")
        
    ElseIf (Stage3.IsEnabled())
        Stage3Function()
        RegisterForSingleUpdateGameTime(3)
        Debug.Notification("Stage4")
        
    ElseIf (Stage4.IsEnabled())
        Stage4Function()
        UnregisterForUpdateGameTime()
        Debug.Notification("I'm all out.")
    EndIf
EndEvent

Function Stage1Function()
        Stage1.Disable()
        Stage2.Enable()
        Stage3.Disable()
        Stage4.Disable()
        
EndFunction

Function Stage2Function()
        Stage2.Disable()
        Stage3.Enable()
        Stage4.Disable()
        Stage1.Disable()
        
EndFunction

Function Stage3Function()
        Stage2.Disable()
        Stage3.Disable()
        Stage4.Enable()
        Stage1.Disable()
        
EndFunction

Function Stage4Function()
        CampfireLight.Disable()
        Stage2.Disable()
        Stage3.Disable()
        Stage4.Disable()
        Stage1.Disable()
        Brazier_Light1.Disable()
        
EndFunction

 

So when I activate my campfire, a marker enables the decoration around it, the fire (stage1) and the light. I can only get it to start fading by clicking Kindle (haven't figured out how to do it when the Main Marker is enabled). The Fading process gets stuck on stage2 and keeps going over and over again without ever changing states...

Edited by bleakraven
Link to comment
Share on other sites

First off, you don't have an event or function encasing your first section of code. It has an 'endFunction' but no start of the function.

 

Second, you really don't need to make the script more complex with functions. A function is used when the same code is 'called' from several different locations in your script. There is no reason to put your code in a function when it only gets run once from one location.

Link to comment
Share on other sites

I agree with WillieSea, the script looks overly complicated, makes it hard to track. Besides that, I can't see any major issues with it. Maybe the problem is not with the script itself. Did you make sure that the objects stage1, 2 , 3, 4 are set to 'initially disabled' and that they don't have an 'enable parent' ? Objects with an enable parent can't get script enabled or disabled. Just a guess.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...