Difference between revisions of "ScriptEffectUpdate"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Kkuhlmann
(this is no more a loop than any other script which is called every frame)
imported>Haama
(Changed note)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Usage'''
'''Usage'''
   begin ScriptEffectUpdate  
   Begin ScriptEffectUpdate  


Special block type used only by Magic Effect scripts. This block will start running on the first iteration of a scripted spell effect and run each time the spell is updated until the spell ends.
Special block type used only by Magic Effect scripts. This block will start running on the first iteration of a scripted spell effect and run each time the spell is updated until the spell ends.
'''Note:'''
* A '''ScriptEffectUpdate''' block with an active '''Return''' statement placed before a '''ScriptEffectFinish''' block in a Magic Effect script will prevent the '''ScriptEffectFinish''' block from running when the Magic Effect script ends.
== Constant Enchantments ==
Unfortunately, this block won't fire when used as a scripted effect for constant (apparel) enchantments. If you need a constant enchantment, you can use two scripts to accomplish the effect. Put one script on the item to have the enchantment and use the OnEquip and OnUnEquip blocks to add and remove an ability. The script will look like this:
scriptname MyCoolConstantEnchScript
ref Wearer
Begin OnEquip
set Wearer to GetContainer
Wearer.AddSpell MyCoolConstantEnchAbility
End
Begin OnUnEquip
set Wearer to GetContainer
Wearer.RemoveSpell MyCoolConstantEnchAbility
End
Then, you create the ability and give it a scripted effect. Use the ScriptEffectUpdate block in the script to run the scripted enchantment that you wanted for the item. Remember to code for speed, as this block will be run every frame as long as the player is near.




Line 8: Line 31:
[[ScriptEffectStart]]
[[ScriptEffectStart]]


[[ScriptEffectDone]]
[[ScriptEffectFinish]]


[[Category: Commands]]
[[Category: Blocktypes]]

Latest revision as of 00:48, 26 August 2007

Usage

 Begin ScriptEffectUpdate 

Special block type used only by Magic Effect scripts. This block will start running on the first iteration of a scripted spell effect and run each time the spell is updated until the spell ends.

Note:

  • A ScriptEffectUpdate block with an active Return statement placed before a ScriptEffectFinish block in a Magic Effect script will prevent the ScriptEffectFinish block from running when the Magic Effect script ends.


Constant Enchantments[edit | edit source]

Unfortunately, this block won't fire when used as a scripted effect for constant (apparel) enchantments. If you need a constant enchantment, you can use two scripts to accomplish the effect. Put one script on the item to have the enchantment and use the OnEquip and OnUnEquip blocks to add and remove an ability. The script will look like this:

scriptname MyCoolConstantEnchScript

ref Wearer

Begin OnEquip
	set Wearer to GetContainer
	Wearer.AddSpell MyCoolConstantEnchAbility
End

Begin OnUnEquip
	set Wearer to GetContainer
	Wearer.RemoveSpell MyCoolConstantEnchAbility
End

Then, you create the ability and give it a scripted effect. Use the ScriptEffectUpdate block in the script to run the scripted enchantment that you wanted for the item. Remember to code for speed, as this block will be run every frame as long as the player is near.


See Also[edit | edit source]

ScriptEffectStart

ScriptEffectFinish