Jump to content
Sign in to follow this  
lethal

creating new particle sources/emitters?

Recommended Posts

I've been trying to create a few basic particle effects using scripts but so far i have only been partially successful:

Basically I have have been using the 'drop' command outlined here with an infinite loop. However when I look at this biki entry I get the impression there is a way to set up an object as a (permanent) particle emitter. I can't find any other sommands associated with it. Anybody know more about this?

Also, when looking through the default effects inside the config.ccp in ca.pbo, it seems that the drop command is limited in functionality and options it gives you and there are a few more properties inside the ccp that you can't define using it.

One other thing i'm confused about are the first two parameters of that command, "ShapeName" and "AnimationName". I haven't seen even one instance of the second one even being used in the config and the description of the first one found on the biki seems to be wrong/incomplete:

Take a look at "\Ca\data\ParticleEffects\SCRIPTS\SmokeTrail1.sqf" to get an example of what i mean; instead of a simple string an array is used here with the filename as the first parameter and 3 numbers attached. I guess those are for selecting which frames of the animation are used but for some reason they only work for "billboard"-type particles and not "SpaceObject" ones. When using the same parameters on a "SpaceObject" particle you get all the frames at once instead of only the ones you want which, needless to say, looks rather ugly.

Share this post


Link to post
Share on other sites

I too am interested in this because I was hoping this script could be used to produce a much more volumetric fire and smoke effect with smoke travelling much farther in air than the ingame object.

Share this post


Link to post
Share on other sites

FYI this is the script i'm using right now for testing purposes (I've broken up the long line of parameters for clarity and easier editing):

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_pos = _this select 0;

_obj = _this select 1;

;Global

;Name of the shape associated with the particle.

_ShapeName = "\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim";

;Name of the animation of the shape.

_AnimationName = "";

;Type of particle (either "Billboard" or "SpaceObject").

_Type = "Billboard";

;The period of calling the "OnTimer" event (in sec).

_TimerPeriod = 0.1;

;Life time of the particle (in sec).

_LifeTime = 240;

;Pysical

;Either 3D coordinate (x, y, z) or name of the selection - in this case the Object property must be set.

_Position = _pos;

;3D vector (x, y, z) which describes the velocity vector of the particle direction and speed in m/s.

_MoveVelocity = [0, 0, 0];

;Float number which determines number of rotations in one second.

_RotationVelocity = 0.1;

;Weight of the particle (kg).

_Weight = 1;

;Volume of the particle (m^3).

_Volume = 1;

;Float number without dimension which determines the impact of the density of the environment on this particle. 0 - no impact (vacuum).

_Rubbing = 4;

;Render

;Note: All these values are set as arrays to show their development in time. If you set the array [1, 2] as a size, then at the beginning the size of the particle will be 1 and at the end of the life time of the particle its size will be 2. The rest of the values during the life time will be linearly interpolated.

;Size of the particle in time to render (m)

_Size = [1, 100];

;Color of the particle in time to render (RGBA)

_Color = [[0.5, 0.5, 0.5, 0.2], [0.0, 0.0, 0.0, 0]];

;Phase of the animation in time.

_AnimationPhase =[0,1];

;Random

;Period of change of the velocity vector (s).

_RandomDirectionPeriod = 0.01;

;Each MoveVelocity component will be changed with random value from interval <0, RandomDirectionIntensity>.

_RandomDirectionIntensity = 0.1;

;Name of the script to run every period determined by TimerPeriod property. Position of the particle is stored in "this" variable.

_OnTimer = "";

;Name of the script to run right before destroying the particle. Position of the particle is stored in "this" variable.

_BeforeDestroy = "";

;Object to bind this particle to.

_Object = _obj;

#start

particle = drop [[_ShapeName,8,5,8], _AnimationName, _Type, _TimerPeriod, _LifeTime, _Position, _MoveVelocity, _RotationVelocity, _Weight, _Volume, _Rubbing, _Size, _Color, _AnimationPhase, _RandomDirectionPeriod, _RandomDirectionIntensity, _OnTimer, _BeforeDestroy, _Object]

~0.1

goto "start"

Share this post


Link to post
Share on other sites

Sorry, but that isn't really helping. i'm aware of those commands but none of them seem to do what i need; they look more like 'secondary' commands to define properties/variables etc. rather than actually create a particle source.

Share this post


Link to post
Share on other sites

not sure exactly what you require

1a source as in your own shape ?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _source setParticleParams ["\ca\data\cl_basic", "", "spaceobject", 1, 4, [-1, ((speed _vehicle)/20), -2], [0,0,0], 1, 1.3, 1, 0, [0.4, 5], _color, [0,1], 0, 0, "", "", _vehicle]

for that you would replace \ca\data\cl_basic with path to your own p3d

2 a source or point at which the particle is emitted from ?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_source = "#particlesource" createVehicleLocal [position _vehicle select 0, position _vehicle select 1, 0]

