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

[REQ] Help with a "lever" script


TheWinterhawk
 Share

Recommended Posts

I would appreciate a little help with a lever script. I'll try to give as much info as possible first, and then show my script so far:

I have chosen to use DwePipeValve01 as an activator. (This is actually a trap activator, which has already two scripts attached, one being responsible for animations, and one script that offers two states: active and inactive.) Therefore the vavle can visually be turned to the left or right on activation, thus putting it into one of two states (see above).

I wanted to make use of this DwePipeValve01 to be an activator for a water tap. My picture is, that I have four elements (waterfall, splashing water particles, churning water particles and an adequate soundobject). I have placed the objects and created a new script in the creation kit with "extends ObjectReference". There I have created new properties for each element (going Element1, Element2,...). I have also created a property for the tap. All 5 property values have been properly linked to the reference objects in the (same) cell.

The four water elements were checked "initially disabled" in the edit section, because when the player arrives at the scene, the water tap should be "closed".

Now, I sought the player to being able to activate the tap (which for a reminder is the DwePipeValve01), so that the four water elements would automatically be activated and became visible (enabled OnActivate).

I have written a script and compiled it in the CK, and it finally showed no error messages, but ingame the set doesn't work. So, I have no clue, what I have to do now. (I'm not so advanced in scripting, have only limited experience and even that is quite some time ago. I have not worked with the ck before this project. Today I managed to complete my first little quest script. So don't expect too much!) Maybe, someone can point to the problem or correct my tap script.

Here we go:

Scriptname BathroomTap extends ObjectReference


ObjectReference Property Tap auto


ObjectReference Property Element1 auto


ObjectReference Property Element2 auto


ObjectReference Property Element3 auto


ObjectReference Property Element4 auto



     Event OnActivate(ObjectReference akActivateRef)


          If (GetState() == "Active")

               Element1.Enable()

               Element2.Enable()

               Element3.Enable()

               Element4.Enable()

          Else

               Element1.Disable()

               Element2.Disable()

               Element3.Disable()

               Element4.Disable()	

          EndIf	


     EndEvent

I hope the information is sufficient. So, what can I do now to get my script work? Thanks in advance. Meanwhile I'm going to test out the proper functions of my bed and see you tomorrow. :wave:

Edit: Ohhh nooooeees, it destroys my scripting structure... bad reply window... bad... :stare:

Edited by WillieSea
Inserted Code box
Link to comment
Share on other sites

Well, for starters, this does not look like Oblivion scripting. It looks like Skyrim scripting in Papyrus. So I will base my response on that. ;)

My guess here is your not setting the state in this script. So it does not work. The state does not trnsend to other scripts on the same object, it is local to that script only.

If you want to use two scripts you might want to think about using a global variable instead, to control when the objects are on and off.

Or, make only one script with everything in that one script. That way the state would work.

Link to comment
Share on other sites

Thanks for inserting the code box, Willie.

Yes, it is Skyrim scripting, sorry for not mentioning. :/ (I was searching for results in the "Skyrim section" and when I started a new topic in "scripting section" I was not aware, that this section is not only for Skyrim.)

Ah, so the variables only work locally. Okay, then I'll try to find out how to set global variables in Papyrus/CK or merge the two scripts into one. As for the two scripts in one (which I thought about first, too) I was not sure, because of the extends type. Let's see, what I can do. Thanks for your help so far.

EDIT: OK, I made the script work by merging it with the other one. That seemed to be the easiest way. Made some adjustments to the single elements to make it more immersive in gameplay and it works pretty fine, thanks for the hint again, Willie! =)

Edited by TheWinterhawk
Link to comment
Share on other sites

This is the 'Oblivion' forum. There is a 'papyrus 101' thread in the Skyrim forum, that is why I mentioned it. :)

If you post the scripts, I am sure we can get them put together. I can also show you how to use global variables if that is what you would like to do instead. But you would have to add the global variable to both scripts, so it may be easer to just combine them into one script of your own. And only have that one script on the lever.

EDIT:

Sorry, I am tired from work and did not notice the blarring orange text of your own 'EDIT'. glad you got it working! :thumbsup:

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