Spells Tutorial
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.
(var)cast_id,
(var)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. It is recommended to start with an existing effect from the yellow FX prim below the HUD. Then modify that to your liking and set its name to something that matches your spell.
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. |
Non projectile visuals
Non projectile visuals are simple particle objects that check if on_rez is non-zero. If so it plays a sound, particles, and deletes itself after one or two seconds. Projectiles usually use the got Projectile.template script. It automates the projectile for you and you only have to specify sound and particles.
Finish cast anim
Either a single animation or an array of animations to play when the spell finishes casting. Should not loop. Finish cast animations often use priority 2 for full body, and an upper body only version of the same animation at priority 4.
Finish sounds
Either a single sound UUID or an array of sound UUIDs to play when the spell finishes casting. It may also consist of an array of arrays containing [(key)soundUUID, (float)volume].
ClassAtt vis
Classes often use a special class attachment. This is attached with a passive just like any other attachment. But they all contain got ClassAtt, got Portal and jas Attached from the HUD. And a got LocalConf script which is custom to the attachment. Your cast id and finish ID are passed to the gotClassAttEvt$spellStart and gotClassAttEvt$spellEnd events and are used to trigger the casting particles.
Weapon trails
If a weapon has been setup correct you can include a weapon trail. Most weapons have 3 spots where the trail can come from, starting from the tip and moving down towards the hand. The weapon trail array has the following fields:
| Index | Type | Default | Description |
|---|---|---|---|
| 0 | int | 0 | Which prim should be used. 0 = tip of weapon, 2 = closes to hand |
| 1 | int | 50 | Particle age in 100ths of a second. 50 = 0.5 seconds. Higher value gives longer trails. |
| 2 | vector | <1,.5,.5> | Color of trail |
| 3 | int | 30 | Particle size in centimeters. |
| 4 | int | 5 | Particle opacity in 10ths. 5 = 50%. |
| 5 | int | 3 | Particle glow in 10ths. 3 = 0.3 glow. |
| 6 | int | 70 | Generator duration in 100ths of a second. 70 = 0.7 seconds. |
| 7 | int | 30 | Predelay before starting to generate the particles in 100ths of a second. 30 = 0.3 seconds. |
Cast anims
Either a single animation or an array of animations to play when the player is casting. Should loop. Ignore if spell is instant cast. Cast loop animations often use a priority 1 base animation and a priority 3 only for upper body.
Cast sound
A sound key or an array of [(key)sound, (float)volume]. This sound will be looped while you are casting. Ignore this if the spell is instant cast. Can also be [0, (key)sound, (float)volume] if you do not want the sound to loop.
SpellAux Constants & Formulas
Spells have access to constants and math formulas from the got SpellAux.lsl script. To use a formula, you can set a value anywhere in your spell wrapper or self wrapper using the syntax "$M$formula". Damage types should always be multiplied by the constant D. Healing should be multiplied by R*h. To use a constant you just put it into the wrapper somewhere.
An effect array that does 10 damage:
[ fx$DAMAGE_DURABILITY, "$M$10*D" ]
An effect array that heals 10 HP:
[ fx$DAMAGE_DURABILITY, "$M$R*h*10" ]
Below is a list of variables that you can use in formulas.
| Symbol | Description |
|---|---|
| D | Complete damage done multiplier. Including temporary effects, difficulty, team size etc. Used for most damage spells. |
| R | Same as above but team size is ignored. Used for heals. |
| C | This is 1 if the spell was not critical, or 2 if it was critical. Baked into D and R. |
| A | Points of arousal the caster has. |
| P | Points of pain the caster has. |
| B | 0 if in front of target. 1 if behind target. |
| H | Cooldown modifier of spell. |
| M | Spell damage done modifier for the spell. Baked into D and R. |
| h | Healing done multiplier. |
| T | Team integer. 0 = player team, 1 = default NPC team etc. |
| ar | Total points of armor of sender each worn slot has 50 points. |
| nc | Random integer from 0 to 2 |
| hpp | HP percentage of caster. From 0 to 1. |
| mpp | Mana percentage of caster. From 0 to 1. |
| dtm | Damage taken modifier of caster. |
| mhp | Max HP of caster. |
| mp | Current mana points of caster. |
| mmp | Max MP of caster. |
| hp | Current HP of caster. |
| m | 1 if caster is in melee range of target. 0 if not in melee range of target. Use 1-m to invert. |
| r | Total range to the target in meters. |
| ehp | Target HP percentage from 0 to 100 |
| tm | 1 if target is in melee range, 0 if not. Use 1-tm to invert. |
Formulas that you should use in most spells:
| Formula | Description |
|---|---|
| 10*D | Always multiply damage effects by D to scale with team size and difficulty. In this example we deal 10 damage by default, but modified by difficulty/team etc. |
| R*h*-10 | Always multiply healing effects by R*h. It is the same as D except it ignores team size. Heals are not affected by nr of players in the party. Also multiplies by healing done (h). |
Constants. You can put these anywhere in the wrapper and it will be replaced by its value:
| Constant | Value |
|---|---|
| $T0$ | UUID of spell target. Differs from $TARG$ in that it contains the spell target both in Spell Wrapper and Self Wrapper. |
| $TARGET$ | UUID of target of wrapper. Note that this will be the caster in Self Wrapper. |
| $SELF$ | UUID of the caster. |
| $HT$ | Active HUD target. May differ from spell target. |
| $otI$ | Same as $T0$ except converted to an integer of the first 8 characters of UUID. |
| $tI$ | Same as $TARGET$ except converted to an integer of the first 8 characters of the UUID. |
| $sI$ | Caster HUD UUID converted to an integer of the first 8 characters. |
| $soI$ | Same as $sI$ except it uses the owner UUID instead of HUD UUID. |
| $aoeI$ | Used on AoE and is replaced when received by the RECIPIENT and set to the target UUID converted to an integer using the first 8 characters. |
Example: Paladin Divine Radiance
| Field | Value | Description |
|---|---|---|
| Name | Divine Radiance | |
| Mana | 0 | |
| CD | 8 | 8 second cooldown |
| Range | 10 | 10 meters |
| Cast time | 0 | Instant cast |
| Texture | 78bd1d5d-bd2e-a507-d0f0-9fbe12cf0ae3 | Button texture UUID |
| Charges | 1 | |
| Stance Override | <empty> | |
| Checkboxes | AoE | No others checked. Wrapper will be sent to every PC and NPC in range. |
| Description | Deals 30 damage to all enemies in front of you and generates high threat. Enemies weakened by judgment are interrupted and have the duration of weakness refreshed. Lowers the cooldown of Armor of Faith by 1 second. | |
| Visual | [
[
[
"DivineRadiance",
"<.25,0,.25>"
]
],
[
"radiance_ub",
"radiance"
],
"9c61aa88-1661-f309-b212-a761c6622fb8",
[
-2,
[
"",
"C"
]
]
]
|
Rez "DivineRadiance" from the spell FX prim. At 0.25m in front and 25% between pelvis and top of head.
Trigger animations "radiance" and "radiance_ub". The "radiance" animation is priority 2 and affects the whole body. "radiance_ub" is priority 4 and only affects upper body. Trigger sound "9c61aa88-1661-f309-b212-a761c6622fb8" on finish. Send nothing to ClassAtt on cast start, send ID "C" to got ClassAtt on finish. Localconf in the class attachment then checks for id "C" received and triggers the particles. |
| Spell Wrapper | [
64,
0,
0,
1,
[
0,
1,
"_56",
[
[
1,
"$MATH$30*D"
],
[
28,
30
]
],
[
[
0,
1
],
[
15,
1.57
]
]
],
0,
[
0,
1,
"_56b",
[
[
49,
1,
"_55d"
],
[
21
]
],
[
[
0,
1
],
[
15,
1.57
],
[
1,
"_55d"
]
]
]
]
|
Wrapper to send to affected targets. Wrapper flags are 64 (require line of sight). It includes 2 packages, both with 1 stack (0 and 1 both count as 1).
The first package has no duration and flag 1 (detrimental). ID "_56" (often set to the spell ID). It has two effect arrays: The first has type 1 (damage) and a value of "$MATH$30*D" which says "deal 30 damage modified by standard damage done modifiers". The second has type 28 (aggro) and adds a flat 30 threat to an NPC target. The first package has 2 conditions: Type 0 (require same team as sender) and value 1 (invert, so it requires other team). Type 15 (caster angle) and requires the target to be in front of the sender. The second package has also flag 1 (detrimental). It uses "_56b" to make both IDs unique. It has two effect arrays: Type 49 (fx$ADD_STACKS). Value 1 and "_55d". It adds 1 stack to package "_55d" (this is the weakness spell effect). Weakness has 1 stack max, but this also resets the duration timer. Type 21 (fx$INTERRUPT). Interrupts target spell casting. It has three condition arrays: Type 0 (same team), and value 1 to invert (other team). Type 15 (caster angle) and value 1.57 (PI_BY_TWO) which requires target to be in front of caster. Type 1 (has package by name) and value "_55d", requiring target to have the "_55d" effect package active to allow this package to be applied. |
| Self wrapper | [
0,
0,
0,
0,
[
0,
0,
0,
[
[
66,
16,
1
]
]
]
]
|
Runs an instant effect with no flags or name. It has one effect array:
Type 66 (fx$REDUCE_CD), value 16 (fx$REDUCE_CD takes a bitwise argument, ability 4 has value 16), and value 1 to reduce the cooldown by 1 second. |
| Passives | [] | No passives |