Effect Tutorial

From Gothongs Wiki
Revision as of 16:12, 28 July 2023 by Panda (talk | contribs)
Jump to navigationJump to search

Effects (FX) are the backbone of the game. They are the buffs that you see on your HUD and also used by direct damage and things behind the scenes like cutscenes.

Relevant scripts:

Script Description
_lib_fx.lsl Stores all the effect types and explains the effect types. Also stores a list of default values for passive effects (not to be confused with the passives system which is different). Also conditions and tags.
classes/got FX.lsl Has the methods, macros, and building tools for making effects.
classes/got FXCompiler.lsl Compiles effects into cached values and triggers LSL and RLV functions when effects are added or removed.

The structure of an effect

The effect data is a JSON array with the following spect:

  • (array) wrapper. An all or nothing container of multiple effect packages and stacks of packages.
    • (int) wrapper_flags
    • (int) min_packages
    • (int) max_packages
    • (strided) (int) package_stacks, (array) package_data
      • (int) Package duration
      • (int) Package flags
      • (str) Package name
      • (array) Effects
        • (int) Effect type
        • ...effect data
      • (array) Conditions
        • (int) Type of condition
        • ...condition data
      • (array) Events
        • (int) event_type
        • (str) event_script
        • (int) targ_flags
        • (int) max_targets
        • (array) wrapper (nested wrapper)
        • (array) event_params
        • (float) proc_chance
        • (int) event_flags
        • (float) max_range
        • (float) cooldown
      • (array) tags
      • (int) min_conditions
      • (int) max_stacks
      • (float) tick