Skip to content

LEGACY: Custom Effects

Tyler edited this page Feb 6, 2021 · 1 revision

Overview

As the name implies, custom effects are temporary buffs/debuffs which are applied to characters. They are a workaround due to the fact that effects are hard coded in NWN.

Adding Custom Effects

1.) Create a new row in the CustomEffects table.

  • CustomEffectID - the unique ID of the effect
  • Name - the name of the effect. This isn't displayed in-game.
  • IconID - Currently not used due to NWN limitations. Included here for completeness.
  • ScriptHandler - The class name of the Java script which will be used for applying, ticking, and removing the effect.
  • StartMessage - The message which displays when the effect is applied. If blank, no message will be sent in-game.
  • ContinueMessage - The message which displays every tick. If blank, no message will be sent in-game.
  • WornOffMessage - The message which displays when the effect wears off either naturally or by any other means. If blank, no message will be sent in-game.

2.) Add the new ID to the Enumerations.CustomEffectType class.

3.) Create a new class under the CustomEffect library. Name it the same thing as the ScriptHandler you entered in the database row.

4.) Implement the ICustomEffectHandler interface in your new class. This has three methods: Apply, Tick, and WearOff. Apply fires one time when the effect is applied to the target. Tick fires once every six seconds. WearOff fires one time after the effect has worn off - either naturally, or through any other means.

Applying Custom Effects

The CustomEffectSystem class has a method named ApplyCustomEffect. You simply call this whenever you want to apply an effect to a creature. Keep in mind not all effects are applicable to both NPCS and PCs.