Difference between revisions of "ScriptEffectUpdate"
imported>Slserpent (some code to accomplish constant scripted enchantments) |
imported>Slserpent (formatting) |
||
Line 5: | Line 5: | ||
== 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 | scriptname MyCoolConstantEnchScript | ||
Line 11: | Line 13: | ||
ref Wearer | ref Wearer | ||
Begin OnEquip | |||
set Wearer to GetContainer | set Wearer to GetContainer | ||
Wearer.AddSpell MyCoolConstantEnchAbility | Wearer.AddSpell MyCoolConstantEnchAbility | ||
End | End | ||
Begin OnUnEquip | |||
set Wearer to GetContainer | set Wearer to GetContainer | ||
Wearer.RemoveSpell MyCoolConstantEnchAbility | 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. | 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== | ==See Also== |
Revision as of 15:08, 1 July 2006
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.
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.