Jump to content

Simple scripts


skil8

Recommended Posts

Hello everyone!

 

I am working on a mod right now and i want to implement some simple scripted events. I'm a total newbie when it comes to scripting. I learned a bit over the past few weeks, i can do simple button pressing scripts or messageboxes and stuff. I don't want to do anything much bigger, just some simple scripts. But i can't for the life of me figure this stuff out. It's so much reading and writing and thinking! I might sound stupid but i was never really good at this technical stuff like scripting or programming. So i really need help here. I know there are some people in here that can write the scripts i need in max 10 minutes. It would be sooooo great if someone could just write 2 scripts for me and post them here. I can use them and work around them and add stuff to my liking. It's just the base that i'm missing.

So here is what i actually need:

 

-A script for a button press that can be done more than once. (I'm using a script called shishi_door" and adjust it to my liking. But it's a "doonce" script and i don't know the command for do more than once. I looked around but can't find it.) I don't need any actions, just the basic "Begin, activate, end". I want to use this script for a door that can be opened by a crank but can be closed again by the same crank.

 

-A script for a button that plays a soundfile when pressed, and stops the soundfile when pressed again.

 

I know it might be a lot to ask but i really could use some help here :)

Link to comment
Share on other sites

You are right i should try the official bethesda forums. No idea why i haven't thought of it before. Oh and i tried the Scripting for dummies.

To give you a response though, i will show you what script i use for my door/Button currently:

 

begin Seeblick_Button

float timer
short doOnce

if ( doOnce == 2 )
return
endif

if ( MenuMode == 1 )
return
endif

if ( OnActivate == 1 )
if ( doOnce == 0 )
PlaySound "Thunder3"
MessageBox "You hear mechanical movement far away, above you but from within the house. You suddenly feel frightened without apparent reason."

set doOnce to 1
endif
endif

if ( doOnce == 1 )

set timer to timer + GetSecondsPassed

if ( timer <= 1 )
Move Z -10
endif


"Seeblick Tapestry 2"->Move Z 200

if ( timer > 5 )
Set doOnce to 2
endif

endif

end Seeblick_Button

 


I didn't really wrote much of it. Basically copy pasted and stole from other scripts and threw them together. Now all i want to know is how can i make a script like that to be executed more than once? I know it has something to do with the "doOnce" in the beginning but what is the command for "can be used/activated more than once"? Do you know what i mean by that? It's kinda hard to explain in english

Link to comment
Share on other sites

I'd try something like this

begin Seeblick_Button

float timer
short doOnce

;if ( doOnce == 2 )    <--- This isn't needed if you want to close
; return                    \the door using same method
;endif

if ( MenuMode == 1 )
return
endif

if ( OnActivate == 1 )
    if ( doOnce == 0 )
        PlaySound "Thunder3"
        MessageBox "You hear mechanical movement far away, above you but from within the house. You suddenly feel frightened without apparent reason."
        set doOnce to 1
    elseif ( doOnce == 2 )
        set doOnce to 3
    endif
endif

if ( doOnce == 1 )
    set timer to timer + GetSecondsPassed
    if ( timer <= 1 )
        Move Z -10
    endif
"Seeblick Tapestry 2"->Move Z 200
    if ( timer > 5 )
        Set doOnce to 2
    endif
endif

if ( doOnce == 3 )

    ;do your thing to close the door

    set doOnce to 0    ;<-----Reset 'doOnce' to 0 to make it ready to open again on activate
endif

end Seeblick_Button

I didn't really wrote much of it. Basically copy pasted and stole from other scripts and threw them together.

Thats how I learned scripting too mashing different scripts, studying vanilla scripts etc.

Link to comment
Share on other sites

I'd try something like this

begin Seeblick_Button

float timer
short doOnce

;if ( doOnce == 2 )    <--- This isn't needed if you want to close
; return                    \the door using same method
;endif

if ( MenuMode == 1 )
return
endif

if ( OnActivate == 1 )
    if ( doOnce == 0 )
        PlaySound "Thunder3"
        MessageBox "You hear mechanical movement far away, above you but from within the house. You suddenly feel frightened without apparent reason."
        set doOnce to 1
    elseif ( doOnce == 2 )
        set doOnce to 3
    endif
endif

if ( doOnce == 1 )
    set timer to timer + GetSecondsPassed
    if ( timer <= 1 )
        Move Z -10
    endif
"Seeblick Tapestry 2"->Move Z 200
    if ( timer > 5 )
        Set doOnce to 2
    endif
endif

if ( doOnce == 3 )

    ;do your thing to close the door

    set doOnce to 0    ;<-----Reset 'doOnce' to 0 to make it ready to open again on activate
endif

end Seeblick_Button

I didn't really wrote much of it. Basically copy pasted and stole from other scripts and threw them together.

Thats how I learned scripting too mashing different scripts, studying vanilla scripts etc.

This is perfect! Just what i needed. "set doOnce to 0 ;<-----Reset 'doOnce' to 0 to make it ready to open again on activate"

This was what i didn't know. Now i can take it and use it in multiple scripts. Thanks!

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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