Page 2 of 2

PostPosted: Mon Jun 04, 12 4:30 pm
by RedDynasty
Well everyone i just need to fix the energy sheild so it doesnt let npcs catch fire and fix the effects.
Ive checked the code a ton of times but i cant seem to find out what is wrong.
Here is an example taken from TNMPawn:

Code: Select all
function augdamage( int damage, pawn instigatedby, vector hitlocation, vector momentum, name damagetype)
{
   local int newdamage;
   local tnmaugmentation TNMA;

   newdamage = damage;

   if ((damageType == 'Shot') || (damageType == 'AutoShot'))
   {
      TNMA = TNMPAM.findaug(class'tnmAugBallistic');
      if ((TNMA != none) && (TNMA.bisactive))
      {
         newDamage *= TNMA.value;
         Spawn(Class'BallisticShieldFX',Self);
      }
   }

In BallisticSheildFX.uc u just find a texture import line with a Texture in the defaultproperties.The uc is subclassed into AugFX, which comes as follows:

Code: Select all
class AugFX extends Effects
   abstract;

simulated function Tick(float deltaTime)
{
   Super.Tick(deltaTime);

   ScaleGlow=LifeSpan/Default.LifeSpan;

   if (Owner == None)
      Destroy();
   else
   {
      if(Fatness!=Owner.Fatness)
         Fatness=Owner.Fatness;

      if(PrePivot!=Owner.PrePivot)
         PrePivot=Owner.PrePivot;
   }
}

simulated function PostBeginPlay()
{
   local int i;

   Super.PostBeginPlay();

   Mesh = Owner.Mesh;
   DrawScale = Owner.DrawScale;

   //don't draw masked stuff, blackmasktex will be completely translucent
   for(i=0;i<8;i++)
      if(Owner.MultiSkins[i]==None||Owner.MultiSkins[i]==Texture'BlackMaskTex'||Owner.MultiSkins[i]==Texture'PinkMaskTex'||Owner.MultiSkins[i]==Texture'GrayMaskTex')
         MultiSkins[i]=Texture'BlackMaskTex'; //don't show masked stuff
      else
         MultiSkins[i]=Texture;

   //don't draw glasses, they don't look good with their material settings and the firetexture
   if   (Mesh==LodMesh'GM_DressShirt_B')
   {
      MultiSkins[4]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GM_DressShirt')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GM_Jumpsuit' || Mesh==LodMesh'mp_jumpsuit')
   {
      MultiSkins[5]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GM_DressShirt_F')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GM_DressShirt_S')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GM_Suit')
   {
      MultiSkins[5]=Texture'BlackMaskTex';
      MultiSkins[6]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GM_Trench')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GM_Trench_F')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GFM_TShirtPants')
   {
      MultiSkins[3]=Texture'BlackMaskTex';
      MultiSkins[4]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GFM_SuitSkirt_F')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GFM_SuitSkirt')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GFM_Trench')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GFM_Dress')
   {
      //no glasses
   }
   else if   (Mesh==LodMesh'GMK_DressShirt_F')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }
   else if   (Mesh==LodMesh'GMK_DressShirt')
   {
      MultiSkins[6]=Texture'BlackMaskTex';
      MultiSkins[7]=Texture'BlackMaskTex';
   }

   Texture=Owner.Texture;
   bTrailerSameRotation = true;
   bAnimByOwner = true;

   SetBase(Owner);
}

defaultproperties
{
    bTravel=True
    Physics=11
    LifeSpan=1.00
    DrawType=2
    Style=3
    ScaleGlow=0.70
    bUnlit=True
    bOwnerNoSee=True
}


Any ideas or suggestions?

PostPosted: Mon Jun 04, 12 10:29 pm
by Allan
There's a coded call in TakeDamageBase to CatchFire that gets run whenever an NPC takes Flamed damage. You'll either need to make the damage function call it only when there is no Energy Shield, or simply make the function not work if there is no energy shield.

I'll show you the basic outline of the simpler version:

Code: Select all
function CatchFire()
{
   if(*however you would check there is no energy shield active*)
      Super.CatchFire();
}


Simply dump that into your custom Pawn class, and they shouldn't catch fire if the energy shield is active.

PostPosted: Tue Jun 05, 12 7:54 pm
by RedDynasty
well i dont know how to make it detect the sheild is not on\there but maybe i can make it call only when there is no energy sheild.
Will this work?
Code: Select all
function CatchFire()
{
   local tnmaugmentation TNMA;

   TNMA = TNMPAM.findaug(class'tnmAugSheild');
   if((TNMA != none) && (TNMA.bisactive))
   
return false
}

I know this is badly coded but i was in a rush, but i think u can get what im trying to say

PostPosted: Tue Jun 05, 12 10:23 pm
by Allan
Kinda right, but not quite.

Code: Select all
function CatchFire()
{
   local tnmaugmentation TNMA;

   TNMA = TNMPAM.findaug(class'tnmAugSheild');
   if((TNMA != none) && (!TNMA.bisactive))
      Super.CatchFire();
}


You can stick a ! before a bool operator (in this case, bisactive) to check if it's false, as opposed to true.

PostPosted: Tue Jun 05, 12 10:34 pm
by RedDynasty
so i just add a ! next to bisactive and then just add the Spawn effect( even though it does not work) thing and paste it somewhere in TNMPawn?