Jump to content

Script Question


Monticapone

Recommended Posts

As I´m a real nooby in scripting, I have some questions concernig my new house mod....

So I want to have one special object (static:DLC05MZClipboard) to be a switch and then for one time a sound comes (like some engine turning on) and some light go on and electric arcs in some glass container appear (fxelectricarc)....is this possible?

There should also be the option to turn all off again....

Link to comment
Share on other sites

Sure it is, and here's how-

 

First, create an activator. (World Objects->Activator->Right click->New) You'll have to extract the model the clipboard uses using something like Fallout Mod Manager, and place it in the same path. For example, if the clipboard was located in "Zeta - Main.bsa/Meshes/Clutter/Clipboard/MZclipboard.nif," you would put the NIF you extracted in "Data/Meshes/Clutter...etc." Have the activator use this model, so it looks the same as the clipboard.

Place all of the electric effects where you want them to be when the clipboard is activated. Set them as Initially Disabled, which means that the object is there, but just hidden until a script tells them to be enabled. Give your electric arcs unique Reference ID's, so you can refer to them in the script. I'm pretending that you named them ElectricArc1 and ElectricArc2.

 

Begin OnActivate

short DoOnce

if DoOnce == 0
ElectricArc1.enable
ElectricArc2.enable
PlaySound SoundID
	set DoOnce to 1

endif
End

 

Lets break that down-

 

Begin OnActivate

This is telling the script to only happen when the player has activated the clipboard.

 

short DoOnce

Anything can come after short, such as "short Walking." It's a way of telling the script, through "if Walking" and "set Walking to," that something is happening, should happen, or shouldn't happen.

 

electricarc1.enable

You're telling the Initially Disabled electric arc to become enabled.

 

Playsound SoundID

Simply playing the sound.

 

endif

You're ending the "if" condition. Unlike Begin/End, the "if" is totally defined by you, instead of being chosen from a list of possible conditions.

 

End

You're ending the "OnActivate."

One script can have multiple Begin and End conditions, as long as they are different. For example, you could have both "Begin OnActivate" and "Begin GameMode" in the same script. But you cannot have another Begin statement until the other has already ended via "End."

 

 

 

You'll need to replace "SoundID" with the name of a sound you think fits your description. I think the Megaton gate opening sound might fit, but it's your choice. Sounds are under "Miscellaneous->Sounds" if you didn't know :) . After you save your script, simply chose your script from the drop-down list when editing your activator.

 

And you always start a script with "Scriptname ScriptID." Replace ScriptID with what you want your script to be called. If you want, you can simply type SCN instead of ScriptName, but I personally prefer to write the whole thing out.

Remember, scripts are not case-sensitive, so capitalizing things isn't necessary. Of course, it makes the script easier to navigate, especially when you start to write lengthier ones. It's kind of tough to get started, but you'll get the hang of it. A couple of months ago, I was in the same position you were in :) .

Link to comment
Share on other sites

One thing that I think I should mention - the variable declaration (i.e. "short DoOnce") should take place outside the Begin/End block:

short DoOnce

Begin OnActivate

if DoOnce == 0
	ElectricArc1.enable
	ElectricArc2.enable
	PlaySound SoundID
	set DoOnce to 1

endif
End

On that note, it looks like I need to update my Script Validator... EDIT: There we go. Variable declarations within Begin/End blocks will now be reported, as will non-"ref" variables declared in result scripts.

 

Cipscis

Link to comment
Share on other sites

OK I will try that one....now I have one more question....

There is one static object called "Death ray core" (from mothership zeta too). It looks awesome and circles around (special idle animation).....can I somehow script that when I use this switch the animation starts and the death ray core starts to circle?

 

BTW: THANKS A LOT FOR YOUR HELP ALREADY!!!!!! :)

Link to comment
Share on other sites

and here i was thinking how d..n hard this could be. linked ref and get linked and all that stuff..thanks for bringing this up and scipsis and emh thank you for the reply..didn't know it was that easy. :thanks: :thumbsup:
Link to comment
Share on other sites

  • Recently Browsing   0 members

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