_source setParticleRandom [2, [0.5, 1, 0.5], [0, 0, 0], 0, [0.6, 2], [], 0, 0]

_source setDropInterval 0.03

all the info i have obtained on this is from

Quote[/b] ]"\Ca\data\SCRIPTS\TG.sqs"

Share this post


Link to post
Share on other sites
2 a source or point at which the particle is emitted from ?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_source = "#particlesource" createVehicleLocal [position _vehicle select 0, position _vehicle select 1, 0]

_source setParticleRandom [2, [0.5, 1, 0.5], [0, 0, 0], 0, [0.6, 2], [], 0, 0]

_source setDropInterval 0.03

I think that might be it. Thanks a lot smile_o.gif

still looking for answers to my other questions, too wink_o.gif :

Quote[/b] ]Also, when looking through the default effects inside the config.ccp in ca.pbo, it seems that the drop command is limited in functionality and options it gives you and there are a few more properties inside the ccp that you can't define using it.

One other thing i'm confused about are the first two parameters of that command, "ShapeName" and "AnimationName". I haven't seen even one instance of the second one even being used in the config and the description of the first one found on the biki seems to be wrong/incomplete:

Take a look at "\Ca\data\ParticleEffects\SCRIPTS\SmokeTrail1.sqf" to get an example of what i mean; instead of a simple string an array is used here with the filename as the first parameter and 3 numbers attached. I guess those are for selecting which frames of the animation are used but for some reason they only work for "billboard"-type particles and not "SpaceObject" ones. When using the same parameters on a "SpaceObject" particle you get all the frames at once instead of only the ones you want which, needless to say, looks rather ugly.

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_source = "#particlesource" createVehicleLocal _pos;

_source setParticleParams [[_ShapeName,8,5,8], _AnimationName, _Type, _TimerPeriod, _LifeTime, _Position, _MoveVelocity, _RotationVelocity, _Weight, _Volume, _Rubbing, _Size, _Color, _AnimationPhase, _RandomDirectionPeriod, _RandomDirectionIntensity, _OnTimer, _BeforeDestroy, _Object];

_source setDropInterval 0.1;

doesn't do anything i'm afraid to say sad_o.gif (no error msg either)

i tried looking up this "#particlesource" class but couldn't find anything... any further help?

the particlearray should work as i've tested it by using the "drop" command. it just won't create the particle emitter or it creates it but doesnt emit anything... at least nothing that i can see sad_o.gif

when i add <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_source setParticleRandom [2, [0.5, 2, 0.5], [0, 0, 0], 0, [1, 2], [], 0, 0];

i get this error msg:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">'_source |#|setParticleRandom [2, [0.5, 2, 0.5], [0,...'

Error Type Array, Expected Number

even though i've copied it 1:1 from TG.sqs...

is it possible that TG.sqs (and its contents) are obsolete and not working anymore?

Share this post


Link to post
Share on other sites

i cant be much help 8 i myself reverted back to old dropcommad after finding nil plus on any lag advantage and because i new drop command well and the particle imo is exactly the same but with array and names instead of numbers etc.

"\Ca\data\SCRIPTS\TG.sqs" is where i got info like i said.

#particlesource and #lightsource

i presumed where hardcoded somewhere and acepeted as they read a source at where your dropped effect will emit.

Share this post


Link to post
Share on other sites
i cant be much help 8 i myself reverted back to old dropcommad after finding nil plus on any lag advantage and because i new drop command well and the particle imo is exactly the same but with array and names instead of numbers etc.

"\Ca\data\SCRIPTS\TG.sqs" is where i got info like i said.

#particlesource and #lightsource

i presumed where hardcoded somewhere and acepeted as they read a source at where your dropped effect will emit.

np m8

do i understand you correctly - you got this working somehow with the "new" command instead of "drop" but decided agains it because of familiarity with the old one?

If so, could you please post a code snippet of what you did to get it working?

otherwise do you have any work you'd be willing to share using the "drop" command? i'm brainstorming for ideas on how to use it effectively and that could really help smile_o.gif

Share this post


Link to post
Share on other sites

what i was saying is,

the fire anim and such create a massive lag spike for me ,might be milisec ,but they use this anim and partcle effect ,

but when i use drop the od way its not so big and (this is personal pref), with johnsmoke and fire i get bette efect and less lag.

mandoble is the man to speak to on drop effects ,i basicly ripped hes work from ofpec in al my learning of drop. i hope has arma by now and is wel undeway to understanding it smile_o.gif.

i got same results as you with portng tg but it did give an effect despite the two errors, i put this down to eithe the way i executedthe script or some or of te variables was conflicting with the default use of tg by the object i tested it on, if that makes sense. i will try to de clutte the script i converted tomorrow

Share this post


Link to post
Share on other sites

i've been going nuts with the particle effects lately i wanted to share one more:

burningcar1eo8.jpg

burningcar2xb4.jpg

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×