Difference between revisions of "Scripting Tutorial: My First Spell"

no edit summary
imported>Mrflippy
(Initial Add)
 
imported>Darkness X
 
(9 intermediate revisions by 6 users not shown)
Line 2: Line 2:


This tutorial will help you create a new spell using a combination of predefined and custom effects.
This tutorial will help you create a new spell using a combination of predefined and custom effects.
{{Tools|req0=[[The Elder Scrolls Construction Set|Construction Set]]}}


==First Steps==
==First Steps==
Line 7: Line 9:


==Create the Spell==
==Create the Spell==
Alright! So, after the arduous loading process, we can start making our spell. Go ahead and locate the [[Object_Window]]. We're interested in the [[Category:Magic]] category, so expand that option in the list. There are a few items under Magic, but we're creating a spell, so click on the Spell list item.
Alright! So, after the arduous loading process, we can start making our spell. Go ahead and locate the [[Object_Window]]. We're interested in the [[:Category:Magic]] category, so expand that option in the list. There are a few items under Magic, but we're creating a spell, so click on the Spell list item.


There should be a whole bunch of spells loaded in the list now. Right-click somewhere in this list (it doesn't matter where) and choose "New" from the context menu that pops up. This brings up a blank [[Spell]] dialog.
There should be a whole bunch of spells loaded in the list now. Right-click somewhere in this list (it doesn't matter where) and choose "New" from the context menu that pops up. This brings up a blank [[Spell]] dialog.
Line 38: Line 40:
Now that we've added a standard magical effect to our spell, let's add a custom one. In order to add a custom effect, we need to write a script. Select Gameplay->Edit Scripts... from the menubar.
Now that we've added a standard magical effect to our spell, let's add a custom one. In order to add a custom effect, we need to write a script. Select Gameplay->Edit Scripts... from the menubar.


We're now at a blank [[Script_Edit]] window. Select Script->New from the menubar in this window. The textarea will now be enabled.
We're now at a blank [[Edit Scripts]] window. Select Script->New from the menubar in this window. The textarea will now be enabled.


Choose "Magic Effect" in the Script Type drop down. This is important! If we don't do this, we can't add it to a spell.
Choose "Magic Effect" in the Script Type drop down. This is important! If we don't do this, we can't add it to a spell.
Line 108: Line 110:
Choose Script->Save from the menubar (or click on the disk button in the toolbar) and close the Script Edit window.
Choose Script->Save from the menubar (or click on the disk button in the toolbar) and close the Script Edit window.


<blockquote>You can read more about scripting on the [[Category:Scripting]] page. Also check out the [[My_First_Script]] tutorial.</blockquote>
<blockquote>You can read more about scripting on the [[:Category:Scripting]] page. Also check out the [[Scripting_Tutorial:_My_First_Script|My_First_Script]] tutorial.</blockquote>


==Add Custom Effects==
==Add Custom Effects==
Line 144: Line 146:
Finally we're at the last section! This is where we test the new spell. Go ahead and start Oblivion up. When the launcher comes up, click on the "Data Files" button. Make sure that "Oblivion.esm" and the filename you chose earlier are the only entries checked. Click "OK"
Finally we're at the last section! This is where we test the new spell. Go ahead and start Oblivion up. When the launcher comes up, click on the "Data Files" button. Make sure that "Oblivion.esm" and the filename you chose earlier are the only entries checked. Click "OK"


<blockquote>Before you actually click "Play" you may want to read the rest of the tutorial so you don't have to alt-tab. Oblivion doesn't really seem to like alt-tabbing very much. You could even write down or print out the next steps. I'll wait.</blockquote>
<blockquote>Before you actually click "Play" you may want to read the rest of the tutorial so you don't have to alt-tab. Oblivion doesn't really seem to like alt-tabbing very much. You could even write down or print out the next steps. I'll wait. Another option would be to set Oblivion to run in windowed mode by changing the full screen option to 0 in Oblivion.ini</blockquote>


Click "Play"
Click "Play"
Line 150: Line 152:
Start a new game or load up a save file. Keep in mind that our custom effect works best on multiple targets.
Start a new game or load up a save file. Keep in mind that our custom effect works best on multiple targets.


Once you are actually playing, bring up the console by hidding the ~ key, and type the following:
Once you are actually playing, bring up the console by hitting the ~ key, and type the following:


<pre>player.addspell <formId></pre>
<pre>player.addspell <formId></pre>
Line 163: Line 165:
You should gain armor, and after a few seconds, a notification message will appear informing you how many times the update block was executed.
You should gain armor, and after a few seconds, a notification message will appear informing you how many times the update block was executed.


If it doesn't go well because the game doesn't recognize the formID you should try increasing its second digit (in our example you would have to substitute 01000ce8 with 02000ce8, 03000ce8...) until it works. You probably have more than the master file and your data file loaded, despite the suggestion above.


Have fun making spells!
Have fun making spells!
==Custom Spell Scripting Notes==
Functions in a magic effect script run on the target by default, so usually there's no need to worry about the target's ID. But if you do need that info, getSelf will get it for you.


[[Category:Tutorials]]
[[Category:Tutorials]]
[[Category:Scripting]]
[[Category:Scripting Tutorials]]
Anonymous user