Difference between revisions of "Useful Scripts"

Jump to navigation Jump to search
194 bytes added ,  20:39, 19 March 2009
imported>Illyism
(added FOSE script)
imported>Cipscis
Line 29: Line 29:
<small>For a Quest or Object script, use a [[GameMode]] block.  For an Effect script, use a [[ScriptEffectUpdate]] block.<br />In order to use the EditorRefID of your reference in a script like this, it must be a persistent reference.</small>
<small>For a Quest or Object script, use a [[GameMode]] block.  For an Effect script, use a [[ScriptEffectUpdate]] block.<br />In order to use the EditorRefID of your reference in a script like this, it must be a persistent reference.</small>


<pre>float fAngleZ
<pre>float fAngle
float fRelativePos
float fRelativePos


Line 37: Line 37:
myREF.setPos z fRelativePos
myREF.setPos z fRelativePos


set fAngleZ to player.GetAngle Z + <ANGLE OFFSET>
set fAngle to player.GetAngle Z + <ANGLE OFFSET>
myREF.SetAngle Z fAngleZ
myREF.SetAngle Z fAngle


set fRelativePos to player.GetPos Y + <PLAYER OFFSET> * cos fAngleZ
set fRelativePos to player.GetPos Y + <PLAYER OFFSET> * cos fAngle
myREF.SetPos Y fRelativePos
myREF.SetPos Y fRelativePos


set fRelativePos to player.GetPos X + <PLAYER OFFSET> * sin fAngleZ
set fRelativePos to player.GetPos X + <PLAYER OFFSET> * sin fAngle
myREF.SetPos X fRelativePos
myREF.SetPos X fRelativePos


Line 50: Line 50:


<ul>
<ul>
<li><Z OFFSET> determines the reference's z offset from the player's feet.  The higher this is, the further above the player's feet the reference will appear.
<li><Z OFFSET> determines the reference's z offset from the player's feet.  The higher this is, the further above the player's feet the reference will appear. If <Z OFFSET> should be determined by where the player is looking, this should be used:<pre>set fAngle to player.GetAngle X
set fRelativePos to player.GetPos Z - <PLAYER OFFSET> * sin fAngle
</pre>
</li>
</li>
<li><ANGLE OFFSET> determines the reference's position relative to the players.  As <ANGLE OFFSET> increases, the reference's position will move around the player in an anti-clockwise direction.  When <ANGLE OFFSET> is 0, the reference will appear directly in front of the player.</li>
<li><ANGLE OFFSET> determines the reference's position relative to the players.  As <ANGLE OFFSET> increases, the reference's position will move around the player in an anti-clockwise direction.  When <ANGLE OFFSET> is 0, the reference will appear directly in front of the player.</li>
Anonymous user

Navigation menu