Hangman4358 Posted June 14, 2012 Share Posted June 14, 2012 I feel like I ask questions left and right, But hopefully someone can help me. I really do appreciate all the help people have given me so far. ok, so here is the set up. I have added a pillar puzzle to my dungeon, and it works perfectly (thanks to a tutorial i found online). But me being me, I am not satisfied with just adding the head with the symbol to show which sign each pillar should be. So I decided it would be cool to have a wall sconce behind each pillar and when the pillar is in the correct position I enable a light and some embers and disable an ash pile. Then, when the pillar is in the wrong position I disable the light and embers and enable just an ash pile. Here is the problem. I have no clue what I am doing really. My plan is this, attach a script to each pillar that checks if the pillar is in the solved state set in the pillar script. If it is then enable things, if it isn't then disable them. So I have this: Scriptname OAQ01PuzzlePillarLightSwitch extends ObjectReference ObjectReference Property SlovedLight Auto ObjectReference Property HeavyEmbers Auto ObjectReference Property NoEmbers Auto if (solveState == true) SlovedLight.Enable() HeavyEmbers.Enable() NoEmbers.Disable() else SlovedLight.Disable() HeavyEmbers.Disable() NoEmbers.Enable() endif Now, I have no clue about how to go about if the pillar actually is in the solved state. solveState is the variable from the main pillar script form Bethesda. I am also getting an EOF error for the if statment when I try and save. Which of course I expected seeing as how i have nothing pointing to that variable yet. So, how can I see if the pillar is in the solved state? If only I were a scripting person and not a visual design person... Thanks for any and all help. Link to comment Share on other sites More sharing options...
steve40 Posted June 15, 2012 Share Posted June 15, 2012 (edited) Hi Hangman, can you point me to the tutorial so that I can see how the puzzle is set up. Tx. Edited June 15, 2012 by steve40 Link to comment Share on other sites More sharing options...
Hangman4358 Posted June 15, 2012 Author Share Posted June 15, 2012 http://skyrim.offbeatgeek.com/puzzle1.html Here you go. All the scripts are already on these pieces in the CK, looks like they set it up so the level designers could set them up quickly without having to get coder guys on it every time they wanted to use one. Thanks for the help again Steve. There is a bunch of stuff going on in the scripts on the pillar and the lever and I tried to see what was happening but I really have no clue... I have also pasted both the pillar and lever script in full below. Pillar scriptName defaultPuzzlePillarNoFurn extends ObjectReference { - User can use properties to set the pillar's initial state and solve state - The script first checks to see if the initial state is the same as the solve state - When the pillar is activated, the pillar rotates to a new position and then checks to see if its solved - If pillar is solved, the script increments neccessary vars in the defaultPillarPuzzleLever.psc - Each pillar needs to have its linkedRef point to the lever where the defaultPillarPuzzleLever.psc lives } import debug import utility bool pillarSolved bool doOnce defaultPillarPuzzleLeverNoFurn myLinkedRef int property initialState auto { This is the position the pillar starts out in. 1 = Position 1 (eagle) 2 = Position 2 (snake) 3 = Position 3 (whale) Position 1,2,3 refer to the havok animations } int property solveState auto { This is the position the pillar needs to be in to be considered solved. 1 = Position 1 (eagle) 2 = Position 2 (snake) 3 = Position 3 (whale) Position 1,2,3 refer to the havok animations } Event OnCellLoad() myLinkedRef = GetLinkedRef() as defaultPillarPuzzleLeverNoFurn ;account for case where initialState and solveState are equal in the beginning if(!doOnce) if (initialState == solveState) myLinkedRef.numPillarsSolved = myLinkedRef.numPillarsSolved + 1 pillarSolved = true endif ;now move the pillar into initialState if (initialState == 1) ;no animation gotoState("position01") elseif (initialState == 2) playAnimation("StartState02") gotoState("position02") elseif (initialState == 3) playAnimation("StartState03") gotoState("position03") endif doOnce = true endif endEvent ; Makes the pillar rotate to the next state and checks whether it is 'solved' as a result FUNCTION RotatePillarToState(int stateNumber, int animEventNumber) gotoState ("busy") if (solveState == stateNumber) ;trace(self + " pillar solved!") myLinkedRef.numPillarsSolved = myLinkedRef.numPillarsSolved + 1 pillarSolved = true elseif (pillarSolved == True) ;if the puzzle is solved and the door is open, then activate the linkedRef (lever) ;and set the puzzleSolved to false as well as the doorOpened if (myLinkedRef.puzzleSolved == true && myLinkedRef.doorOpened == 1) myLinkedRef.refActOnSuccess01.activate (myLinkedRef.puzzleDoorActivator) myLinkedRef.puzzleSolved = false myLinkedRef.doorOpened = false endif myLinkedRef.numPillarsSolved = myLinkedRef.numPillarsSolved - 1 pillarSolved = False endif playAnimationandWait("Trigger0" + animEventNumber, "Turned0" + animEventNumber) endFUNCTION STATE position01 EVENT onActivate (objectReference triggerRef) RotatePillarToState(2, 1) gotoState("position02") endEVENT endState STATE position02 EVENT onActivate (objectReference triggerRef) RotatePillarToState(3, 2) gotoState("position03") endEVENT endState STATE position03 EVENT onActivate (objectReference triggerRef) RotatePillarToState(1, 3) gotoState("position01") endEVENT endState STATE busy ; This is the state when I'm busy animating EVENT onActivate (objectReference triggerRef) ;do nothing endEVENT endSTATE lever scriptName defaultPillarPuzzleLever extends ObjectReference { - This script lives on the lever that controls each of the pillars - Each pillar should have its linkedRef point to the lever that this script is on } import debug import utility bool property puzzleSolved auto hidden bool property doorOpened auto hidden int property numPillarsSolved auto hidden objectReference property puzzleDoorActivator auto {The Parent Activator Dummy Ref for Door} int property pillarCount auto {Number of Puzzle Pillars} objectReference property refActOnSuccess01 auto {This ref is activated when puzzle is solved and lever is pulled} objectReference property refActOnFailure01 auto {This ref is activated when puzzle is not solved and lever is pulled} objectReference property refActOnFailure02 auto {This ref is activated when puzzle is not solved and lever is pulled} objectReference property refActOnFailure03 auto {This ref is activated when puzzle is not solved and lever is pulled} objectReference property refActOnFailure04 auto {This ref is activated when puzzle is not solved and lever is pulled} ;***************************************** Function doorOrDarts() ;if the puzzle is solved, activate the refActonSuccess01 ;else if the puzzle is not solved, activate the refActOnFailures (the dart traps ;in the case of BleakFallsBarrow01) ;wait(6) if (numPillarsSolved == PillarCount) puzzleSolved = true refActOnSuccess01.activate(puzzleDoorActivator) int openState = refActOnSuccess01.getOpenState() if (openState == 1 || openState == 2) doorOpened = true else doorOpened = false endif else puzzleSolved = false refActOnFailure01.activate (self as objectReference) refActOnFailure02.activate (self as objectReference) refActOnFailure03.activate (self as objectReference) refActOnFailure04.activate (self as objectReference) endif endFunction ;***************************************** Auto STATE Waiting EVENT onActivate (objectReference triggerRef) Actor actorRef = triggerRef as Actor gotoState("busy") if(actorRef==game.GetPlayer()) ;notification("just activated lever") doorOrDarts() else ;wait(3) doorOrDarts() endif gotoState("Waiting") endEVENT endState ;***************************************** STATE busy ; This is the state when I'm busy animating EVENT onActivate (objectReference triggerRef) ;do nothing endEVENT endState ;***************************************** Link to comment Share on other sites More sharing options...
steve40 Posted June 15, 2012 Share Posted June 15, 2012 (edited) 1) make a custom copy of the pillar script. Give it a new name.2) add your three properties (SlovedLight, HeavyEmbers, noEmbers) to the top of the new pillar script.3) Replace the entire OnCellLoad block with this: Event OnCellLoad() myLinkedRef = GetLinkedRef() as defaultPillarPuzzleLeverNoFurn ;account for case where initialState and solveState are equal in the beginning if(!doOnce) if (initialState == solveState) myLinkedRef.numPillarsSolved = myLinkedRef.numPillarsSolved + 1 pillarSolved = true endif ;now move the pillar into initialState if (initialState == 1) ;no animation gotoState("position01") elseif (initialState == 2) playAnimation("StartState02") gotoState("position02") elseif (initialState == 3) playAnimation("StartState03") gotoState("position03") endif if (pillarSolved == true) SlovedLight.Enable() HeavyEmbers.Enable() NoEmbers.Disable() else SlovedLight.Disable() HeavyEmbers.Disable() NoEmbers.Enable() endif doOnce = true endif endEvent 4) Replace the whole RotatePillarToState function with this: FUNCTION RotatePillarToState(int stateNumber, int animEventNumber) gotoState ("busy") if (solveState == stateNumber) ;trace(self + " pillar solved!") myLinkedRef.numPillarsSolved = myLinkedRef.numPillarsSolved + 1 pillarSolved = true SlovedLight.Enable() HeavyEmbers.Enable() NoEmbers.Disable() elseif (pillarSolved == True) ;if the puzzle is solved and the door is open, then activate the linkedRef (lever) ;and set the puzzleSolved to false as well as the doorOpened if (myLinkedRef.puzzleSolved == true && myLinkedRef.doorOpened == 1) myLinkedRef.refActOnSuccess01.activate (myLinkedRef.puzzleDoorActivator) myLinkedRef.puzzleSolved = false myLinkedRef.doorOpened = false endif myLinkedRef.numPillarsSolved = myLinkedRef.numPillarsSolved - 1 pillarSolved = False SlovedLight.Disable() HeavyEmbers.Disable() NoEmbers.Enable() endif playAnimationandWait("Trigger0" + animEventNumber, "Turned0" + animEventNumber) endFUNCTION 5) Use this new script on each pillar instead of the original one.6) Test thoroughly :) EDIT: I just added a bit more code to the RotatePillarToState function. Edited June 15, 2012 by steve40 Link to comment Share on other sites More sharing options...
Hangman4358 Posted June 15, 2012 Author Share Posted June 15, 2012 ok, thank you so much. I had thought about copying the pillar script but I did not know if that would cause screw ups with the lever part of the equation. It works great though. So, just so I can understand what happened here: From the looks of it you just added an if statement to the OnCellLoad for if the pillar is solved or not, disabling and enabling the different parts And then you just added the dis- and enabling of the pieces to the function when the pillar is solved or not. I thought this was going to be WAY more difficult. I did do some testing and tried to break the script and I was able to. When you have it solved and then start rotating pillars and then try to use the lever again and then rotate pillars again it goes funky, but I also tested this with the original script and it does the same thing so from the looks of it, it has a small bug in the original to begin with. Link to comment Share on other sites More sharing options...
Recommended Posts