Author Topic: Item_Torch emmiter help?  (Read 1603 times)

Code: [Select]
//item_Torch.cs

  datablock ParticleData(TorchFire : Fire A)
{
dragCoefficient      = 0;
gravityCoefficient   = -0.0;
inheritedVelFactor   = 0.0;
constantAcceleration = 0.0;
lifetimeMS           = 45;
lifetimeVarianceMS   = 0;
textureName          = "Add-Ons/Item_Torch/cloud.png";
spinSpeed = 0.0;
spinRandomMin = -0.0;
spinRandomMax = 0.0;
colors[0]     = "1.0 1.0 1.0 0.4";
colors[1]     = "1.0 1.0 1.0 0.0";
sizes[0]      = 0.85;
sizes[1]      = 0.85;

useInvAlpha = true;
};

datablock ParticleEmitterData(TorchFire : Fire AEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 0.0;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = TorchFire : Fire A;
};

//////////
// item //
//////////
datablock ItemData(Torch)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "Add-Ons/Item_Torch/Torch.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "Torch";
iconName = "Add-Ons/Item_Torch/icon_Torch";
doColorShift = true;
colorShiftColor = "1.0 1.0 1.0 1.0";

// Dynamic properties defined by the scripts
image = camcorderImage;
canDrop = true;
};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(camcorderImage)
{
   // Basic Item properties
   shapeFile = "Add-Ons/Item_Torch/Torch.dts";
   emap = true;


   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeoffset = "0.0 0.0 20.0";
   rotation = eulerToMatrix( "0 0 0" );

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = true;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = Torch;
   ammo = " ";
   projectile = gunProjectile;
   projectileType = Projectile;

casing = gunShellDebris;
shellExitDir        = "0.0 0.0 0.0";
shellExitOffset     = "0 0 0";
shellExitVariance   = 0.0;
shellVelocity       = 0.0;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;

   doColorShift = true;
   colorShiftColor = Torch.colorShiftColor;//"0.400 0.196 0 1.000";

   //casing = " ";


   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]      = "Ready";
stateEmitter[0]    = TorchFire : Fire AEmitter;
stateEmitterTime[0]    = 1000;
stateSound[0] = weaponSwitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "PreFire";
stateAllowImageChange[1]         = true;

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.2;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";


stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";


};

I'm trying to add the fire emmiter to the top and add a light.
« Last Edit: February 16, 2009, 01:33:40 PM by Green Link »

you can't have illegal characters in datablock names: ie. letters and numbers only, no spaces.

you can't have illegal characters in datablock names: ie. letters and numbers only, no spaces.
So, is that why the particles don't appear?

Agh, figures i'd mess something up

I never was good at fixing up scripts, let alone making them :o

Try this - I didn't understand some things like why a camcorder would be on fire, but it should be a little better.
Code: [Select]
//item_Torch.cs

  datablock ParticleData(TorchFire:Fire AParticle)
{
dragCoefficient      = 0;
gravityCoefficient   = -0.0;
inheritedVelFactor   = 0.0;
constantAcceleration = 0.0;
lifetimeMS           = 45;
lifetimeVarianceMS   = 0;
textureName          = "base/data/particles/cloud.png";
spinSpeed = 0.0;
spinRandomMin = -0.0;
spinRandomMax = 0.0;
colors[0]     = "1.0 1.0 1.0 0.4";
colors[1]     = "1.0 1.0 1.0 0.0";
sizes[0]      = 0.85;
sizes[1]      = 0.85;

useInvAlpha = true;
};

datablock ParticleEmitterData(TorchFire:Fire AEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 0.0;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = TorchFire;
};

//////////
// item //
//////////
datablock ItemData(Torch)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "Add-Ons/Item_Torch/Torch.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "Torch";
iconName = "Add-Ons/Item_Torch/icon_Torch";
doColorShift = true;
colorShiftColor = "1.0 1.0 1.0 1.0";

// Dynamic properties defined by the scripts
image = camcorderImage;
canDrop = true;
};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(camcorderImage)
{
   // Basic Item properties
   shapeFile = "Add-Ons/Item_Torch/Torch.dts";
   emap = true;


   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeoffset = "0.0 0.0 20.0";
   rotation = eulerToMatrix( "0 0 0" );

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = true;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = Torch;
   ammo = " ";
   projectile = gunProjectile;
   projectileType = Projectile;

casing = gunShellDebris;
shellExitDir        = "0.0 0.0 0.0";
shellExitOffset     = "0 0 0";
shellExitVariance   = 0.0;
shellVelocity       = 0.0;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;

   doColorShift = true;
   colorShiftColor = Torch.colorShiftColor;//"0.400 0.196 0 1.000";

   //casing = " ";


   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]      = "Ready";
stateEmitter[0]    = TorchFire;
stateEmitterTime[0]    = 1000;
stateSound[0] = weaponSwitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "PreFire";
stateAllowImageChange[1]         = true;

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.2;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";


stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";


};
Not sure if the spaces make a difference tbh :\
« Last Edit: February 16, 2009, 05:57:05 PM by Jervan »

You still didn't fix the spaces :o. And I think its FireAParticle and FireAEmitter

You still didn't fix the spaces :o. And I think its FireAParticle and FireAEmitter

I would go further and change them to something more unique, like TorchFireA1Particle or something, just so it doesn't overwrite anything.

Aren't the FireA names taken up by the basic brick emitter Fire A anyways?

Try this - I didn't understand some things like why a camcorder would be on fire, but it should be a little better
:o looks like he edited the Camcorder.cs xD

:o looks like he edited the Camcorder.cs xD
I did, I'll give Warren credit :P

I did, I'll give Warren credit :P
Hehe :3
Not like there's much there anyway, but yeah, it's only fair ^^

Well, It spawns, but I can't get fire on it.




I would go further and change them to something more unique, like TorchFireA1Particle or something, just so it doesn't overwrite anything.

Aren't the FireA names taken up by the basic brick emitter Fire A anyways?

He's trying to use the Copy Datablock function ("TorchFire : Fire AParticle") but doing it wrong, and it's kind of redundant since he redefines every parameter set for it anyway.

Also, the names for the Torch Fire particle and the names for the Torch Fire emitter are the same, which isn't good.