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>scriptname Name
<PRE>
Scriptname Name


ref Target
ref Target
Line 41: Line 42:
endif
endif
set Once to 0
set Once to 0
end
End


Begin GameMode
Begin GameMode
Line 49: Line 50:
           set Once to 1
           set Once to 1
endif
endif
end</pre>
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
Scriptname Name


ref Target
ref Target
Line 72: Line 74:
endif
endif
set Once to 0
set Once to 0
end
End
</pre>
</pre>


Line 81: Line 83:
<pre>
<pre>
Begin GameMode
Begin GameMode
If Dead == 1 && Once == 0  
if Dead == 1 && Once == 0  
  player.additem Item 1
  player.additem Item 1
  MessageBox "Message."
  messageBox "Message."
           set Once to 1
           set Once to 1
endif
endif
end
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.
Anonymous user