Difference between revisions of "Magic effect scripts"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>TheImperialDragon
m
imported>Syscrusher
m (Grammar correction ("effected" ==> "affected"))
 
(10 intermediate revisions by 7 users not shown)
Line 1: Line 1:
Magic Effect scripts are special scripts that can be used to create Scripted Magic Effects. They are created using the normal script editing window, but must be marked as Magic Effect scripts in order to be used in this way. Also note that the scripted effects will only run while under Game Mode.
Magic Effect scripts are special scripts that can be used to create Scripted Magic Effects. They are created using the normal script editing window, but must be marked as Magic Effect scripts in order to be used in this way. Also note that the scripted effects will only run while under Game Mode.


These scripts do not use normal begin/end blocks, since they only run while the spell effect is active on a target. They use three special block types and one special function.  
These scripts do not use normal begin/end blocks, since they only run while the spell effect is active on a target. They use three special block types and one special function.




Magic Effect block types:  
Magic Effect block types:
*[[ScriptEffectStart]]
*[[ScriptEffectStart]]
*[[ScriptEffectFinish]]
*[[ScriptEffectFinish]]
*[[ScriptEffectUpdate]]
*[[ScriptEffectUpdate]]
Other block types are invalid (they will compile but the code inside them will never run).




Magic Effect functions:
*[[ScriptEffectElapsedSeconds]]


In all other ways, Magic Effect scripts act like reference scripts, and can use all normal script functions inside the Magic Effect blocks. Magic Effect scripts would run on what is affected by the effect, so getSelf for instance would give the reference to the the target of the spell.


Magic Effect functions:
==Notes==
*[[ScriptEffectElapsedSeconds]]
<ul><li>Scripted spells will run on corpses, containers, doors, and furniture, but will simply run through the entire script once, regardless of the duration of the spell. All three blocktypes, ScriptEffectStart, ScriptEffectUpdate, and ScriptEffectFinish will run.
<li>Scripted spells behave unpredictably when running on an actor outside of the currently loaded cell. Some confirmed issues are as follows:<ul><li>Variables in the script become uninitialized;
<li>ScriptEffectFinish block may fail to run;
<li>For scripted abilities, a new instance of the script is created each time the player enters the cell with the affected actor.</ul>
Other bizarre results have yet to be confirmed or explained. A workaround is to add a scripted item to the actor's inventory.
<li>Magic effect scripts are not necessarily limited to the three blocktypes above. [[MenuMode]], for example, will work, and [[GameMode]] is identical to [[ScriptEffectUpdate]] from within a scripted spell.
<li>Using OBSE string and array variables in magic effect scripts will cause new set of variables to be created every time new instance of script is running. This will cause OBSE save game bloating so they must be uninitialized after they are used. Call [[Sv_Destruct]] for string variables and set arrays to [[Ar_Null]].</ul>


In all other ways, Magic Effect scripts act like reference scripts, and can use all normal script functions inside the Magic Effect blocks.
==See Also==


==See Also==
*[[:Category:Magic Functions|Magic Functions]]


*[[Category:Magic Functions]]


[[Category: Scripting]]
[[Category: Scripting]]

Latest revision as of 00:34, 3 January 2017

Magic Effect scripts are special scripts that can be used to create Scripted Magic Effects. They are created using the normal script editing window, but must be marked as Magic Effect scripts in order to be used in this way. Also note that the scripted effects will only run while under Game Mode.

These scripts do not use normal begin/end blocks, since they only run while the spell effect is active on a target. They use three special block types and one special function.


Magic Effect block types:


Magic Effect functions:

In all other ways, Magic Effect scripts act like reference scripts, and can use all normal script functions inside the Magic Effect blocks. Magic Effect scripts would run on what is affected by the effect, so getSelf for instance would give the reference to the the target of the spell.

Notes[edit | edit source]

  • Scripted spells will run on corpses, containers, doors, and furniture, but will simply run through the entire script once, regardless of the duration of the spell. All three blocktypes, ScriptEffectStart, ScriptEffectUpdate, and ScriptEffectFinish will run.
  • Scripted spells behave unpredictably when running on an actor outside of the currently loaded cell. Some confirmed issues are as follows:
    • Variables in the script become uninitialized;
    • ScriptEffectFinish block may fail to run;
    • For scripted abilities, a new instance of the script is created each time the player enters the cell with the affected actor.

    Other bizarre results have yet to be confirmed or explained. A workaround is to add a scripted item to the actor's inventory.

  • Magic effect scripts are not necessarily limited to the three blocktypes above. MenuMode, for example, will work, and GameMode is identical to ScriptEffectUpdate from within a scripted spell.
  • Using OBSE string and array variables in magic effect scripts will cause new set of variables to be created every time new instance of script is running. This will cause OBSE save game bloating so they must be uninitialized after they are used. Call Sv_Destruct for string variables and set arrays to Ar_Null.

See Also[edit | edit source]