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

Combination Lock Hint Objects Oddities


DsoS
 Share

Recommended Posts

I have this script that I have been working on, on and off, for the past 10 months or so. The random number gen works, however the hint objects don't work correctly.

 

Hints 6-9 works

Hints 1-5 doesn't work

 

"work" means that they are disabled when the random number is correct.

 

This is still a WIPz and not all things are setup yet, but the Hint Objects is my current project on this script

 

Issue here is the "Hint Objects"

[code]
ScriptName aaDSoSRandomComboLock extends ObjectReference
 
{Adds a functional 9-button combo lock in game to unlock secret locations or unlock/open gates, etc.
Requires 9 buttons of any type, in a T9 keypad configuration, as such:
123
456
789}
 
Import Game
Import Utility
Import Debug
 
;Top Buttons
ObjectReference Property Button1TopLeft Auto
ObjectReference Property Button2TopCenter Auto
ObjectReference Property Button3TopRight Auto
 
;Middle Buttons
ObjectReference Property Button4MiddleLeft Auto
ObjectReference Property Button5MiddleCenter Auto
ObjectReference Property Button6MiddleRight Auto
 
;Bottom Buttons
ObjectReference Property Button7BottomLeft Auto
ObjectReference Property Button8BottomCenter Auto
ObjectReference Property Button9BottomRight Auto
 
;Top Buttons GlobalVariable
GlobalVariable Property Button1TopLeftGBLVAR Auto
{Button GlobalVariables MUST be scripted on all buttons! OnActivate(MyButton) GlobalVariableName.SetValue(1) or whatever!}
GlobalVariable Property Button2TopCenterGBLVAR Auto
GlobalVariable Property Button3TopRightGBLVAR Auto
 
;Middle Buttons GlobalVariable
GlobalVariable Property Button4MiddleLeftGBLVAR Auto
GlobalVariable Property Button5MiddleCenterGBLVAR Auto
GlobalVariable Property Button6MiddleRightGBLVAR Auto
 
;Bottom Buttons GlobalVariable
GlobalVariable Property Button7BottomLeftGBLVAR Auto
GlobalVariable Property Button8BottomCenterGBLVAR Auto
GlobalVariable Property Button9BottomRightGBLVAR Auto
 
ObjectReference Property Light01 Auto
{A light in front of each button to let the player know what button they have selected already.}
ObjectReference Property Light02 Auto
ObjectReference Property Light03 Auto
ObjectReference Property Light04 Auto
ObjectReference Property Light05 Auto
ObjectReference Property Light06 Auto
ObjectReference Property Light07 Auto
ObjectReference Property Light08 Auto
ObjectReference Property Light09 Auto
 
ObjectReference Property HintObject01 Auto
{Gives the player a hint for the button combo required. Best when placed AWAY from the Main buttons. This is NOT necessary to have, however since the button combos are randomly generated each time this is recommended!}
ObjectReference Property HintObject02 Auto
ObjectReference Property HintObject03 Auto
ObjectReference Property HintObject04 Auto
ObjectReference Property HintObject05 Auto
ObjectReference Property HintObject06 Auto
ObjectReference Property HintObject07 Auto
ObjectReference Property HintObject08 Auto
ObjectReference Property HintObject09 Auto
 
int MyRunCheck1
int MyRunCheck2
int MyRunCheck3
 
Bool RandNum01
Bool RandNum02
Bool RandNum03
Bool RandNum04
Bool RandNum05
Bool RandNum06
Bool RandNum07
Bool RandNum08
Bool RandNum09
 
int CorrectAttempt
int MyRandNum1
int MyRandNum2
int MyRandNum3
int WrongAttemptCnt
;How many times has the Player choosen the wrong button?
 
Spell Property WrongAttemptSpell Auto
{The spell to cast at the player after the Wrong Attempts}
 
ObjectReference Property SpellSource Auto
{The Source that will cast the Spell}
 
Event OnInit()
                RegisterForSingleUpdate(5.0)
EndEvent
 
