Difference between revisions of "Death check with weapon script"
no edit summary
imported>Spd1274 (Writing the Article) |
imported>Spd1274 |
||
Line 28: | Line 28: | ||
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 /> | ||
<PRE> | <PRE> | ||
Scriptname Name | |||
ref Target | ref Target | ||
Line 41: | Line 42: | ||
endif | endif | ||
set Once to 0 | set Once to 0 | ||
End | |||
Begin GameMode | Begin GameMode | ||
Line 49: | Line 50: | ||
set Once to 1 | set Once to 1 | ||
endif | endif | ||
End | |||
</pre> | |||
Now I understand that this seems quite alot to take in at first glance. However, lets break it down: | Now I understand that this seems quite alot to take in at first glance. However, lets break it down: | ||
<PRE> | <PRE> | ||
Scriptname Name | |||
ref Target | ref Target | ||
Line 72: | Line 74: | ||
endif | endif | ||
set Once to 0 | set Once to 0 | ||
End | |||
</pre> | </pre> | ||
Line 81: | Line 83: | ||
<pre> | <pre> | ||
Begin GameMode | Begin GameMode | ||
if Dead == 1 && Once == 0 | |||
player.additem Item 1 | player.additem Item 1 | ||
messageBox "Message." | |||
set Once to 1 | set Once to 1 | ||
endif | endif | ||
End | |||
</pre> | </pre> | ||
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. |