img



img

Particle Effects


By: Erinthe
Addon | img 144




Description

___________________________________________________________________________________________________________________________

This framework uses Content Patcher to designate custom particle effects to:

 

  • farmers wearing specific equipment or wielding specific tools / weapons
  • specific-named NPCs
  • specific-named objects
  • specific coordinates on a named game location


Since Content Patcher allows for its own customization, the above can be more finely-tuned to, e.g. time, day, season, etc.


Creating Particle Effects
Content Patcher syntax should be something like:

        {
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Action": "EditData",
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Target": "Mods/aedenthorn.ParticleEffects/dict",
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Entries": {
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"aedenthorn.CPParticleEffects/heartCat": {
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"type":"object",
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"name":"Statue Of Endless Fortune",
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"movementType":"random",
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"movementSpeed": 1,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"frameSpeed": 0.05,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"acceleration":0,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"minRotationRate":0.05,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"maxRotationRate":0.05,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"particleWidth":11,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"particleHeight":10,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"fieldOuterWidth": 128,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"fieldOuterHeight":256,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"fieldOffsetY": -32,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"belowOffset": 0.001,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"aboveOffset": 0.001,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"minParticleScale": 2,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"maxParticleScale": 2,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"particleChance": 0.1,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"maxParticles": 20,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"minLifespan": 80,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"maxLifespan": 160,
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"spriteSheetPath": "Mods/aedenthorn.ParticleEffects/heart",
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;},
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Action": "Load",
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"Target": "Mods/aedenthorn.ParticleEffects/heart",
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;"FromFile": "assets/heart.png"
<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}



Don't change "Target", that's the mod's dictionary path.

The entry key must be unique.

Value fields:

 

  • type: the type of thing to target; one of "object", "npc", "location", "hat", "shirt", "boots", "pants", "tool", "ring"
  • name: the name or id of the specific thing of type to target
  • movementType: how particles move; one of "none", "away", "towards", "up", "down", "left", "right", "random"
  • movementSpeed: how many pixels a particle moves per tick
  • acceleration: how many pixels / tick the movement speed increases per tick
  • frameSpeed: how many animation frames change per tick (see textures below)
  • restrictOuter: whether particles disappear when they move outside the field (default false)
  • restrictInner: whether particles disappear when they move inside the inner boundary (default false)
  • belowOffset: if set to > 0, allows particles to move behind the thing by the given layer depth offset (default -1
  • aboveOffset: if set to > 0, allows particles to move in front of the thing by the given layer depth offset (default 0.001)
  • minRotationRate: if set to > 0, allows particles to rotate around their center
  • maxRotationRate: if set to > 0, allows particles to rotate around their center
  • minAlpha: allows transparency (default: 1)
  • maxAlpha: allows transparency (default: 1)
  • particleWidth: the width of each particle on the sprite sheet (see textures below)
  • particleHeight: the height of each particle on the sprite sheet (see textures below)
  • fieldOuterRadius: if set to > 0, specifies a circular particle spawn field and sets the outer radius of the field
  • fieldInnerRadius: if set to > 0, sets the inner radius of the field
  • fieldOuterWidth: if fieldOuterRadius is set to 0, designates the outer width of the rectangular particle field
  • fieldOuterHeight: if fieldOuterRadius is set to 0, designates the outer height of the rectangular particle field
  • fieldInnerWidth: if set to > 0, sets the inner width of the rectangular particle field
  • fieldInnerHeight: if set to > 0, sets the inner height of the rectangular particle field
  • fieldOffsetX: for locations, specifies the X coordinate of the field center on the map; for everything else, specifies the field X offset from the thing's center
  • fieldOffsetY: for locations, specifies the Y coordinate of the field center on the map; for everything else, specifies the field Y offset from the thing's center
  • maxParticles: sets the maximum number of simultaneous particles in a field
  • minLifespan: minimum number of ticks a particle lives
  • maxLifespan: maximum number of ticks a particle lives
  • minParticleScale: minimum scale of each particle in the field
  • maxParticleScale: maximum scale of each particle in the field
  • particleChance: the chance (0 to 1) that a new particle will be created, checked each tick
  • spriteSheetPath: the fake path to this particle's spritesheet, caught by your Content Patcher pack (as in the example above).



Textures

Your sprite sheets should be created with frames horizontally and alternatives vertically.

So, say your particles are 3x3 pixels each, each particle has ten frames, and there are five alternative sprites to choose from for each particle, then your sprite sheet texture should be 30x15 pixels in size: ten frames across x five alternatives down.

The mod will choose an alternative randomly for each particle if there are multiple alternatives.


API

There is a SMAPI API you can use in other SMAPI mods. The methods you can access are:

        public void BeginFarmerParticleEffect(long farmerID, string key);
        public void EndFarmerParticleEffect(long farmerID, string key);
        public void BeginNPCParticleEffect(string npc, string key);
        public void EndNPCParticleEffect(string npc, string key);
        public void BeginLocationParticleEffect(string location, int x, int y, string key);
        public void EndLocationParticleEffect(string location, int x, int y, string key);
        public List GetEffectNames();

x and y are pixel positions on the map.


Notes

There's an example pack in the files section.




About Project

Created: September 6th 2023

Updated: September 6th 2023

Project ID: 32492

License: All Rights Reserved

__________________________________________

Game Versions:

1.01.03

1.01.03

1.01.03

1.01.03

1.01.03

__________________________________________

Flavors:

WoW Retail

__________________________________________

Categories

Companions

Battle

__________________________________________

Main File

Erinthe_Particle Effects.zip
  • Release
  • September 6th 2023

    __________________________________________

    Recent File

    Erinthe_Particle Effects.zip
  • Release
  • September 6th 2023

    __________________________________________

    Members

    img
    Erinthe
    Owner

    __________________________________________

    Report