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...

I got lost and need help back


Walrus
 Share

Recommended Posts

So some of you know I've been working on a script to raise and lower water levels with multiple activators.

I had a working script, but do to some graphics glitches I had to change it. i stupidly decided to add other things in as well. Le't just say those other things don't work and I forgot to back up my old script. Yay. Now I can't get anything to work.

 

I was hoping if you guys could look at this and tell me why 3 out of the 4 possible activator states make me lose player controls, and activate the Exit.

 

Scriptname WMWaterlv extends ObjectReference  
{Script to determine if both valves are closed and then lower water level}
 
Import Game
Import Utility
 
ObjectReference Property Valve1  Auto  
ObjectReference Property Valve2  Auto  
ObjectReference Property Water  Auto
ObjectReference Property Water2  Auto
ObjectReference Property Mist  Auto 
;Here we name our effect 
ObjectReference Property Mist2  Auto 
ObjectReference Property Exit  Auto
ObjectReference Property kDest Auto
ObjectReference Property kDest2 Auto
Sound Property Drain  Auto
Sound Property Fill  Auto
 
int Value1
int Value2
int Full
;Names values for state of valves later
 
Event OnCellLoad()
     Value1 = 0
     Value2 = 0
     Full = 1
     Exit.lock()
     Mist.Disable()
     Mist2.disable()
     Water.Disable()
     Water2.Enable()
EndEvent
 
Event OnActivate(ObjectReference akActionRef)
     If akActionRef == Valve1
          If Value1 == 1 
               Value1 = 0
               Mist.Disable()
 
          Elseif Value1 == 0
               Value1 = 1
               Mist.Enable()
          EndIf
     Endif
 
     If akActionRef == Valve2
          If Value2 == 1
               Value2 = 0
               Mist2.Disable()
 
          Elseif Value2 == 0
               Value2 = 1
               Mist2.enable()
          EndIf
     Endif
 
     If Value1 == 1 && Value2 == 1
;If both activators are on do all this
          Water.Enable()
          Water2.Disable()
;Switches water planes for later reasons
           Water.TranslateToRef(kDest2, 25.0) ; 50 is the speed value
           DisablePlayerControls()
           Drain.Play(Self)
;Water goes down with sound and player is forced to stand still
           Wait(9)
;wait for movement to be complete
           Water.disable()
           Full = 0
;Remove water and set Full value to false
           Exit.Lock(false)
           Exit.Activate(Self)
;unlock door and open it
           EnablePlayerControls()
;Give player movement again
 
     Elseif Value1 == 0 && Value2 == 0
;If both valves are off do all this
          Exit.Activate(Self)
;Door closes
          Water.enable()
;Water gets turned on
          DisablePlayerControls()
;Player is forced to stand still
           Water.TranslateToRef(kDest, 25.0)
           Fill.Play(Self)
;Water goes up with sound
           Wait(9)
           Full = 1
;Wait and set the Full int to yes
;Exit.Lock()
;Door is locked
           Water2.Enable()
           Water.Disable()
;Switches active water planes to reset water effects
           EnablePlayerControls()
;Gives the player movement again
     Endif
EndEvent

 

When I run this script an turn valve 1 (value1=1) nothing happens. If i move valve1 again (value1=0), my controls are disabled for whatever amount of time the Wait is set to.

When I run this script and turn Valve2 (value2=1) I am disabled again for the wait time. Same as if I turn it again after that (value2=0)

Sometimes the door will unlock and open or lock and close as well,

BUT the rest of it doesn't go until the valves are in the correct spots. The water only raises and lowers and switches when both valves are in the right spot. And it will come back up exactly like its supposed to after too., I do not get what is going on here. So any help would be nice. 

NOTE: the only difference between this code and the one I use is it's tabbed. check here for the exact script i was running:

http://wallacethewalrus.ca/WMWaterlv.txt

 

EDIT: YES! DSos, being the awesome person he is, saved my original script when I sent it to him to use. I now have a working script (beside some graphics glitches)

So if anyone could tell me why this script works fine, but not the other one I will love you forever!

Scriptname WMWaterlv extends ObjectReference  
{Script to determine if both valves are closed and then lower water level}
 
 
ObjectReference Property Valve1  Auto  
ObjectReference Property Valve2  Auto  
ObjectReference Property Water  Auto
Sound Property Drain  Auto
ObjectReference Property Mist  Auto 
;Here we name our effect 
ObjectReference Property Mist2  Auto 
ObjectReference Property Exit  Auto
ObjectReference Property kDest Auto
ObjectReference Property kDest2 Auto
 
 
int Value1
int Value2
int Full
;Names values for state of valves later
 
Event OnCellLoad()
     Value1 = 0
     Value2 = 0
    Full = 1
     Exit.lock()
     Mist.Disable()
     Mist2.disable()
EndEvent
 
Event OnActivate(ObjectReference akActionRef)
   If akActionRef == Valve1
      If Value1 == 1
         Value1 = 0
         Mist.Disable()
 
      Elseif Value1 == 0
        Value1 = 1
            Mist.Enable()
      EndIf
   Endif
 
   If akActionRef == Valve2
      If Value2 == 1
         Value2 = 0
             Mist2.Disable()
 
       Elseif Value2 == 0
           Value2 = 1
             Mist2.enable()
       EndIf
Endif
 
   If Value1 == 1
       If Value2 == 1
              Water.TranslateToRef(kDest2, 50.0) ; 50 is the speed value
                Game.DisablePlayerControls()
                  Utility.Wait(5)
                 Water.disable()
                Full = 0
                Exit.Lock(false)
              Game.EnablePlayerControls()
       Endif
 
   Elseif Value1 == 0
          If Value2 == 0
                Water.enable()
                Game.DisablePlayerControls()
                 Water.TranslateToRef(kDest, 50.0)
                  Full = 1
                Exit.Lock()
             Game.EnablePlayerControls()
          Endif
   Endif
EndEvent

Edited by Walrus
Link to comment
Share on other sites

Sadly i can confirm thats not it. Through testing and messing around, it seems that in the old script, ANYTIME both Values are the same, the parts about PlayerControls and Wait are run. Whereas in the new script, It seems anytime a value is changed, it runs those same parts (and sometimes the door too). But it never messes with the water plane moving up and down and the other one enabling/disabling. That only runs when its supposed to. To me, this makes no sense at all.

Link to comment
Share on other sites

That could happen if you were using a dirty save game. Script values are saved in a save game, and changing the script messes it up. Because what is in the save game ALWAYS over-rides what is in your mod.

 

So, all objects work at some time? (Mist, water)

Link to comment
Share on other sites

I used a completely clean install and new game. I had Skyrim the newest update and a very stripped down version of my mod. Brought it down to one room with 2 custom scripts. So it can't be a dirty save game.

 

And yes. The mist and Water and Lock door parts all work perfectly. They never go out of sync or fire when they shouldn't. But the Disableplayer controls, Wait and Door activate do. 

 

So how is the script only running half of the things? I don't get that.

 

Edit: I just remembered. I also set all the values to what i want on CellLoad. So all the values are reset when it loads up.

Edited by Walrus
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...