Spells Tutorial: Difference between revisions
| Line 142: | Line 142: | ||
=== Finish cast anim === | === Finish cast anim === | ||
Either a single animation or an array of animations to play when the spell finishes casting. Should not loop. | |||
=== Finish sounds === | === 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 === | === ClassAtt vis === | ||
Todo... | |||
=== Weapon trails === | === Weapon trails === | ||
Todo... | |||
=== Cast anims === | === 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 sound === | === 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 == | == 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 put it into <> brackets. Examples: | |||
An effect array that does 10 damage: | |||
<pre> | |||
[ | |||
fx$DAMAGE_DURABILITY, | |||
"$M$10*D" | |||
] | |||
</pre> | |||
An effect array that heals 10 HP: | |||
<pre> | |||
[ | |||
fx$DAMAGE_DURABILITY, | |||
"$M$R*h*10" | |||
] | |||
</pre> | |||
Below is a full list of constants that you can use. | |||
Revision as of 15:42, 29 July 2023
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
Either a single animation or an array of animations to play when the spell finishes casting. Should not loop.
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
Todo...
Weapon trails
Todo...
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 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 put it into <> brackets. Examples:
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 full list of constants that you can use.