How to make useable once lever?

Post » Fri Nov 16, 2012 5:37 pm

I need a lever that will open a door when you use it and if you use it again it will not do anything.
User avatar
sophie
 
Posts: 3482
Joined: Fri Apr 20, 2007 7:31 pm

Post » Sat Nov 17, 2012 3:03 am

state change or boolean condition
http://www.creationkit.com/State_Reference

for a boolean condition, set a variable with a default value of false, then run an if statement with a check to see if the value is false, then when the lever is activated, it changes the value to true, so that from then on the lever does nothing
User avatar
Killah Bee
 
Posts: 3484
Joined: Sat Oct 06, 2007 12:23 pm

Post » Fri Nov 16, 2012 12:46 pm

Doesn't most levers already include a "use-only-once" option in the properties menu?
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm

Post » Fri Nov 16, 2012 3:59 pm

http://www.creationkit.com/BlockActivation_-_ObjectReference
User avatar
Sun of Sammy
 
Posts: 3442
Joined: Mon Oct 22, 2007 3:38 pm

Post » Fri Nov 16, 2012 2:27 pm

Thanks. But it's too hard. Maybe i could just copy this thing from somewhere in the game? Did anybody remember any levers in the game that ca be used only once?
User avatar
WTW
 
Posts: 3313
Joined: Wed May 30, 2007 7:48 pm

Post » Fri Nov 16, 2012 2:26 pm

If you are just using a stock lever that uses the 'TrapLever' script, then you should be able to simply set a script property on that instance of the lever so that it has a maximum activation count of 1. Be very careful that you edit just your lever's parameters and not those of the base object (otherwise you could well break many parts of the game). You could do this by...

1. Drag a lever into your world and position as required.

2. From the cell view or the render window, right click on your lever and click 'Edit'. That should bring up the 'Reference' panel.

3. Tab across using the little left/right arrows to the 'Scripts' tab.

4. Select the TrapLever script and click on the Properties button - this lets you set the parameters that are fed to the scripts on that specific lever.

5. Select 'FiniteUse', and click edit value to override the default value. Then you can tick the box that this lever can only be used a limited number of times.

6. Select 'TriggerCount' and click the edit value, then set this to 1. This should limit the lever to one use only.

I've made a screenshot containing the instructions, but I don't think I can post it I'm afraid!
User avatar
Vincent Joe
 
Posts: 3370
Joined: Wed Sep 26, 2007 1:13 pm

Post » Fri Nov 16, 2012 3:00 pm

I did it before asking. Do not work.
User avatar
Fiori Pra
 
Posts: 3446
Joined: Thu Mar 15, 2007 12:30 pm

Post » Fri Nov 16, 2012 10:46 pm

You might need to make a completely new object. I had a similar issue with doors that needed to be open by default. Try making a new lever by duplicating the original and editing the base of the new one.
User avatar
Bambi
 
Posts: 3380
Joined: Tue Jan 30, 2007 1:20 pm

Post » Fri Nov 16, 2012 12:43 pm

Did not help. :confused: Maybe there is some options? amybe it should or should not be connecting with TarpLinker or something like this... Totaly can't understand. Did you ever see a lever like this in the game? Sombody told me that it is in dawnstar Dark Brotherhood hideout, but i can not find.
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Fri Nov 16, 2012 11:47 am

I'm at work so this is from the top of my head:

Event OnActivate(ObjectReference akActionRef)   Bool DoOnce = 0      If (DoOnce == 0) && (akActionRef == game.getPlayer())         Activate(getLinkedRef())         DoOnce = 1      Else         ; do nothing      EndIfEndEvent

Double click on your lever reference. In the window that opens, navigate to the "scripts" tab and click on add script. Double click on "[new script]", this should bring up a small window. Give your script a unique name (e.g. "doOnceLeverScript") and confirm that it extends "ObjectReference" then click ok. Now you should be back in the previous window, but this time with your new script mentioned in the list area. Right-click on your script in the list then select "edit source". In the papyrus window that opens, paste the above code below the scriptname line. Now hit ctrl+s, if the compiler doesn't return any errors, then you should be good to go. Now it's just a case of adding your door or whatever as a linked reference of the lever

That "should" work for you. Like I said, I'm not able to get to the CK at the moment. Hopefully somebody else will come along and confirm it for you.

In theory, that script means that only the player can activate the lever this script is attached to and it will only activate the linked reference the first time, any subsequent clicks will do nothing

Let me know how it goes

- Hypno
User avatar
scorpion972
 
Posts: 3515
Joined: Fri Mar 16, 2007 11:20 am

Post » Sat Nov 17, 2012 1:10 am

Could you be a bit more accurate, please? Does the lever do anything or just trigger multiple times? There's also some levers that don't have all the same scripts as the "right ones" and don't really seem to do much. So, you could try changing the lever. I'm absolutely sure there's no need to make any new scripts for this, the problem must be somewhere else. When I've tested this myself, this has always worked:

5. Select 'FiniteUse', and click edit value to override the default value. Then you can tick the box that this lever can only be used a limited number of times.

6. Select 'TriggerCount' and click the edit value, then set this to 1. This should limit the lever to one use only.
User avatar
Dustin Brown
 
Posts: 3307
Joined: Sun Sep 30, 2007 6:55 am

Post » Fri Nov 16, 2012 10:52 pm

Do not wotk... I did all you said but lever works infinity...
I remember that i have seen this lever in the game. In the cave where you found that your companion is werewoolf. You have trapped yourself in the small room and was fighting with silver hands.

