Jump to content

Help me!


Recommended Posts


I want to do a mod in Oblivion similar with Silent Hill game . I'm good at 3D modeling and textures , but i don't know how to use an electric panel to lock a door . I need a script , I tried through a quest but i faild . If someone know that, please help me and i will credit you for that.

Edited by ionoblivion
Link to comment
Share on other sites

This area of the forums is for discussing various subjects,

not specific game or mod problems. You should try posting in

https://forums.nexusmods.com/index.php?/forum/180-oblivion-mod-troubleshooting/

Link to comment
Share on other sites

Ah. Whoops. I already answered that same question here, where you also had it posted (in addition to the general discussion section). If someone finds the comment by Malachi Delacot a bit odd, it is because this thread was apparently moved here from a general (very, very general) discussion section not specific to any game. Now that the comment still remains, and the thread has already been moved, it does look interesting. :tongue:

 

Here is the answer I managed to come up with, copy-pasted from the other thread:

 

You can use an OnActivate block. Here is an example script (rename it!):

ScriptName PanelTest

ref rDoor

Begin OnActivate PlayerRef
    set rDoor to GetParentRef
    If ( rDoor )
        If ( rDoor.GetLocked )
            rDoor.Unlock
            Message "The door has been unlocked."
        Else
            rDoor.Lock 100
            Message "The door has been locked tight."
        EndIf
    EndIf    
End

To make that work, you need to

  • rename the script and add it to your mod
  • make the panel base object an activator
  • set the script of the activator base object to that one
  • place one panel in the game world
  • double-click on the panel ref in the world, and set its Enable Parent to the door

Lock command here: http://cs.elderscrolls.com/index.php?title=Lock

Unlock command here: http://cs.elderscrolls.com/index.php?title=Unlock

GetLocked command here: http://cs.elderscrolls.com/index.php?title=GetLocked

 

No need to give any credit, anyone could answer that. It is pretty basic. And that only works for the static doors. If you want a door that swings, then the door model needs to be reset to closed state when locked.

 

Edited by Contrathetix
Link to comment
Share on other sites

Thanks for your reply. My intention is to unlock a door with a numeric code ( example 7133 ) via an electrical keypad panel. So to unlock a door you need to type this code numbers in that keypad.

Link to comment
Share on other sites

No problem. Now that sort of input would require more scripting. The first three most obvious solutions would be these:

  1. make each button a separate activator, and move the "input check" into the door itself
  2. use messageboxes, with one button for each number, and the box displayed X times in a row, with the "input check" in the door itself
  3. instead of separate buttons, use the OBSE user text input, and have player input the whole set as a string

Number 1 might be the best one, maybe, if you want the buttons to be sort of "clickable". It would mean quite a few buttons, but I have an idea. Maybe something like this:

  • the door keeps a list (an array) of button references in the "correct" order (the array can be built in an OnLoad block, maybe)
  • each button checks from the door to see if the correct ref has been activated, as well as advances an index if it was the correct one (maybe also makes a sound if it was not the correct one?)
  • when all refs in the array have been clicked in the right order, the door would unlock

I need to test a little myself, then I might be able to suggest something. An interesting idea that panel.

Edited by Contrathetix
Link to comment
Share on other sites

I want chose the first solution, with many buttons that you can press, but you must press the corresponding order code ( again example 7133 ). If you press other number you lose all building code and you have to start again with the first number. I dont't know what script to use, i think is hard to make that in Oblivion. Anyway, thank you Contrathetix!

Link to comment
Share on other sites

Okay, I managed to come up with some sort of a solution, or more like an example. The example works like this:

  • there are nine separate activator base objects, each has the number as the name (like "1", "2", etc.)
  • one door, a persistent reference, with a door script
  • on the door script, a String_var holds the correct "code", and an index variables keeps track of the current index in that string
  • when a button is clicked, the script compares the name of the clicked button to the symbol at the current index of the key, if they match, it moves forwards, if not, the index returns to the start
  • if the index reaches the last symbol of the code, the door is unlocked

The example plugin should be attached on this post as an attachment here:

 

 

You can get in the test cell with this console command:

coc FurphyCell

The scripts require OBSE, and I would recommend using the Construction Set Extender by shademe, because at least that should work. It is also a huge improvement over the normal CS in general: http://www.nexusmods.com/oblivion/mods/36370/

 

Here is the button script:

 

 

ScriptName FurphyButtonScript

Begin _OnActivate PlayerRef

    If Eval ( FurphyDoorRef.sCode[FurphyDoorRef.iIndex] == GetName )
        let FurphyDoorRef.iIndex += 1
        Message "Right button!"
        If Eval ( FurphyDoorRef.iIndex > ( ( sv_Length FurphyDoorRef.sCode ) - 1 ) )
            FurphyDoorRef.Unlock
            FurphyDoorRef.PlaySound3D DRSLockOpen
            Message "The door has been unlocked!"
        EndIf
    Else
        let FurphyDoorRef.iIndex := 0
        PlaySound3D CMetalSmall
        Message "Wrong button!"
    EndIf
    
End

 

 

 

And here is the door script:

 

 

ScriptName FurhpyDoorScript

String_var sCode
Int iIndex

Begin _OnLoad

    let sCode := "7133"
    let iIndex := 0

End

 

 

 

Hopefully that helps a little. Making that work was an interesting task, definitely enjoyed it. The project sounds interesting, and I wish you the best of luck with it. :thumbsup:

Edited by Contrathetix
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...