Yesterday I decided to make a light effect and attach it to the lamp bundle object. It didn't want to attach in no way, but there weren't errors in debugger log, and the effect worked separately (with Object.create command).
I spent more than 2 hours (!!!) trying to understand what the crap was there. Finally I decided to use e_ExFumeFact effect which is attached to Factory_m1 bundle and to change its parameters consistently in line with my effect. And this is what turned out:
1. if TimeToLive parameter for Emitter (sorry, not SpriteParticle, I've mistaken) is less than 0.1 (CRD_NONE), THE EFFECT IS NOT SHOWN WITH BUNDLE OBJECT. Separately it works!
2. If it's more than 0.1, then it's shown, but IT LOOKS LIKE THE SPRITEPARTICLE TEXTURE HAS NO ALPHA CHANNEL! Separately all is OK, alpha works!
My brain is broken...
HOW IS IT POSSIBLE??? One effect works well separately, but at the same time works like crap being attached to bundle object?! How?! Why?!
But! I remember one more occasion - I tried to make new water effect for Fletcher. And there was almost the same - it didn't appear if Intensity parameter was less than 4 (or 5, don't remember exactly).
So, did anyone face this?
How is it possible? Effect problems
How is it possible? Effect problems
Last edited by one on Tue Oct 16, 2012 9:56 pm, edited 1 time in total.
- Apache Thunder
- Posts: 1213
- Joined: Mon Oct 19, 2009 2:48 am
- Location: Levelland Texas, USA
- Contact:
Re: How is it possible? Effect problems
One of my mods has plenty of stuff like this. Perhaps this will help:
They tend to work best when the bundle that the effect is being addTemplated to has some kind of geometry, So hopefully you are addTemplating this directly to the lamp. If the lamp uses a lod object, be sure to instead put the effect on the main template that the lod system uses for near distance.
Also note the "NULL_OBJECT" references I added to the effect bundle are a seperate dummy object I created. Their only purpose is to extend the "bounds" of the object so that the effect is ALWAYS rendered. Due to the slow refresh rate of the effect, it would be quite noticable to turn away from a lamp, then turn back and see that it's off and then one second later it turns on again.
The game takes the virtual bounds of the object (the size basically) into consideration on whether or not an effect will be active. BF42 disabled any effect that it decides is not in the camera view area.
Also, I've never been able to get an emitter to emit sprites if the timeToLive setting was 1 second or less. Hence why I used 1.001. On things like projectiles it lets you use faster times and more sprites. But BF42 is quite restrictive with statics unfortunately. You can still spawn lots of sprites. Just not have an emitter emit anything in a time span that is equal or shorter then one second.
Code: Select all
ObjectTemplate.create EffectBundle e_glow
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.cullRadiusScale 5
rem ------------------------------------
ObjectTemplate.addTemplate Em_glow
rem ------------------------------------
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 1024/0/0
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 1024/0/1024
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 0/0/1024
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 0/1024/0
ObjectTemplate.addTemplate NULL_OBJECT
ObjectTemplate.setPosition 0/-1024/0
rem ------------------------------------
ObjectTemplate.timeToLive CRD_NONE/-1/0/0
ObjectTemplate.create Emitter Em_glow
ObjectTemplate.template Fx_glow
ObjectTemplate.lodDistance 512
ObjectTemplate.timeToLive CRD_NONE/1.001/0/0
ObjectTemplate.intensity CRD_NONE/1/0/0
ObjectTemplate.relativePositionInUp CRD_NONE/0/0/0
ObjectTemplate.looping 1
ObjectTemplate.noPhysics 1
ObjectTemplate.startProbability 1
ObjectTemplate.startAtCreation 1
ObjectTemplate.create SpriteParticle Fx_glow
ObjectTemplate.texture glow
ObjectTemplate.cullRadiusScale 5
ObjectTemplate.useMipMaps 0
ObjectTemplate.timeToLive CRD_NONE/1.001/0/0
ObjectTemplate.size CRD_NONE/1/0/0
ObjectTemplate.gravityModifier CRD_NONE/0/0/0
ObjectTemplate.rotationSpeed CRD_NONE/0/0/0
ObjectTemplate.hasStaticColor 1
Code: Select all
ObjectTemplate.create Bundle light_post_glow_02
ObjectTemplate.geometry light_post_glow_02_m1
rem ---------------------------------------
ObjectTemplate.addTemplate e_glow
Also note the "NULL_OBJECT" references I added to the effect bundle are a seperate dummy object I created. Their only purpose is to extend the "bounds" of the object so that the effect is ALWAYS rendered. Due to the slow refresh rate of the effect, it would be quite noticable to turn away from a lamp, then turn back and see that it's off and then one second later it turns on again.
The game takes the virtual bounds of the object (the size basically) into consideration on whether or not an effect will be active. BF42 disabled any effect that it decides is not in the camera view area.