Could you be a bit more accurate, please?
Are you talking about my English? No, sorry, I can't.
When I've tested this myself, this has always worked
Maybe I have a bug.
User avatar
Rusty Billiot
 
Posts: 3431
Joined: Sat Sep 22, 2007 10:22 pm

Post » Fri Nov 16, 2012 1:15 pm

Are you talking about my English? No, sorry, I can't.

No, your English is fine. I mean the setup itself. What do you have linked to the door and how? I don't know if that makes any difference though, the situation sounds very strange, especially with the lever activating the object(s).
User avatar
brandon frier
 
Posts: 3422
Joined: Wed Oct 17, 2007 8:47 pm

Post » Fri Nov 16, 2012 11:18 am

Do not wotk... I did all you said but lever works infinity...

Was that directed at Sieran or me?

I havnt used that vanilla script before. But what i said in my last post should do the trick, it's what amethyst deceiver mentioned in the second post

- Hypno
User avatar
Amy Masters
 
Posts: 3277
Joined: Thu Jun 22, 2006 10:26 am

Post » Fri Nov 16, 2012 10:18 pm

Another try. I made NorDoorMedium, placed a NorLever1. Opened door Reference window. Activate parents -> new -> select reference -> norLever01. Then open lever window. Scripts -> TrapLever -> finityUse -> Edit Value -> placed tick. TrigerCount -> Edit Value -> 1.
And it do not work...
I made new door and lever with script like said hypno88. Do not work. I made a door and lever with this script and TrigerCount 1. Do not work too...

Was that directed at Sieran or me? I havnt used that vanilla script before. But what i said in my last post should do the trick, it's what amethyst deceiver mentioned in the second post - Hypno
To you.
User avatar
Megan Stabler
 
Posts: 3420
Joined: Mon Sep 18, 2006 2:03 pm

Post » Fri Nov 16, 2012 7:49 pm

I don't understand why it's not working. I've done exactly the same thing with activators. Once the condition is met and the object is activated, it won't be activated again.

Are you sure you're putting in the right code?

You could maybe stick an x marker down, disabled, and have in your script (along with the condition you want to set yourself):

If XMarkerRef.GetDisabled() == True      XMarkerRef.Enable();add your activate the lever scripts here and do what you wantElseif XMarkerRef.GetDisabled() == false;  do nothingEndif

That may not be exact as its from memory. Basically when the lever activates it'll enable that xmarker. Then next time you pull it it checks the marker is disabled. Because it isn't, it won't do anything.

Obviously you need to make XMarkerRef an object reference property of the xmarker, for your script :)
User avatar
yessenia hermosillo
 
Posts: 3545
Joined: Sat Aug 18, 2007 1:31 pm

Post » Fri Nov 16, 2012 12:09 pm

This is simply bizarre. Reminds me of the time I tried to make flamethrowers in my cell and they just refused to work. Worked fine in another cell though... I was suspecting I had too many activator objects in the cell, but that was hundreds of traps and I doubt you have that many.
User avatar
glot
 
Posts: 3297
Joined: Mon Jul 17, 2006 1:41 pm

Post » Fri Nov 16, 2012 8:02 pm

I think I figured it out. My script is set up to work through "linked reference" not "activate parent"

- Hypno

User avatar
trisha punch
 
Posts: 3410
Joined: Thu Jul 13, 2006 5:38 am

Post » Fri Nov 16, 2012 9:01 pm

I have placed lever and door in Riverwood trader and it did not work. I have made a new .esp file and made lever in test location but it did not work.
I think I figured it out. My script is set up to work through "linked reference" not "activate parent"

- Hypno
Going to try it. But later.
User avatar
Emily Martell
 
Posts: 3469
Joined: Sun Dec 03, 2006 7:41 am

Post » Fri Nov 16, 2012 1:23 pm

Fair enough mate. Good luck, let us know how it goes

- Hypno
User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am

Post » Sat Nov 17, 2012 3:39 am

DO NOT WORK!
I tried do linked ref. Added your script on lever, pressed Linked ref, New -> door. Lever do not open door absolutely. Tried do linked ref from door to lever. Do not work even once.
Tried reinstall Creation Kit and did this another time. Tried do finity use, Trigger count 1. I have send mod to my frend and on his Skyrim lever do not work correctly too.
Looks like i should forget about this idea.
User avatar
Paul Rice
 
Posts: 3430
Joined: Thu Jun 14, 2007 11:51 am

Post » Sat Nov 17, 2012 1:06 am

DO NOT WORK!
I tried do linked ref. Added your script on lever, pressed Linked ref, New -> door. Lever do not open door absolutely. Tried do linked ref from door to lever. Do not work even once.
Tried reinstall Creation Kit and did this another time. Tried do finity use, Trigger count 1. I have send mod to my frend and on his Skyrim lever do not work correctly too.
Looks like i should forget about this idea.
It's not exactly a tricky or complicated idea, it should work fine.

You must be doing something incorrectly.
User avatar
Marguerite Dabrin
 
Posts: 3546
Joined: Tue Mar 20, 2007 11:33 am

Post » Fri Nov 16, 2012 11:03 pm

I DID IT!!!
I made a lever as a parent to TrapTriggerHinge. And it is a parent of the door. TrapTrigger can be used only once so door too!
Thanks very much to all who tried to help me.
User avatar
hannah sillery
 
Posts: 3354
Joined: Sun Nov 26, 2006 3:13 pm

Post » Sat Nov 17, 2012 12:00 am

Glad it worked out mate

- Hypno
User avatar
Rachel Eloise Getoutofmyface
 
Posts: 3445
Joined: Mon Oct 09, 2006 5:20 pm


Return to V - Skyrim