Scripting for beginners

From the Oblivion ConstructionSet Wiki
Revision as of 20:17, 3 February 2010 by imported>Darkness X
Jump to navigation Jump to search

This is a simple tutorial on scripting, There are alot of others out there, but this one will show you the very basics. This tutorial will give detailed instructions n the scripts, and what the coding means in each script.


What We Will Accomplish:

Learning about basic scripting.

A first script

This is a basic script that will show you the ropes of basic types of scripting, it will come in handy alot!

starting off

Load up your Oblivion master file (.esm) You can load any other data file (.esp) if you want, but o avoid conflicts, do NOT set a file at the active file.

Now, extend your branch (List) to the following:

Items > Weapons > Iron

And click on any random item, however check that it's not scripted yet.

Beginning the script

So, you have opened the weapons menu. You should notice that the script area has an elipse (...) button next to it. Click on that. Now, click file > new. Then, type the following:

scriptname PickupScript
;this is the name of the script

Begin OnAdd
;Makes the script start when it's added to your inventory.
Messagebox 'You've just picked up a weapon.'
;This makes a box come up saying 'You've just picked up a weapon' when you pick it up.
Message 'Weapon added.'
;this makes a message come up in the top left corner notifying you that you've successfully added it.
End
;ends the script

There, finished! The semicolon (;) means it's a comment, it is not required as it does not do anything, but may help you know what your doing later on in more complicated scripts.

almost there!

Now, with the script box still up, click save (the disc button with white, not red, otherwise you'll recompile all the scrips; a bad thing!)

now you can exit the script menu. exit the weapon menu and reload it. open the list of scripts and choose PickupScript from the dropdown menu. Change the ID to ScriptTutorial weapon or whatever you want, and click ok. Click yes to the 'create a new form' messages. Done!