Spells Tutorial

From Gothongs Wiki
Revision as of 15:34, 29 July 2023 by Panda (talk | contribs) (→‎Visuals)
Jump to navigationJump to search

Find the spells listing on your mod page and click New Spell. Fields explained:

Field Explanation
Name Name your spell. Do not make it too long so it will fit in the spell icon.
Mana Mana cost. This can be set to negative as a lazy way to make a spell restore mana.
CD Spell cooldown. Global cooldown set in class will be used if this is lower than that.
Range Spell range. Do not use more than 10. You can click melee and spell buttons to use the default values.
Cast time Cast time for spell in whole seconds. Use 0 for instant cast.
Texture Texture of your spell icon. You can get the got_spells.psd template here.
Charges Spells with cooldowns can have multiple charges. When the cooldown finishes it gains a charge. Many tank and instant cast spells use this.
Stance Override Allows you to override the default stance for your class.
Opponents Allow spell to target enemies.
Caster Allow spell to target owner.
Friends Allow spell to target friendly targets.
No Facing Req By default you must face the target of your spell. With this checked you do not have to. Usually used on healing spells.
AoE Casts as an area effect.
No Global CD Does not trigger the global cooldown. This is often used on tank mitigation spells and ultimates.
No crits Spell cannot crit. Often used on DoT and HoTs and buffs.
Mobile Allows spells with a cast time to be used while moving.
Draw Weapon Causes the player to draw their weapon when using this ability.
Description Describe what your spell does.
Visual Sets visual effects that are rezzed, animations, and weapon trails. See below.
Spell Wrapper A wrapper to apply to the target (or AoE).
Self Wrapper A wrapper to apply to the caster. Useful on spell that have a target other than the caster that should also do something to the caster like restore mana or reduce the cooldown of a spell.
Passives Passives that are granted to the player when they have the class and spec that has this spell active.

Visuals

The Visual field should consist of an array structured as such:

[
  [ // Rezzables
    [
      (str)object_to_rez,
      (vec)pos_offset_from_target_center,
      (rot)rot_offset_from_target_facing,
      (int)flags
    ],
    ...
  ],
  (str/array)finish_cast_anim,
  (str/arr)finish_sounds,
  [ // Class vis / weapon trails
    -2, // This is needed for legacy reasons
    [ // These are passed to classAtt. See below.
      (int)cast_id,
      (int)finish_id
    ],
    [ // These specify weapon trails. See below for more info.
      [
        (int)generator_prim,      // default 0
        (int)age_100ths,          // Default 50
        (vec)color,               // Default <1,.5,.5>
        (int)scale_100ths,        // Default 30
        (int)alpha_10ths,         // Default 5
        (int)glow_10ths,          // Default 3
        (int)duration_100ths,     // Default 70
        (int)predelay_100ths,     // Default 30
      ],
      ...
    ]
  ],
  (str/arr)cast_anims,
  (str/arr)cast_sound
]

For more help on how to create visuals. See the Visuals tutorial.

Rezzables

This is an array of sub arrays containing items that should be rezzed when the spell cast is finished. Items are rezzed from the yellow effect repo below the HUD.

Position and rotation are relative to the avatar rotation and height. So <1,0,0.5> will always rez 1m in front of the avatar and 50% between pelvis and top of head.

Flags are defined in got SpellFX.lsl

Flag Hex Description
SpellFXFlag$SPI_FULL_ROT 0x1 By default the rotation calculations are only based on target Z rotation. If this is set, the projectile will also take avatar up/down rotation into consideration when rezzing.
SpellFXFlag$SPI_TARG_IN_REZ 0x2 Sets the on_rez integer of the rezzed prim to an integer version of the first 8 characters of the target UUID. This is used in many "bolt" type projectiles to fast scan for their target.
SpellFXFlag$SPI_SPAWN_FROM_CASTER 0x4 Only works on targeted spells. Spawn the projectile on the caster instead of the target. Useful for bolt type visuals.
SpellFXFlag$SPI_IGNORE_HEIGHT 0x8 By default the Z position is multiplied by avatar height/2. This will ignore that. So if you set a Z position of 0.5 then it always spawns 0.5m above target pelvis.

Finish cast anim

Finish sounds

ClassAtt vis

Weapon trails

Cast anims

Cast sound

SpellAux Constants