Auto State Initialize
                Event OnInit()
                                ;Randomize and Select 3 buttons for the button combo
                                if MyRunCheck1 == 0
                                                MyRandNum1 = RandomInt(1, 9)
                                                if MyRandNum1 == 9
                                                                RandNum09 = True
                                                ElseIf MyRandNum1 == 8
                                                                RandNum08 = True
                                                ElseIf MyRandNum1 == 7
                                                                RandNum07 = True
                                                ElseIf MyRandNum1 == 6
                                                                RandNum06 = True
                                                ElseIf MyRandNum1 == 5
                                                                RandNum05 == True
                                                ElseIf MyRandNum1 == 4
                                                                RandNum04 == True
                                                ElseIf MyRandNum1 == 3
                                                                RandNum03 == True
                                                ElseIf MyRandNum1 == 2
                                                                RandNum02 == True
                                                ElseIf MyRandNum1 == 1
                                                                RandNum01 == True
                                                EndIf
                                                Notification("My 1st Number Picked is: " + MyRandNum1)
                                                MyRunCheck1 + 1
                                EndIf
             
                                if MyRunCheck2 == 0
                                                MyRandNum2 = MyRandNum1                                                
                                                While MyRandNum2 == MyRandNum1
                                                                MyRandNum2 = RandomInt(1, 9)            
                                                EndWhile
                                                                     
                                                if MyRandNum2 == 9
                                                                RandNum09 = True
                                                ElseIf MyRandNum2 == 8
                                                                RandNum08 = True
                                                ElseIf MyRandNum2 == 7
                                                                RandNum07 = True
                                                ElseIf MyRandNum2 == 6
                                                                RandNum06 = True
                                                ElseIf MyRandNum2 == 5
                                                                RandNum05 == True
                                                ElseIf MyRandNum2 == 4
                                                                RandNum04 == True
                                                ElseIf MyRandNum2 == 3
                                                                RandNum03 == True
                                                ElseIf MyRandNum2 == 2
                                                                RandNum02 == True
                                                ElseIf MyRandNum2 == 1
                                                                RandNum01 == True
                                                EndIf
                                                Notification("My 2nd Number Picked is: " + MyRandNum2)
                                                MyRunCheck2 + 1
                                EndIf
 
                                if MyRunCheck3 == 0
                                                MyRandNum3 = MyRandNum2
                                                While (MyRandNum3 == MyRandNum2) || (MyRandNum3 == MyRandNum1)
                                                                MyRandNum3 = RandomInt(1, 9)
                                                EndWhile
                                if MyRandNum3 == 9
                                                RandNum09 = True
                                ElseIf MyRandNum3 == 8
                                                RandNum08 = True
                                ElseIf MyRandNum3 == 7
                                                RandNum07 = True
                                ElseIf MyRandNum3 == 6
                                                RandNum06 = True
                                ElseIf MyRandNum3 == 5
                                                RandNum05 == True
                                ElseIf MyRandNum3 == 4
                                                RandNum04 == True
                                ElseIf MyRandNum3 == 3
                                                RandNum03 == True
                                ElseIf MyRandNum3 == 2
                                                RandNum02 == True
                                ElseIf MyRandNum3 == 1
                                                RandNum01 == True
                                EndIf
                                Notification("My 3rd Number Picked is: " + MyRandNum3)
                                MyRunCheck3 + 1
                                EndIf
 
                                if RandNum09 == True
                                                HintObject09.Disable()
                                EndIf
 
                                if RandNum08 == True
                                                HintObject08.Disable()
                                EndIf
 
                                if RandNum07 == True
                                                HintObject07.Disable()
                                EndIf
 
                                if RandNum06 == True
                                                HintObject06.Disable()
                                EndIf
 
                                if RandNum05 == True
                                                HintObject05.Disable()
                                EndIf
 
                                if RandNum04 == True
                                                HintObject04.Disable()
                                EndIf
 
                                if RandNum03 == True
                                                HintObject03.Disable()
                                EndIf
 
                                if RandNum02 == True
                                                HintObject02.Disable()
                                EndIf
 
                                if RandNum01 == True
                                                HintObject01.Disable()
                                EndIf
 
                                Wait(3.0)
                                ;Give 3 seconds to ensure that all HintObjects and other stuff has been completed.
 
                                GoToState("Waiting")
 
                EndEvent
EndState
 
