Cubemitter help

I was just wondering if anybody could elaborate on how to use cubemitters in models

I’m looking at stone_brazier.json as an example and it has the following code:

     "stonehearth:lamp" : {
     "light_effect" : "/stonehearth/data/effects/brazier_effect"
  },

I’ve created an effect and a cubemitter - the cubemitter works in SHED, so I put it in the following effect:

{
   "type" : "effect",
   "tracks": {
   "cubemitter": {
     "type": "cubemitter",
     "cubemitter": "particles/combat/beam.cubemitter.json",
     "loop": true,
     "transforms": {
        "x":0,
        "y":0,
        "z":0,
        "rx":0,
        "ry":90,
        "rz":0
     }
  }
 }
}

My question is, what steps do I need to perform to put this effect into my model? Do I need to pretend its a light effect, or is there a simpler way?

4 Likes

To the rescue–

stonehearth:lamp is the component which makes the effect activate at night and deactivate at day. If you want to run simple particle effects, you should write it like this:

"effect_list" : {
     "effects" : [
        "/sample_mod/data/effects/stone_fountain_effect/stone_fountain_effect.json",
		"/sample_mod/data/effects/stone_fountain_effect/stone_fountain_corners_effect.json"
     ]  
  }

inside the “components” section of your entity. But this is for static effects, that run once or loop forever. You can also run the effects in Lua like this,for example:

radiant.effects.run_effect(self._entity,'hit_stun')

There are other ways to run the effects in Lua files, just search for ‘run_effect’ in the files of the stonehearth folder.

3 Likes

Thanks, @Relyss!

All I wanted was a simple particle effect, hopefully I won’t make a debugger’s hell out of this one! :smile:

Update:

Alright, so I had a go at this. My effect is being triggered - I know this because the sound effect is activated - but unfortunately my game crashes to desktop due to the cubemitter.

2015-Feb-18 20:10:57.220400 | client |  0 |                renderer.renderer | failed to load render resource cubemitter:beam
2015-Feb-18 20:10:57.221400 | client |  0 |                              app | Assertion Failed: false(..\..\..\..\..\source\client\renderer\renderer.cpp:1593)
2015-Feb-18 20:10:57.643400 | server |  1 |         simulation.remote_client | started buffering client updates. (seq:1204 ack:1194)

I’ve tried fixing it by removing the path from the effect.json and making an alias for the emitter in my manifest, just to be sure I was specifying the right path.

I have a feeling it might have something to do with the effect being used on a moving object, but I don’t see why it should be an issue.

At this point, I might try to make a static object that runs my effect, and if that fails, use an effect known to work (fire, or something) on the static object. In the meantime, does anybody have other ideas as to what could be causing this crash?

Update #2:

It doesn’t work on the static object either… Must be either the cubemitter itself or my effect code. I’ll play around with this tomorrow! :slight_smile:

Thanks again!

Update #3:

Alright so this was festering in my mind and I had to deal with it now!

The problem was related to my cubemitter path. For some reason, it takes cubemitters from the stonehearth/data/horde/particles/ folder instead of from mod/data/horde/particles/

"type" : "effect",
  "tracks": {
  "cubemitter": {
     "type": "cubemitter",
     "cubemitter": "particles/fire/beam.cubemitter.json",
     "loop": true,
     "transforms": {
        "x":0,
        "y":0.5,
        "z":0,
        "rx":90,
        "ry":0,
        "rz":0
     }
  }

It works perfectly when I drop the effect into the ‘stonehearth’ /particle/ folder. Any ideas as to how I can force it to take the effect from my mod’s /particles/ directory? Am I doing something stupid?

(P.S. sorry if you’re getting annoying notifications from my edits!)

4 Likes

Just as a follow up for future modding reference… @phector2004 I know you’ve solved this already :slight_smile:

Anything dealing with effects, particles, shaders, ect, usually needs an absolute path to work.

"type" : "effect",
  "tracks": {
  "cubemitter": {
     "type": "cubemitter",
     "cubemitter": "/mymodfolder/$(path to emitter).json",
     "loop": true,
     "transforms": {
        "x":0,
        "y":0.5,
        "z":0,
        "rx":90,
        "ry":0,
        "rz":0
     }
}

:slight_smile:

3 Likes