Also, I've never been able to get an emitter to emit sprites if the timeToLive setting was 1 second or less. Hence why I used 1.001. On things like projectiles it lets you use faster times and more sprites. But BF42 is quite restrictive with statics unfortunately. You can still spawn lots of sprites. Just not have an emitter emit anything in a time span that is equal or shorter then one second.



I have cameras in your head!
Re: How is it possible? Effect problems
Thanks for your reply and sorry for late mine. So, what do I have:
objects.con:
effects.con:
What I get using debugger (with object.create command):

The bundle really looks like this (with such borders and line on the top).
objects.con:
Code: Select all
ObjectTemplate.create Bundle LampLight
ObjectTemplate.geometry rooflamp1_m1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.addTemplate e_NightLight
ObjectTemplate.startoneffects 1
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.setRotation 0/0/0
effects.con:
Code: Select all
rem *** e_NightLight ***
ObjectTemplate.create EffectBundle e_NightLight
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.timeToLive CRD_NONE/-1/0/0
rem -------------------------------------
ObjectTemplate.addTemplate Em_NightLight
rem -------------------------------------
rem *** Em_NightLight ***
ObjectTemplate.create Emitter Em_NightLight
ObjectTemplate.template Fx_NightLight
ObjectTemplate.looping 1
ObjectTemplate.startAtCreation 1
ObjectTemplate.lodDistance 1200
ObjectTemplate.timeToLive CRD_NONE/0.12/0/0
ObjectTemplate.intensity CRD_NONE/10/0/0
ObjectTemplate.relativePositionInDof CRD_UNIFORM/0/0/0
ObjectTemplate.relativePositionInUp CRD_UNIFORM/0/0/0
ObjectTemplate.relativePositionInRight CRD_UNIFORM/0/0/0
ObjectTemplate.positionalSpeedInDof CRD_UNIFORM/0/0/0
ObjectTemplate.positionalSpeedInUp CRD_UNIFORM/0/0/0
ObjectTemplate.positionalSpeedInRight CRD_UNIFORM/0/0/0
ObjectTemplate.startRotation CRD_NONE/0/0/0
rem *** Fx_NightLight ***
ObjectTemplate.create SpriteParticle Fx_NightLight
ObjectTemplate.timeToLive CRD_NONE/9999/0/0
ObjectTemplate.size CRD_NONE/1.7/0/0
ObjectTemplate.gravityModifier CRD_UNIFORM/0/0/0
ObjectTemplate.sizeOverTime 0/1|100/1
ObjectTemplate.drag CRD_NONE/0/0/0
ObjectTemplate.gravityModifierOverTime 0/1|100/1
ObjectTemplate.texture e_flash
ObjectTemplate.initRotation CRD_UNIFORM/0/0/0
ObjectTemplate.destBlendMode BMOne
ObjectTemplate.rotationSpeed CRD_UNIFORM/0/0/0
ObjectTemplate.rotationSpeedOverTime 0/1|100/1
ObjectTemplate.colorRGBAOverTime 0/255/255/128/167|100/255/255/128/167
What I get using debugger (with object.create command):

The bundle really looks like this (with such borders and line on the top).
Re: How is it possible? Effect problems
Tried your code and it worked. Then started to change parameters consistently trying to find what causes that strange result and suddenly realized that TimeToLive for SpriteParticle is 9999... Lol.
But I didn't notice that earlier because I couldn't understand why behaviour of effect was different in two cases - when addTemplated and separate. And I still don't understand it
So, if TimeToLive for SpriteParticle is 9999, then it won't disappear, SpriteParticles will accumulate and finally you'll see that strange pixelized sphere at my picture above. Everything is clear in this case. But when you create effect separately that doesn't happen. SpriteParticles don't accumulate, and effect doesn't change, it looks invariable. Maybe it's result of StartOnEffects property, I can't check now...
Oh, of course, thank you very much
But I didn't notice that earlier because I couldn't understand why behaviour of effect was different in two cases - when addTemplated and separate. And I still don't understand it

So, if TimeToLive for SpriteParticle is 9999, then it won't disappear, SpriteParticles will accumulate and finally you'll see that strange pixelized sphere at my picture above. Everything is clear in this case. But when you create effect separately that doesn't happen. SpriteParticles don't accumulate, and effect doesn't change, it looks invariable. Maybe it's result of StartOnEffects property, I can't check now...
Oh, of course, thank you very much
