Skip to main content

A colour gradient on a particle

You give the green visible buff particle gold tones from a gradient ramp. The material reads the brightness of the existing texture, so the particle keeps its soft shape.

Before you start​

Read the model​

Open the particle's ParticleProperty group. Its red, green, and blue curves give it one color: 0.2 red, 1.0 green, and 0.4 blue. SrcBlendType 5 and DestBlendType 6 make it alpha blended. TextureFiles names universalled.dds, beside the effect in the locale pack.

Check. Find the three color curves, the blend values, and the texture name.

Step 1: create the material​

Create the material beside the effect. It selects a shared ramp and tells the particle how to sample it.

  • Family emissive_particle selects the particle material family. Family is required.
  • Emission 1.0 leaves the sampled color at its original intensity. Keep it at 1.0 for this alpha blended particle: a higher value can turn it into an opaque glowing sheet.
  • Gradient names the shared gilded.dds ramp.
  • GradientMode replace uses the ramp color in place of the .mse color curves.
  • GradientInput brightness samples the ramp using the texture's brightness. A pure white texture would give one flat color.
  • GradientGain 1.2 scales the brightness used to choose a point on the ramp.
  • GradientLifeShift 0.2 shifts that point as the particle ages.

The ramp position is GradientGain times texel brightness, minus GradientLifeShift times particle life, clamped from 0 to 1. The sampled color is multiplied by texel brightness and Emission; black texels stay black. Alpha still comes from the texture and the particle's alpha curve.

Check. The material has all seven keys inside Group Effect, and Gradient points to gilded.dds.

Step 2: name the material from the effect​

Add MaterialFile immediately after StartTime in the root of Group Particle. The relative path resolves beside the .mse. The affect still names the same effect; the effect now names the material.

Check. The marked line reads MaterialFile "visible_buff.msfvx", and both files are in locale/universal/effect/.

Step 3: put the effect on a weapon​

The affect is not the only place that plays an effect. Each row of locale/universal/item_effect.txt gives an item an effect, and a row that names an .msattach bundle attaches everything the bundle lists. The bundle below plays visible_buff.mse, and with it the material you just added.

File is resolved beside the bundle, like MaterialFile. Bone is optional and left out here.

Now open locale/universal/item_effect.txt. Each row has three columns separated by tabs: the item vnum, a bone, and the effect path. A bundle row must leave the bone as - (or empty); any other bone is refused with bundle bone must be '-' or empty. Add one row at the end of the file, using real tab characters between the columns:

447<TAB>-<TAB>locale/universal/effect/visible_buff.msattach

Vnum 447 is a weapon that already has rows in the file. Bundle rows attach only for weapon, rage weapon and armour items, and the vnum must exist in the item prototype table. A row with fewer or more than three columns is skipped without a message, so a row typed with spaces does nothing.

Check. The new row has exactly two tab characters, the middle column is -, and the last column ends in .msattach.

Check your work​

If you have an engine repository checkout, run its MSE validator on the three effect files. It is agent tooling in that repository and is not shipped with a client. It runs without a client and returns a nonzero exit code on an error:

python validate_mse.py locale/universal/effect/visible_buff.mse locale/universal/effect/visible_buff.msfvx locale/universal/effect/visible_buff.msattach

A debug client build can also have an F11 Cosmetics panel for playing effects and comparing materials. The panel exists only in builds configured for it.

A normal client has neither the validator nor the F11 panel. Pack the locale folder with your client pack step, restart the client, look at the effect in game, and read the client log.

Run it​

Pack the locale folder and restart both clients. On the character with the visible buff, type /vbuff on. You should see gold tones from the ramp instead of the flat green, with the same soft shape.

Equip a character with a vnum 447 weapon and look at it. The same effect now plays from the weapon as well as from the affect.

For an A/B comparison, delete the MaterialFile line, repack, and restart both clients. The plain green effect returns, on the affect and on the weapon. Add the line back, repack, and restart to restore the material. Materials are read when the effect loads, so restart after each change.

If the result is still plain, read the client log. A misspelled material key produces a line like this:

Cosmetic material: locale/universal/effect/visible_buff.msfvx: key 'emision': unknown key

A material missing from the pack produces:

Cosmetic material: locale/universal/effect/visible_buff.msfvx: key 'file': resource not found or malformed

A missing ramp produces:

Cosmetic textures: ramp 'd:/ymir work/special/cosmetics/ramps/gilded.dds': missing file; neutral index 0 is used

Conflicting material references produce:

Effect '<mse path>' has conflicting material references

Fix the named file or reference, repack, and restart both clients. A bad or missing material leaves the plain effect; a missing ramp uses the neutral ramp.

Where to go next​

BoundingSphereRadius   0.000000
BoundingSpherePosition 0.000000 0.000000 0.000000

Group Particle
{
    StartTime           0.000000
    List TimeEventPosition
    {
        0.000000 "MOVING_TYPE_DIRECT" 0.000000 0.000000 124.546997
    }
    
    Group EmitterProperty
    {
        MaxEmissionCount        1
    
        CycleLength             0.500000
        CycleLoopEnable         1
        LoopCount               0
    
        EmitterShape            0
        EmitterAdvancedType     0
        EmitterEmitFromEdgeFlag  0
        EmittingDirection       0.000000 0.000000 0.000000
    
        List TimeEventEmittingSize
        {
            0.000000 0.000000
        }
        List TimeEventEmittingAngularVelocity
        {
            0.000000 0.000000
        }
        List TimeEventEmittingDirectionX
        {
            0.000000 0.000000
        }
        List TimeEventEmittingDirectionY
        {
            0.000000 0.000000
        }
        List TimeEventEmittingDirectionZ
        {
            0.000000 0.000000
        }
        List TimeEventEmittingVelocity
        {
            0.000000 3.000000
        }
        List TimeEventEmissionCountPerSecond
        {
            0.000000 60.000000
        }
        List TimeEventLifeTime
        {
            0.000000 2.216495
        }
        List TimeEventSizeX
        {
            0.000000 120.000000
        }
        List TimeEventSizeY
        {
            0.000000 120.000000
        }
    }
    
    Group ParticleProperty
    {
        SrcBlendType                 5
        DestBlendType                6
        ColorOperationType           4
        BillboardType                1
        RotationType                 0
        RotationSpeed                500.000000
        RotationRandomStartingBegin  0
        RotationRandomStartingEnd    0
    
        AttachEnable                 1
        StretchEnable                0
    
        TexAniType                   0
        TexAniDelay                  0.029000
        TexAniRandomStartFrameEnable 0
    
        List TimeEventGravity
        {
            0.000000 0.000000
        }
        List TimeEventAirResistance
        {
            0.000000 0.000000
        }
        List TimeEventScaleX
        {
            0.000000 0.250000
            0.500000 0.260000
            1.000000 0.250000
        }
        List TimeEventScaleY
        {
            0.000000 0.450000
            0.500000 0.460000
            1.000000 0.450000
        }
        List TimeEventColorRed
        {
            0.000000 0.200000
        }
        List TimeEventColorGreen
        {
            0.000000 1.000000
        }
        List TimeEventColorBlue
        {
            0.000000 0.400000
        }
        List TimeEventAlpha
        {
            0.000000 0.900000
            0.150000 0.700000
            0.500000 1.000000
            0.760000 0.700000
            1.000000 0.900000
        }
        List TimeEventRotation
        {
            0.000000 0.000000
        }
        List TextureFiles
        {
            "universalled.dds"
        }
    }
}