State Waiting
                Event OnUpdate()
                                ;Combo Buttons stuff here
                                if RandNum09 == True && Button1TopLeftGBLVAR.GetValue() == 1 ; I THINK THAT THE STUFF HERE IS WRONG... RANDNUM 9 AND THE TOP LEFT BUTTON??? I THINK IT SHOULD BE BOTTOM RIGHT BUTTON
                                                Light09.Enable()
                                                CorrectAttempt + 1
                                ElseIf RandNum09 == False && Button1TopLeftGBLVAR.GetValue() == 1
                                                WrongAttemptCnt + 1
                                EndIf
 
                                If RandNum08 == True  && Button2TopCenterGBLVAR.GetValue() == 1
                                                Light08.Enable()
                                                CorrectAttempt + 1
                                ElseIf RandNum08 == False && Button2TopCenterGBLVAR.GetValue() == 1
                                                WrongAttemptCnt + 1
                                EndIf
 
                               
                               
                                ;Wrong Attempt Stuff
                                if WrongAttemptCnt == 3
                                                WrongAttemptSpell.Cast(SpellSource,GetPlayer())
                                                WrongAttemptCnt = 0
                                EndIf
 
                EndEvent
EndState
[/code]
Link to comment
Share on other sites

That is in there, 2 locations:

 

if MyRunCheck2 == 0
MyRandNum2 = MyRandNum1                                                
While MyRandNum2 == MyRandNum1
MyRandNum2 = RandomInt(1, 9)            
EndWhile

AND

if MyRunCheck3 == 0
MyRandNum3 = MyRandNum2
While (MyRandNum3 == MyRandNum2) || (MyRandNum3 == MyRandNum1)
MyRandNum3 = RandomInt(1, 9)
EndWhile

 

This is what I've been dealing with.

 

The game save is clean, doesn't have this mod on it. I've tried a whole new game save from the start

 

The objects itself, I've tried 4 different types of static objects, lights, etc.

 

Its driving me crazy!

Edited by DsoS
Link to comment
Share on other sites

So you do!  Therefore it generates a new number for that button  - I see :) and you check it for the third being a duplicate as well - excellent!  What I'm not seeing is ... like you, why the 6 thru 9 would work and not the 1 thru 5 ... will ponder some more :)

Link to comment
Share on other sites

Have you added Debug.Notification("Hitting hint true") for any of your hint objects ( 1 - 5) and maybe doing a Debug.Notification("Answer is:" +  MyRandNum1 + "," + MyRandNum2 etc..) So you know what the result of your random is? - and did it hit that object at all?

Link to comment
Share on other sites

I have notifications setup for:

Notification("My 1st Number Picked is: " + MyRandNum1)

Notification("My 2nd Number Picked is: " + MyRandNum2)

Notification("My 3rd Number Picked is: " + MyRandNum3)

 

But not the actual Disable section. I'll try that and see, can't believe that I didn't think about that further LOL

Link to comment
Share on other sites

Put a debug here:

 

if RandNum04 == True   

    Debug.Notification("It's getting in here")                                             

     HintObject04.Disable()    

      Debug.Notification(HintObject04.IsDisabled())  ;will show true or false in notification                      

EndIf                        

 

** just to see if it hit the if statement at all          

Edited by Leianne
Link to comment
Share on other sites

Sorry ... what?  It IS hitting the IF statement?  You're getting "It's getting in here" in your notification?

 

Never mind ... LOL got messed up on your "yes it is" ... didn't realize you were referring to it IS weird! LOL

Edited by Leianne
Link to comment
Share on other sites

Hmmm I would do a Debug.Notification between every ELSEIF where you set the RandNum to true ... to see if it's setting them FOR ALL of them.

 

eg:

ElseIf MyRandNum2 == 2                                                                

      RandNum02 == True    

      Debug.Notification(RandNum02)                                            

ElseIf MyRandNum2 == 1                                                                

      RandNum01 == True     

       Debug.Notification(RandNum01)                                           

EndIf

 

** sorry to clarify ... to see if it's setting them FOR ALL THE ONES THAT ARE SUPPOSED TO BE SET :)

ie: you'll get 8 FALSE and 1 TRUE for each set of checks

Edited by Leianne
Link to comment
Share on other sites

Okay ... one of the screenshots shows a 'false' generated ... given that the pointer should never enter an IF statement unless true .. that one is a tad suspicious ... let me go over it again.

 

Seems it's showing FALSE for when that ISN'T the number ... ie: MyRandNum3 == FALSE .. which is understandable.  If that's the case, I'm not seeing where the notification is for each ELSEIF statement ... need to go over your code again, will copy n' paste it to notepad so I can refer back to it. gimme a min :)

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