Difference between revisions of "Death check with weapon script"

2,053 bytes added ,  04:52, 12 September 2010
m
(marked as unfinished)
imported>Spd1274
imported>Darkness X
m ((marked as unfinished))
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Request Tutorial}}
{{unfinished}}
 
{{Tools|req0=[[The Elder Scrolls Construction Set|Construction Set]]}}== Introduction ==
== Introduction ==


In the process of working on a project that requires the Player to kill an NPC, and than adds an item upon the death of the NPC, and only an NPC, it became necessary to layout the steps for the project, and this seemed the best, and most helpful way to others, to do that.
In the process of working on a project that requires the Player to kill an NPC, and than adds an item upon the death of the NPC, and only an NPC, it became necessary to layout the steps for the project, and this seemed the best, and most helpful way to others, to do that.
Line 8: Line 7:
1. Create a Magic Effect Script that will check for the death of an NPC at the Player's hand, than add an Item to the inventory with a nice little message. <br />
1. Create a Magic Effect Script that will check for the death of an NPC at the Player's hand, than add an Item to the inventory with a nice little message. <br />
2. Create the item to be added, in this case, the soul of the NPC in the form of a bottled potion. From here on, called The Gift. <br />
2. Create the item to be added, in this case, the soul of the NPC in the form of a bottled potion. From here on, called The Gift. <br />
3. Create a scripted enchantment that runs our script. To be called, The Ench (Because there is no way to activate a script when the Player hits an NPC i.e. Onstrike or anything of that kind. See: [http://cs.elderscrolls.com/constwiki/index.php/Begin Beginning Scripts]).<br />
3. Create a scripted enchantment that runs our script. To be called, The Ench (Because there is no way to activate a script when the Player hits an NPC i.e. Onstrike or anything of that kind. See: [[Begin|Beginning Scripts]]).<br />
4. Finally create, and place into Tamriel, the weapon that will execute the script. To be called, The Weapon.
4. Finally create, and place into Tamriel, the weapon that will execute the script. To be called, The Weapon.


Line 15: Line 14:


Other Tutorials of possible relevance:
Other Tutorials of possible relevance:
<br /> [http://cs.elderscrolls.com/constwiki/index.php/Deadcount_on_a_weapon Deadcount on a weapon].
<br /> [[Deadcount on a weapon]].


So without further ado, "Get on with it!"  
So without further ado, "Get on with it!"  
Line 21: Line 20:
== The Script ==
== The Script ==


[[Image:toolbarwscriptcircle.png|thumb|right|Script Editor Icon]]
To begin, we load the CS and than open the script editor by clicking on the [[Image:ScriptEditorIcon.png]] symbol.
To begin, we load the CS and than open the script editor by clicking on the [[Image:ScriptEditorIcon.png]] symbol.
Which is at the very end of the toolbar:<br />
Which is at the very end of the toolbar:<br />
[[Image:toolbarwscriptcircle.png]]
 


Now that we have the editor open, here is our skeleton script:<br />
Now that we have the editor open, here is our skeleton script:<br />
Line 90: Line 90:
</pre>
</pre>


[[Image:scripttypepic.png|thumb|right|Script Type]]
Finally our script finishes up by running a test that Dead and Once have been set to the correct values for a killed NPC. <br /> Than the script adds an Item of our choice to the Player's inventory and displays a message.<br /> In order to avoid the script giving the Player the item over and over and over, the last action of the script is to set Once to 1, avoiding a loop.
Finally our script finishes up by running a test that Dead and Once have been set to the correct values for a killed NPC. <br /> Than the script adds an Item of our choice to the Player's inventory and displays a message.<br /> In order to avoid the script giving the Player the item over and over and over, the last action of the script is to set Once to 1, avoiding a loop.


Now, let's save our script, by clicking on the Floppy Disk icon, and close the window.
 
Now, be sure to change to Script Type to: Magic Effect. Now click the Floppy Disk icon to save the script. Close the Script Editor.
 


This completes our creation of the script, it is all that simple. It needs to be said that the tests run under "ScriptEffectStart" must be run there, because that portion of the script is run while attacking the victim, and if those tests were run under "GameMode" the Player would no longer have a target to test.
This completes our creation of the script, it is all that simple. It needs to be said that the tests run under "ScriptEffectStart" must be run there, because that portion of the script is run while attacking the victim, and if those tests were run under "GameMode" the Player would no longer have a target to test.
Line 99: Line 102:


== The Gift ==
== The Gift ==
In this case we are creating a potion so, we need to navigate to the Potion section of the CS Object Window. Click on Magic -> than Potion.
[[Image:thegiftpic.png|thumb|right|The Gift]]
We than need to select a potion inside the menu. I am choosing "TestPoison" because I like it's bottle image, double click on your choice. Now, you want to change the ID to something easily found, in this case: Item (in order to match our skeleton script). Next change the name of the potion Now, you can edit the properties of the potion if you'd like, but that is for another tutorial, and falls out of my hands.
Save the item, and close out of the dialogue box.
== The Ench ==
[[Image:ench.png|thumb|right|The Ench]]
The Ench is altogether to challenging, simply navigate to the Enchantment division by clicking Magic -> than Enchantment.
Right-Click inside the list of enchantments and select New.
Fill in with an appropriate ID, in this case: TheEnch. Choose "Weapon" as the Type.
[[Image:encheffect.png|thumb|right|The Ench Effect]]
Right click inside the data area, select New. You're now at the Enchantment Effect window.
The Effect field needs to be set to Script Effect so that we can apply our script. It will than default the Range to touch, this just means it will only affect those we hit with the weapon. The Duration and Magnitude remain zero because we are using a script and they are unnecessary.<br />
In the bottom half, we need to choose the Script Effect, "Name" in this case. Than we need to name the effect, I left it at the default. The School and Visual are purely aesthetics. You can choose a school if you please and a visual effect you find nice, I chose the Soul Trap effect. The tick box for hostility, doesn't need to be checked, but it is here out of habit, swinging a weapon at your opponent isn't exactly kind.
On to the Weapon!
== The Weapon ==
[[Category:Tutorials]]
[[Category:Scripting Tutorials]]
{{Request Tutorial}}
Anonymous user