Difference between revisions of "Flying"

Jump to navigation Jump to search
259 bytes added ,  22:58, 23 December 2011
m
no edit summary
imported>8asrun6aer
m
imported>8asrun6aer
m
Line 6: Line 6:
Not only can you grant the ability to fly to users of your mod with such a script, but you can use this script yourself as a modder to test every inch of your newly modded world space in a live environment.
Not only can you grant the ability to fly to users of your mod with such a script, but you can use this script yourself as a modder to test every inch of your newly modded world space in a live environment.


The main principle here is avoiding using the [[SetPos]] method of flying, and thus avoid clipping.  Instead, this script works with a player's x,y,z velocities.
The main principle here is avoiding using the [[SetPos]] method of flying, and thus avoid clipping or ghosting through walls.  Instead, this script works with a player's x,y,z velocities.


If you see any part of the example script that can be made more efficient or made easier to read, feel free to edit.  Ideally, this should be made a community-authored script helping modders create efficient and realistic player flying effects.
If you see any part of the example script that can be made more efficient or made easier to read, feel free to edit.  Ideally, this should be made a community-authored script helping modders create efficient and realistic player flying effects.
Line 19: Line 19:
While flying, use the regular forward/backward/strafe keys for movement.  Should the player ever reassign directional control keys, flight controls will be reset only after the player reloads the game.  This directional control reassignment on game-load happens around line 57.
While flying, use the regular forward/backward/strafe keys for movement.  Should the player ever reassign directional control keys, flight controls will be reset only after the player reloads the game.  This directional control reassignment on game-load happens around line 57.


Use the mouse to control flight direction.
Use the mouse to control flight direction/heading.




== The Script ==
== The Script ==
Before continuing, you'll want to create a new Global value.  In the TES CS, go to Gameplay -> Globals menu, right-click in the list of globals, select "New", and for the Form ID, enter ''cstmGlobalPlayerIsFlying'' as a ''short'' with value ''0''.  This ''cstmGlobalPlayerIsFlying'' global variable holds the flying state of the player.  It's global so that this state can be easily checked or altered in other scripts.
Before continuing, you'll want to create a new [[Globals|Global]] variable.  In the [[The_Elder_Scrolls_Construction_Set|TES CS]] main menu, go to Gameplay -> Globals menu, right-click in the list of globals, select "New", and for the Form ID, enter ''cstmGlobalPlayerIsFlying'' as a ''short'' with value ''0''.  This ''cstmGlobalPlayerIsFlying'' global variable holds the flying state of the player.  It's meant to be global so that the player's flying state can be easily checked or altered in other scripts.


Also, note the only code block used by this script is the ''ScriptEffectUpdate'' block.  The ''ScriptEffectFinish'' block is irrelevant to constant abilities, and the ''ScriptEffectStart'' block would make this script too dependent on initial new game environments.
Also, note the only code block used by this example magic effect script is the [[ScriptEffectUpdate]] block.  The [[ScriptEffectFinish]] block is irrelevant to constant abilities, and the [[ScriptEffectStart]] block would make this script too dependent on initial new game environments.


To easily distinguish local variables for the sake of readability in this example script, each new local variable name begins with 'cstm'.  Also, the script is heavily commented to hopefully make each step more clear.
To easily distinguish local variables for the sake of readability in this example script, each new local variable name begins with 'cstm'.  Also, the script is heavily commented to hopefully make each step more clear.
Line 138: Line 138:
</pre>
</pre>


Pausing here for a second.  This script damages the player's fatigue while flying to avoid encouraging the player to fly over every dangerous situation in the game.  If you're only testing a new map you've just made, you'll want to comment out this part as it'll only get in the way.  Otherwise, think twice about letting the player fly around without a care in the world.
Pausing here for a second.  This script damages the player's fatigue while flying to avoid encouraging the player to fly over every dangerous situation in the game.  If you're only testing a new map you've just made, you'll want to comment out or delete this section of the script as it'll only be an inconvenience.  Otherwise, think twice about letting the player fly around without a care in the world.


<pre>
<pre>
Line 246: Line 246:
</pre>
</pre>


Once the script is saved, create a new [[Spell|Ability Spell]].  Set the ''Type'' of the spell to ''Ability''.  Then, add a new effect to this new ability spell.  For this new effect, set the ''Range'' to ''Self'', the ''Duration'' to ''0'', the ''Script'' to ''cstmFlightScript'', the ''Effect Name'' to something readable in-game like ''Flying'', and click ''OK''.  You can then make this a ''PC Start'' spell, or [[Race_creation_tutorial#Specials|add it as a default ability for any race]].
Once the script is saved as a "Magic Effect" script-type, create a new [[Spell|Ability Spell]].  Set the ''Type'' of the spell to ''Ability''.  Then, add a new effect to this new ability spell.  For this new effect, set the ''Range'' to ''Self'', the ''Duration'' to ''0'', the ''Effect Type'' to ''Script Effect'', the ''Script'' to ''cstmFlightScript'', the ''Script Effect Name'' to something readable in-game like ''Flying'', and click ''OK''.  You can then make this a ''PC Start'' spell, or [[Race_creation_tutorial#Specials|add it as a default ability for any race]].


== Notes ==
== Notes ==
Anonymous user

Navigation menu