Game Development Community

Create a successful bullet hit bleeding.

by Szzg007 · in Torque 3D Professional · 01/05/2012 (7:53 am) · 43 replies

First one..I need thanks for Frank carney and Michael Hall help me.here.
www.garagegames.com/community/forums/viewthread/129268

make new a Particle..

datablock ParticleData(bloodBulletDirtSpray)
{
   textureName          = "art/shapes/particles/FXpack1/dirt";
   dragCoefficient      = "0.667";
   gravityCoefficient   = "0";
   lifetimeMS           = "250";
   lifetimeVarianceMS   = "0";
   spinRandomMin = -120.0;
   spinRandomMax =  120.0;
   useInvAlpha   = true;
   
   colors[0]     = "0.590551 0 0.00787402 1";
   colors[1]     = "0.992126 0 0.015748 1";
   colors[2]     = "0.322835 0 0.00787402 0.291339";

   sizes[0]      = "0.299091";
   sizes[1]      = "0.799609";
   sizes[2]      = "1.19941";

   times[0]      = 0.0;
   times[1]      = "0.494118";
   times[2]      = 1.0;
   animTexName = "art/shapes/particles/FXpack1/dirt";
   
};
datablock ParticleEmitterData(bloodBulletDirtSprayEmitter)
{
   ejectionPeriodMS = "5";
   periodVarianceMS = "0";
   ejectionVelocity = "5";
   velocityVariance = "5";
   thetaMin         = "0";
   thetaMax         = "360";
   particles = "bloodBulletDirtSpray";
   gravityCoefficient = "3.99756";
   lifetimeMS = "10";
   lifetimeVarianceMS = "0";
   spinRandomMin = "-140";
   spinRandomMax = "140";
   useInvAlpha = "1";
   blendStyle = "NORMAL";

};

and add New decaldata
datablock DecalData(bloodDecalData)
{
   Material = "YoubloodMaterial";
....
};
Find game/scripts/server/player.cs
function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
//add effectFX for here...
//do decals
   %Decalposition = VectorAdd(getRandom(-1, 1) SPC getRandom(-1, 1) SPC "0", %obj.getPosition()); 
   %normal = "0.0 0.0 1.0";
   %decalObj = decalManagerAddDecal(%Decalposition, %normal, getRandom(360), getRandom(2), bloodDecalData, false);
   //do decals
   %particles = new ParticleEmitterNode() 
   {
      position = %position;
      rotation = "1 0 0 0";
      scale = "1 1 1";
      dataBlock = "bloodNodeData";
      emitter = "bloodBulletDirtSprayEmitter";
      velocity = "1";
   };
   MissionCleanup.add(%particles.schedule(1000, "delete"));
   
//..... other code...
Show is here..
i461.photobucket.com/albums/qq338/szzg007/screenshot_001-00002.png
Page «Previous 1 2 3 Last »
#2
01/05/2012 (9:26 am)
Kill Bill simulator here we come!
Good work!
#3
01/05/2012 (4:09 pm)
Great work - looks like you'll need a towel, though....
#4
01/05/2012 (6:08 pm)
It's just a flesh wound.
#5
01/05/2012 (7:52 pm)
nice!
#6
01/07/2012 (3:09 am)
Nice work. Torque has been missing this in its examples for a while!
#7
01/24/2012 (3:24 pm)
This causes:GameBase::setDatablockProperty - Could not find data block "bloodNodeData"

What kind of data block does this need to be?
#8
01/26/2012 (6:49 am)
I think that's going to need a ParticleEmitterNodeData datablock. Toward the end of Lesson 3 in the FPS Tutorial we covered particles - should be able to create a new "bloodNodeData" and add the blood particles to it.
#9
01/26/2012 (9:28 am)
Use the DefaultEmitterNodeData datablock found in "art/datablocks/particles.cs" instead of bloodNodeData. It is not necessary to duplicate another ParticleEmitterNodeData datablock unless you plan on modifying the timeMultiple property. If you do create a duplicate you have to make sure that it's exec'd prior to any script or datablock that wants to use it.
#10
02/09/2012 (9:18 am)
I've had a problem with his resource(well should be a resource):
MissionCleanup.add(%particles.schedule(1000, "delete"));

This code ends up crashing my T3D in very strange ways, such as; kill too many AI and the GUI starts crashing (everything from weaponHUD and exit mission window losing controls and eventually losing the entire gui window) and random other crashes on server shutdown or program exit.

I removed the above line and everything affected instantly stabilized again(short of the existing random PhysX crashes), what would be the implications of removing this as it seems like its doing more harm than good?

P.S. This should be a resource.
#11
03/01/2012 (6:55 pm)
were is this from (FXpack1/dirt) is this starndered

Step 1 is add first set of code in Art/Datablocks/particles.cs

Step 2 is add second set of code into Art/decals/managedDecalData.cs

step 3 is add third set of code into game/scripts/server/player.cs

am I missing a step? or doing any of this wrong?

#12
03/02/2012 (8:50 am)
"FXpack1/dirt" is a particle image used for the effect. That particular image was supplied with the Pacific Demo. If you don't have it, simply change the path to a different image suitable for the effect.
#13
03/02/2012 (11:24 am)
Hurray got it working in my code thanks all
#14
03/05/2012 (4:02 pm)
okay having small problem after the AI is dead the partical emmiters are staying in the level im worried that to many emiters is going to make bad peromence in game. Am I right on this or is it nothing to worry about
#15
03/20/2012 (3:11 pm)
Could someone please share their decal datablock for this?
I'm not really sure how to do it.
Thanks! :)
#16
03/21/2012 (6:39 pm)
Thank you for this!
Works great.....can't get anything done..too busy with blood splatter.
#17
03/21/2012 (7:09 pm)
@Austin, if you haevn't already download and stick the free GG decal pack under art/decals so you have art/decals/blood (or find the auto open and write resource by Nathan in the GG resources section)

art/decals/materials.cs
singleton Material(DECAL_Blood01)
{
   mapTo = "Blood01_d";
   translucent = true;
   translucentBlendOp = LerpAlpha;
   translucentZWrite = true;
   diffuseMap[0] = "art/decals/Blood/Blood01_d";
   normalMap[0] = "art/decals/Blood/Blood01_n";
   specularMap[0] = "art/decals/Blood/Blood01_s";
   pixelSpecular[0] = "0";
   castShadows = "0";
   materialTag0 = "Decals";
   showFootprints = "0";
};

art/decals/managedDecalData.cs
datablock DecalData(BloodDecalData)
{
   Material = "DECAL_Blood01";
   size = "3.0";
   lifeSpan = "1000000";
   clippingAngle = "60";
};
#18
03/22/2012 (11:01 am)
@Steve, great! thanks a ton. :)
#19
03/24/2012 (2:22 pm)
any way to add blood decals on player's skin(without changing the skin)?
#20
05/30/2012 (8:39 am)
Anyone else having issues getting the decals to work in multiplayer?
Page «Previous 1 2 3 Last »