thythythy3 Posted January 6, 2011 Share Posted January 6, 2011 Hello, I wish to make an object script with more than one layer deep in menus but I can't seem to figure it out. This is my script so far, edited.I used the stars "*" to black out parts of the code that are ok. I'm just looking for structure, I can worry about the content.Thanks you guys. Scriptname ***** Short controlvar Short button Short button2 Short button3 Short button4 Begin OnActivate MessageBox "Create your ****.", "****", "*****", "*******" Set controlvar to 1 End Begin GameMode If (controlvar == 1) set button to GetButtonPressed If (button == -1) return Elseif (button == 0) Messagebox "You ***********?", "*****", "*****" set button2 to getbuttonpressed if (button2 == -1) return Elseif (button2 == 0) if (player.getitemcount ************* == 0) Message "*********" elseif (player.getitemcount *********** == 0) Message "**********" elseif (player.getitemcount ******** == 0) Message "********" elseif (player.getitemcount ********* == 0) message "*******" elseif (player.getitemcount ******* == 0) Message "************" else set controlvar to 2 endif Elseif (button2 == 1) set controlvar to 0 endif Elseif (button == 1) Messagebox "************************?", "*****", "**********" set button3 to getbuttonpressed if (button3 == -1) return Elseif (button3 == 0) if (player.getitemcount ******************* == 0) Message "*******************" elseif (player.getitemcount ******************* == 0) Message "*******************" elseif (player.getitemcount ******************* == 0) Message "*******************" elseif (player.getitemcount ******************* == 0) message "*******************" elseif (player.getitemcount ******************* > 2) message "*******************" else set controlvar to 2 endif Elseif (button3 == 1) set controlvar to 0 endif Elseif (button == 2) Messagebox "*******************?", "*******************", "*******************" set button4 to getbuttonpressed if (button4 == -1) return Elseif (button4 == 0) if (player.getitemcount ******************* == 0) Message "*******************" elseif (player.getitemcount ******************* == 0) Message "*******************" elseif (player.getitemcount ******************* == 0) Message "*******************" elseif (player.getitemcount ******************* == 0) message "*******************" else set controlvar to 2 endif Elseif (button4 == 1) set controlvar to 0 endif endif Elseif (controlvar == 2) endif end Link to comment Share on other sites More sharing options...
theuseless Posted January 6, 2011 Share Posted January 6, 2011 (edited) Ok, first, it would be nice if you could be creative enough to make up something to submit with flavor instead of ******, not to be negative. I have read and tried to understand your script. I don't understand what the script is supposed to do after the first check for controlvar. It appears that this script is going to make the player do something when that is hit (== 2). I would test the script out with the most basic of variables. I personally employ a disabled quest that will run the script when activated and then disable it when all conditions are met. I will describe this process for you to dissect and use as you wish. I have made this script for activators, you could use the bank vault mod or any glass display case that you choose. I will release this as a mod as soon as I'm done writing this post. The first thing for you to do is to make a new quest. Name it something unique and leave the priority at 0. Next create the following scripts in order of posting: brb Edited January 6, 2011 by theuseless Link to comment Share on other sites More sharing options...
theuseless Posted January 6, 2011 Share Posted January 6, 2011 (edited) Sorry, this script is ripped from my mod and you might have to wait for a modders' resource for a min. You must make two quests, in my case, I have made one that is for the variables and to activate the bank vault (glass display case :sad:) The first quest I made was called "tUL665TharnsteinMain". That has the first script attached to it when you make the script. The second quest I made was the quest for this particular container, called "tUL665tharnstGuestLivingContainerQuest3" After I made these quests, I was able to make the first and second scripts, then I was able to compile the rest of the scripts in order just fine. Ok, so working scripts with explanations: first script to make, place it on the first quest I made, make sure that the quest is not Start Game Enabled. scn tUL665TharnsteinMQScript :these are variables to be checked by my mod's quests, infantile in progress short doOnce short diningCases short diningCases1 short diningCases2 short diningCases3 ;this is the short that I will be using in this short diningCases4 short diningCases5 short diningCases6 short diningCases7 short VelSkullCount After you have attached a similar style code, with your own names (or not) for the shorts. Just be sure to make new names for the quests and scripts. I am posting this directly from my mod so please show me the respect that I show to you by sharing (change names of scripts and quests please). The second quest that I set up was for the actual container quest. The above script is just to contain variables. The next piece of code is where I used the "tUL665tharnstGuestLivingContainerQuest3" quest. To change the name of the quest, just look for all the names with the tUL665 prefix and make them your own names. When I reverse engineer, I like to keep track of all my changed names in a notepad file. That way you know what to change the name to in Notepad ++ with Oblivion syntax. I will check back and make sure that you are able to use this if I can't get it into a working mod resource. Second script: Scn tUL665tharnstGuestLivingContainerQuestScript3 short busy short pause short opener short word short word2 short word3 short word6 short word5 short word4 short clicked short correctCount short moneyclip float fQuestDelayTime begin gameMode ;================================ if (busy == 1) ;this parameter is set to 1 by the activator script set pause to -1 set busy to 0 endif ;------------------------------------------------- ;reset conditions here (re-initialize). This is used to stop the script and set the parameters to 0 when the script completes ;you can also add a re-init to the first block of begin gamemode if you plan on teleporting or ending the script in a similar fashion if (pause == 0) stopquest tUL665tharnstGuestLivingContainerQuest3 set busy to 0 set pause to 0 set opener to 0 set word to 0 set word2 to 0 set word3 to 0 set word4 to 0 set word5 to 0 set word6 to 0 set clicked to 0 set correctCount to 0 set moneyclip to 0 return ;------------------------------------------------ ;this block starts the options elseif (pause == -1) messagebox, "You see some disks on the handle. They look sharp. Do you wish to move them?" "I'm outta here", "Turn top disk" set pause to 1 endif If (pause == 1) set opener to getButtonPressed if (opener == -1) return else set pause to 2 endif endif ;------------------------------------------------- ;this block says that if "i'm outta here" is enabled, the script is terminated (the reinitialize block at the top). Nothing will happen if (pause == 2) if (opener == 0) set pause to 0 return endif ;------------------------------------------------- ;opener was the first messagebox variable, above, that when set to 1 says that you wish to try the lock if (opener == 1) && (clicked == 0) messagebox, "As they spin they click. How many clicks do you wish to move the top disk?", "0", "1", "2" "3", "4", "5" "6", "7", "8", "9" set clicked to 1 endif if (clicked == 1) set word to getButtonPressed if word == -1 return else set clicked to 2 endif endif ;------------------------------------------------- ;this is the second choice, which will set the parameter, short word2, the next amount of clicks turned. if (clicked == 2) messagebox, "choices", "0", "1", "2" "3", "4", "5" "6", "7", "8", "9" set clicked to 3 endif if (clicked == 3) set word2 to getButtonPressed if word2 == -1 return else set clicked to 4 endif endif ;------------------------------------------------- ;the third word, word2 (word, word1, word2) is set here if (clicked == 4) messagebox, "choices", "0", "1", "2" "3", "4", "5" "6", "7", "8", "9" set clicked to 5 endif if (clicked == 5) set word3 to getButtonPressed if word3 == -1 return else set clicked to 6 endif endif ;------------------------------------------------- ;you can make any number of variables within the blocks. I am using more messagebox scripting, but you can make any checks or flag changes, etc. if (clicked == 6) messagebox, "choices", "0", "1", "2" "3", "4", "5" "6", "7", "8", "9" set clicked to 7 endif if (clicked == 7) set word4 to getButtonPressed if word4 == -1 return else set clicked to 8 endif endif ;------------------------------------------------- ;these are setting parameters to be checked later, they will all resolve at once if (clicked == 8) messagebox, "choices", "0", "1", "2" "3", "4", "5" "6", "7", "8", "9" set clicked to 9 endif if (clicked == 9) set word5 to getButtonPressed if word5 == -1 return else set clicked to 10 endif endif ;------------------------------------------------- ;the player is setting their choices here, you will check to see if these choices are correct or valid. I'm using 0 as a beginning for the messagebox for ease of changing lock combos in the next block if (clicked == 10) messagebox, "choices", "0", "1", "2" "3", "4", "5" "6", "7", "8", "9" set clicked to 11 endif if (clicked == 11) set word6 to getButtonPressed if word6 == -1 return else set clicked to 12 endif endif ;------------------------------------------------- ;now for the fun part. This will determine if the choices the players made are valid enough ;you can make more of the above blocks, with making each modify the pause or clicked short, then add more of the blocks below to correspond and set the correct count higher or lower, depending on your cruelty if (clicked == 12) if word == 4 set correctCount to (correctCount +1) endif if word2 == 2 set correctCount to (correctCount +1) endif if word3 == 0 set correctCount to (correctCount +1) endif if word4 == 4 set correctCount to (correctCount +1) endif if word5 == 2 set correctCount to (correctCount +1) endif if word6 == 0 set correctCount to (correctCount +1) endif endif ;------------------------------------------------- ;now here you can make it call whatever you want, >= 4, etc. I got lazy and stopped making the script pause between functions with the pause or clicked shorts. I did this because no new menus were called. if (clicked == 12) && (correctCount == 6) set tUL665TharnsteinMain.diningCases3 to 1 ;this is to make the case recognize that it has the right combination set pause to 0 return ;------------------------ ;this will make it so that if you have an incorrect amount, it will do another effect, from the scripting tutorial that showed me the process of using messagebox and message elseif (clicked == 12) && (correctCount != 6) messagebox, "The disks reset. As they reset, they cut you. The cut has a strange feeling, you didn't notice untill now" If (Player.GetItemCount "gold001") >= 100 Player.RemoveItem "gold001" 100 Set pause to 0 Return Else Set moneyclip to Player.GetItemCount "gold001" Player.RemoveItem "gold001" moneyclip Player.AddItem "gold001" 25 Set pause to 0 return EndIf else return endif ;------------------------------------------------- else return endif ;================================ end The previous script shows working scripting ripped from my mod. You can reset the variables to whatever you want. My generic lock is 420420. Change those variables and you can make it lock to anything that you want to, provided that you make it have unique scriptnames, quest names and new lock variables. You next need to make a container, door or whatever you wish to lock. I haven't modified the scripts enough yet to make the player automatically activate it, but if you activate the container/door again, you will be able to access it. I am working on this problem now, and will release the resource when I get it down. All I need to do is make a self disable code on the first quest script that will activate the container with the player if the combo is right. I will also make exceptions so that certain npc's can open it at certain points of the quest. So, you got a new, unique container. My script looks like this: scn tUL665tharnstGuestLivingContainerScript3 short doOnce Begin OnActivate if (tUL665TharnsteinMain.diningCases3 == 0) ;if you haven't entered the proper combo startquest tUL665tharnstGuestLivingContainerQuest3 set tUL665tharnstGuestLivingContainerQuest3.busy to 1 set tUL665tharnstGuestLivingContainerQuest3.fQuestDelayTime to 0.1 set tUL665TharnsteinMain.diningCases3 to 0 elseif (tUL665TharnsteinMain.diningCases3 == 1) && (doOnce ==0) ;or if you have the right combo, open it activate set doOnce to 1 elseif (tUL665TharnsteinMain.diningCases3 == 1) && (doOnce ==1) ;now you can close the object. Make sure to make unique scripts and quest number 2 if you plan on using more than one combo lock activate set doOnce to 0 set tUL665TharnsteinMain.diningCases3 to 0 endif end begin onReset reset3dstate ;closes the case on reset set doOnce to 0 set tUL665TharnsteinMain.diningCases3 to 0 end That should work for you to learn. All you need to do is replace or delete the tUL665 prefix from my codes to make them testable. I'm sorry that I don't have the time now to make the resource, but I have a lot of scripting to finish and the new meshes from the bank vault are inspiring me to finish this code, make it so that the player activates the ref upon completion of the code. I might be able to write it into the second, long, quest script. That would probably be the most effective and least draining on the performance. I originally came up with the method after reading some other tutorials. It made it so that I can add begin gamemode scripts blocks without running them every check. It makes the performance on my laptop (which runs oblivion on low (not lightbright) pick up faster frame rates. Hope this helps,theuseless Edited January 6, 2011 by theuseless Link to comment Share on other sites More sharing options...
theuseless Posted January 6, 2011 Share Posted January 6, 2011 Oh yeah, the bank vault is Strotis new meshes bank vault http://www.tesnexus.com/downloads/file.php?id=35494 The scripting tutorial with the messagebox function: Scripting Tutorial: My Second Script http://cs.elderscrolls.com/constwiki/index.php/Scripting_Tutorial:_My_Second_Script And then check out Tutorials Abound http://www.thenexusforums.com/index.php?/topic/182360-tutorials-abound/page__p__1578084__hl__%2Btutorials+%2Babound__fromsearch__1#entry1578084 The last link is a simple starter for people to get into modding. I have some cool links like a tutorial for scripting an npc to lower a drawbridge/portcullis for you. If you got a start from my rant, please give me kudos. I have spent some time on this as it is one of the few things I can help on here. If my drunken babble confuses you or makes me sound dumb, I will try to help you out as I would like to release this information as a resource. I would credit you and make others credit you as a playtester. that's all I can muster,theuseless Link to comment Share on other sites More sharing options...
thythythy3 Posted January 6, 2011 Author Share Posted January 6, 2011 That makes perfect sense. Thanks for your help. I thought that the layers might need a different approach. I will incorporate that technique into my mod. Kudos Link to comment Share on other sites More sharing options...
theuseless Posted January 7, 2011 Share Posted January 7, 2011 Glad to help, if you need more help on this particular issue, let me know. It sounds like you found your solution with the short called pause. Link to comment Share on other sites More sharing options...
Recommended Posts