MAXScript Extensions > MAXScript Extensions for Particle Flow > Particle Flow Script Examples > Particle Channel Scripts >

# particleFloat Sample Script

| Particle Flow - Quick Navigation

Description:

The following script sets each particle's float value as one tenth of its particle ID, or birth index number.

Can Be Used With:

Can be used to control the .Force value of Force and Speed_Keep_Apart Operators.

Force : Helper

Speed_Keep_Apart : Helper

Effect:

The first particles get a low float value, and thus a low Influence value, and each successive particle gets a larger float value than the one before. As a result, the later a particle is born, the more subject it is to the space warp(s) in the operator.

EXAMPLE
    --The ChannelsUsed handler defines the channels
    --to be made available to the script.
    --For the list of all channels, see
    --Interface: MaxscriptParticleContainer
    --The parameter pCont passed to the handler
    --contains the Particle Container the script is applied to
    on ChannelsUsed pCont do
    (
    pCont.useFloat = true--enable the Float channel
    )

    --The Init handler is called on initialization.
    --It is not used in this case.
    on Init pCont do
    (
    )

    --The Proceed handler contains the main script
    --applied to the Particles.
    --The parameter pCont passed to the handler
    --contains the Particle Container the script is applied to:
    on Proceed pCont do
    (
    --Get the number of particles
    count = pCont.NumParticles()

    --Loop from 1 to the number of particles:
    for i in 1 to count do
    (

    --Set the particle index in the container to the current i value.
    --This makes the i-th particle in the container the current one
    pCont.particleIndex = i

    --Set the particleFloat channel value of the current particle
    --to the particleID of the current particle divided by 10.0.
    --The younger the particle, the higher the particleFloat value.
    pCont.particleFloat = pCont.particleID/10.0
    )--end i loop
    )--end Proceed

    --The Release handler is used to do cleanup work.
    --Not used in this case.
    on Release pCont do
    (
    )

#### See Also

- Interface: MaxscriptParticleContainer

- Force : Helper

- Speed_Keep_Apart : Helper

- Using MAXScript in Script Actions

- Particle Flow Sample Scripts