Game Development Community

How to make weapons and many forms of combat effectiveness?

by Szzg007 · in Torque 3D Professional · 12/30/2011 (10:24 pm) · 7 replies

HI...everybody...
How to make weapons and many forms of combat effectiveness? a bullet hit the wood, sand, metal materials, the effect of animals? However, I can only find in the script to write an effect. How to add other effects?

look.
gameartdatablocksweaponsLurker.cs

datablock ProjectileData( BulletProjectile )
{
   projectileShapeName = "";//"art/shapes/weapons/SwarmGun/rocket.dts";

   directDamage        = 5;
   radiusDamage        = 15;
   damageRadius        = 0.5;
   areaImpulse         = 0.5;
   impactForce         = 1;

   explosion           = BulletDirtExplosion; // here....
   decal               = BulletHoleDecal;

   muzzleVelocity      = 120;
   velInheritFactor    = 1;

   armingDelay         = 0;
   lifetime            = 992;
   fadeDelay           = 1472;
   bounceElasticity    = 0;
   bounceFriction      = 0;
   isBallistic         = false;
   gravityMod          = 1;
};

so How to increase ProjectileData explosion?

#1
12/31/2011 (12:20 am)
So...maybe I need add new function woodobj::damage?
like this?
function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
   if (!isObject(%obj) || %obj.getState() $= "Dead" || !%damage)
      return;

   //AISK Changes: Start
   //If friendly fire is turned off, and the source and target are on
   //the same team, then return
   if ($AISK_FRIENDLY_FIRE == false && $AISK_FREE_FOR_ALL == false)
   {
        if (%sourceObject.team == %obj.team)
            return;
   }

   //If this is a bot, set its attention level
   if (%obj.isbot == true)
   {
        //Move a little when hit, aggressive bots move in the "Defending" state
        if (!%obj.behavior.isAggressive)
            %obj.sidestep(%obj, true);
        else if (!%obj.specialMove)
        {
        //Item gathering has been commented out because it does not work properly
        //if (%obj.action !$= "GetHealth")
        //{
            //If the bot got sniped, enhance its vision
            if (%obj.action !$= "Attacking" && %obj.action !$= "Defending" && %obj.getstate() !$= "Dead")
            {
                %obj.enhancedefending(%obj);
                %obj.attentionlevel = 1;
                %obj.ailoop = %obj.schedule($AISK_QUICK_THINK, "Think", %obj);
            }

            %obj.action = "Defending";
        //}
        }

        //Don't hurt unkillable bots
        if (!%obj.behavior.isKillable)
            return;
   }

   %obj.applyDamage(%damage);

   %location = "Body";

   // Update the numerical Health HUD
   %obj.updateHealth();

   // Deal with client callbacks here because we don't have this
   // information in the onDamage or onDisable methods
   %client = %obj.client;
   %sourceClient = %sourceObject ? %sourceObject.client : 0;

   //Have other bots assist the injured if needed
   checkAboutAssisting(%obj);

   if (%obj.getState() $= "Dead")
   {
      if (%obj.isbot == true)
      {
         %marker = %obj.marker;

         //Check if the bots should still be respawning
         if (%marker.respawnCount > 0)
         {
            if (%marker.respawnCounter <= 0)
                %obj.respawn = false;

            %marker.respawnCounter--;
         }

         //Respawn the bot if needed
         if (%obj.respawn == true)
         {
            %marker.delayRespawn = schedule($AISK_RESPAWN_DELAY, %marker, "AIPlayer::spawn", %marker, true);
            %this.player = 0;
         }
         else
         {
            %marker.botBelongsToMe = "";
            %marker.respawnCount = "";
            %marker.respawnCounter = "";
         }
      }
      else if (isObject(%client))
      {
         // Determine damage direction
         if (%damageType !$= "Suicide")
            %obj.setDamageDirection(%sourceObject, %position);

         %client.onDeath(%sourceObject, %sourceClient, %damageType, %location);
      }
   }
   //AISK Changes: End
}
#2
12/31/2011 (7:45 am)
Armor::damage is for player or AIplayer damage. If you want to damage a wood object you would need to have a ::damage function for that object type. You could do one for all shapebase like this:
function ShapeBase::damage(%this, %obj, %sourceObject, %position, %damage, %damageType){
your code here    
}
Then in that function you can check what material the object is made out of. You will have to add an attribute to check on the object like this:
$obj.material
You will also want to ignore objects like player or aiplayer. Fir checking material you could do this:
function ShapeBase::getMaterial(%this){
  your code to check for material type or return nothing for shapes that don't support material like player or aiplayer
}

Edit:
These functions might need to be on ShapeBaseData. I don't remember it has been a while.
#3
12/31/2011 (9:14 am)
There is a resource for making different decals and sounds based on materials somewhere, i think it was for t3d.
#4
12/31/2011 (11:28 am)
One of my Damage & Destruction Resources shows how to do per-object damage fx - and that will work for everything but TSStatics.

You could also check for different object types (class or custom property) in the projectile onCollision() callback and trigger different fx based on what you hit.
#5
01/02/2012 (10:10 am)
@Frank Carney..
Thanks...I to try now...
but I don't how to do...I not script enginer .... I am art . just be wall to learning script.....

#6
01/03/2012 (6:33 pm)
I can not write to, who can help me write a play out of the green blood zombie effect the damage it?
#7
01/04/2012 (1:51 am)
ha ha ..I get it...
function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
   %particles = new ParticleEmitterNode() 
   {
      position = %position;
      rotation = "1 0 0 0";
      scale = "1 1 1";
      dataBlock = "bloodNodeData";
      emitter = "bloodBulletDirtSprayEmitter";
      velocity = "1";
   };
};
Very thanks Michael Hall
I has see U Damage and Destruction

but How do make Damage blood DecalData?