Announcement

Collapse
No announcement yet.

Link gun problems... Please help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Link gun problems... Please help

    I'm creating a link gun that uses team colors in the projectiles and beams. I've gotten everything to work so far except for one little thing. I noticed while playing on the blue team, the glow that occurs where the link beam hits a wall or whatever is blue in 1st person. But, when I switch to 3rd person the glow is red. At first I thought that by sub-classing the linksparks class this would correct the problem. It only managed fix this in the 1st person but, the glow remains red in the 3rd. I've looked through the classes to see what I may have missed but I can't seem to figure out what's causing the red glow. So here's my question:

    Where is this glow generated for the 3rd person?

    If anybody has an idea on what I could do to fix this I would greatly appreciate it.

    Thnx

    #2
    I looked at the sparks class, but the color is always constant, and its always green.

    This is just a guess, but in the tick function of LinkBeamEffect we have this:
    Code:
    if ( Level.NetMode != NM_DedicatedServer )
    	{
    		if ( (Instigator != None) && !Instigator.IsFirstPerson() )
    		{
    			if ( MuzFlash == None )
    				MuzFlash = Spawn(class'LinkMuzFlashBeam3rd', self);
    		}
    		else if ( MuzFlash != None )
    			MuzFlash.Destroy();
    
    		if ( Sparks == None && EffectIsRelevant(EndEffect, false) )
    		{
    			P = Level.GetLocalPlayerController();
    			if ( (P == Instigator.Controller) || CheckMaxEffectDistance(P, Location) )
    				Sparks = Spawn(class'LinkSparks', self);
    		}
    	}
    So, there's different code if its first person or not. When your sparks are spawned, are they defaulted to a certain color? Try changing the default color that is used (I imagine that you have a default team index for the link, and that this is what is causing the wrong colored glow at the end. After you change the default, if that makes it always blue, then you know where the problem lies (its always using the default). Then you just have to figure out where you have to pass the team index.

    Just a guess.

    Comment


      #3
      Thanks for the response cknight52, I have this topic posted on three forums and this is the only one that has made an actual attempt to help me.

      I have been able to get the link sparks blue in the 3rd person but the glow is red. And it's this that I don't understand. Here is the code for the LinkBeamEffect class for the blue beam.

      Code:
      class IMLinkBeamEffectBlue extends IMLinkBeamEffect;
      
      simulated function Destroyed()
      {
          local int c;
      
          if ( Sparks != None )
          {
              Sparks.SetTimer(0, false);
              Sparks.mRegen = false;
              Sparks.LightType = LT_None;
          }
      
          if ( MuzFlash != None )
              MuzFlash.mRegen = false;
      
          if ( ProtSphere != None )
              ProtSphere.Destroy();
      
          for (c=0; c<MAX_CHILDREN; c++)
          {
              if (Child[c] != None)
                  Child[c].Destroy();
          }
      
          Super.Destroyed();
      }
      
      simulated function SetBeamLocation()
      {
      	local xWeaponAttachment Attachment;
      
      	if ( Level.NetMode == NM_DedicatedServer )
          {
              StartEffect = Instigator.Location + Instigator.EyeHeight*Vect(0,0,1);
              SetLocation( StartEffect );
              return;
          }
      
          if ( Instigator == None )
          {
              SetLocation( StartEffect );
          }
          else
          {
      		if ( Instigator.IsFirstPerson() )
              {
                  if ( (Instigator.Weapon == None) || Instigator.Weapon.WeaponCentered() || (Instigator.Weapon.Instigator == None) )
       		        SetLocation( Instigator.Location );
                  else
      				SetLocation(Instigator.Weapon.GetEffectStart() - 60 * vector(Instigator.Controller.Rotation));
              }
              else
              {
                  Attachment = xPawn(Instigator).WeaponAttachment;
                  if ( Attachment != None && (Level.TimeSeconds - Attachment.LastRenderTime) < 1 )
                      SetLocation( Attachment.GetTipLocation() );
                  else
                      SetLocation( Instigator.Location + Normal(EndEffect - Instigator.Location) * 25.0 );
              }
              if ( Role == ROLE_Authority ) // what clients will use if their instigator is not relevant yet
                  StartEffect = Location;
          }
      }
      
      simulated function Vector SetBeamRotation()
      {
          if ( (Instigator != None) && PlayerController(Instigator.Controller) != None )
              SetRotation( Instigator.Controller.GetViewRotation() );
          else
              SetRotation( Rotator(EndEffect - Location) );
      
      	return Normal(EndEffect - Location);
      }
      
      simulated function bool CheckMaxEffectDistance(PlayerController P, vector SpawnLocation)
      {
      	return !P.BeyondViewDistance(SpawnLocation,1000);
      }
      
      
      simulated function Tick(float dt)
      {
          local float LocDiff, RotDiff, WiggleMe,ls;
          local int c, n;
          local Vector BeamDir, HitLocation, HitNormal;
          local actor HitActor;
      	local PlayerController P;
          if ( Role == ROLE_Authority && (Instigator == None || Instigator.Controller == None) )
          {
              Destroy();
              return;
          }
      
      	// set beam start location
      	SetBeamLocation();
      	BeamDir = SetBeamRotation();
      
      	if ( (Instigator != None) && !Instigator.IsFirstPerson() )
      	{
      		if ( MuzFlash == None )
      			MuzFlash = Spawn(class'IMLinkMuzFlashBeam3rdBlue', self);
      	}
      	else if ( MuzFlash != None )
      		MuzFlash.Destroy();
      
          if ( Sparks == None && EffectIsRelevant(EndEffect, false) )
          {
      		P = Level.GetLocalPlayerController();
      		if ( (P == Instigator.Controller) || CheckMaxEffectDistance(P, Location) )
      			Sparks = Spawn(class'IMLinkSparksBlue', self);
          }
      
          ls = class'IMLinkFire'.default.LinkScale[Min(Links,5)];
      
          if ( Links != OldLinks || LinkColor != OldLinkColor || MuzFlash != OldMuzFlash )
          {
              // beam size
              mSizeRange[0] = default.mSizeRange[0] * (ls*0.6 + 1);
      
              mWaveShift = default.mWaveShift * (ls*0.6 + 1);
      
              // create/destroy children
              NumChildren = Min(Links+1, MAX_CHILDREN);
              for (c=0; c<MAX_CHILDREN; c++)
              {
                  if ( c < NumChildren && !Level.bDropDetail && Level.DetailMode != DM_Low )
                  {
                      if ( Child[c] == None )
                          Child[c] = Spawn(class'IMLinkBeamChild', self);
      
                      Child[c].mSizeRange[0] = 2.0 + 4.0 * (NumChildren - c);
                  }
                  else if ( Child[c] != None )
      				Child[c].Destroy();
              }
      
              if ( LinkColor == 0 )
              {
                  if ( Links > 0 )
                  {
                      Skins[0] = FinalBlend'XEffectMat.LinkBeamBlueFB';
                      if ( MuzFlash != None )
      					MuzFlash.Skins[0] = Texture'XEffectMat.link_muz_blue';
                      LightHue = 255;
                  }
                  else
                  {
                      Skins[0] = FinalBlend'XEffectMat.LinkBeamBlueFB';
                      if ( MuzFlash != None )
      	                MuzFlash.Skins[0] = Texture'XEffectMat.link_muz_blue';
                      LightHue = 255;
                  }
              }
              else if ( LinkColor == 1 )
              {
                  Skins[0] = FinalBlend'XEffectMat.LinkBeamBlueFB';
                  if ( MuzFlash != None )
      				MuzFlash.Skins[0] = Texture'XEffectMat.link_muz_blue';
                  LightHue = 255;
              }
              else
              {
                  Skins[0] = FinalBlend'XEffectMat.LinkBeamBlueFB';
                  if ( MuzFlash != None )
      	            MuzFlash.Skins[0] = Texture'XEffectMat.link_muz_blue';
                  LightHue = 255;
              }
      
      		if ( MuzFlash != None )
      		{
      			MuzFlash.mSizeRange[0] = MuzFlash.default.mSizeRange[0] * (ls*0.5 + 1);
      			MuzFlash.mSizeRange[1] = MuzFlash.mSizeRange[0];
      		}
      
              LightBrightness = 180 + 40*ls;
              LightRadius = 6 + 3*ls;
      
              if ( Sparks != None )
              {
                  Sparks.SetLinkStatus(Links, (LinkColor > 0), ls);
                  Sparks.bHidden = (LinkColor > 0);
                  Sparks.LightHue = LightHue;
                  Sparks.LightBrightness = LightBrightness;
                  Sparks.LightRadius = LightRadius - 3;
              }
      
              if ( LinkColor > 0 && LinkedPawn != None )
              {
                  if (ProtSphere == None)
                  {
                      ProtSphere = Spawn(class'IMLinkProtSphere');
                      if (LinkColor == 2)
                          ProtSphere.Skins[0] = Texture'XEffectMat.link_muz_blue';
                  }
              }
      
              OldLinks		= Links;
              OldLinkColor	= LinkColor;
      		OldMuzFlash		= MuzFlash;
          }
      
          if ( Level.bDropDetail || Level.DetailMode == DM_Low )
          {
      		bDynamicLight = false;
              LightType = LT_None;
          }
          else if ( bDynamicLight )
              LightType = LT_Steady;
      
          if ( LinkedPawn != None )
          {
              EndEffect = LinkedPawn.Location + LinkedPawn.EyeHeight*Vect(0,0,0.5) - BeamDir*30.0;
          }
      
          mSpawnVecA = EndEffect;
      
          mWaveLockEnd = bLockedOn || (LinkColor > 0);
      
          // magic wiggle code
          if ( bLockedOn || (LinkColor > 0) )
          {
              mWaveAmplitude = FMax(0.0, mWaveAmplitude - (mWaveAmplitude+5)*4.0*dt);
          }
          else
          {
              LocDiff			= VSize((Location - PrevLoc) * Vect(1,1,5));
              RotDiff			= VSize(Vector(Rotation) - Vector(PrevRot));
              WiggleMe		= FMax(LocDiff*0.02, RotDiff*4.0);
              mWaveAmplitude	= FMax(1.0, mWaveAmplitude - mWaveAmplitude*1.0*dt);
              mWaveAmplitude	= FMin(16.0, mWaveAmplitude + WiggleMe);
          }
      
          PrevLoc = Location;
          PrevRot = Rotation;
      
          for (c=0; c<NumChildren; c++)
          {
              if ( Child[c] != None )
              {
                  n = c+1;
                  Child[c].SetLocation( Location );
                  Child[c].SetRotation( Rotation );
                  Child[c].mSpawnVecA		= mSpawnVecA;
                  Child[c].mWaveShift		= mWaveShift*0.6;
                  Child[c].mWaveAmplitude = n*4.0 + mWaveAmplitude*((16.0-n*4.0)/16.0);
                  Child[c].mWaveLockEnd	= (LinkColor > 0); //mWaveLockEnd;
                  Child[c].Skins[0]		= Skins[0];
              }
          }
      
          if ( Sparks != None )
          {
              Sparks.SetLocation( EndEffect - BeamDir*10.0 );
              if ( bHitSomething )
                  Sparks.SetRotation( Rotation);
              else
                  Sparks.SetRotation( Rotator(-BeamDir) );
              Sparks.mRegenRange[0] = Sparks.DesiredRegen;
              Sparks.mRegenRange[1] = Sparks.DesiredRegen;
              Sparks.bDynamicLight = true;
          }
      
          if ( LinkColor > 0 && LinkedPawn != None )
          {
              if ( ProtSphere != None )
              {
                  ProtSphere.SetLocation( EndEffect );
                  ProtSphere.SetRotation( Rotation );
                  ProtSphere.bHidden = false;
                  if ( LinkedPawn.IsFirstPerson() )
                      ProtSphere.mSizeRange[0] = 20.0;
                  else
                      ProtSphere.mSizeRange[0] = 35.0;
                  ProtSphere.mSizeRange[1] = ProtSphere.mSizeRange[0];
              }
          }
          else
          {
              if ( ProtSphere != None )
      			ProtSphere.bHidden = true;
          }
          if ( bHitSomething && (Level.NetMode != NM_DedicatedServer) && (Level.TimeSeconds - ScorchTime > 0.07) )
          {
      		ScorchTime = Level.TimeSeconds;
      		HitActor = Trace(HitLocation, HitNormal, EndEffect + 100*BeamDir, EndEffect - 100*BeamDir, true);
      		if ( (HitActor != None) && HitActor.bWorldGeometry )
      			spawn(class'LinkScorch',,,HitLocation,rotator(-HitNormal));
      	}
      }
      
      defaultproperties
      {
           EffectOffset=(X=22.000000,Y=11.000000,Z=1.400000)
           mParticleType=PT_Beam
           mMaxParticles=3
           mRegenDist=65.000000
           mSpinRange(0)=45000.000000
           mSizeRange(0)=11.000000
           mColorRange(0)=(B=240,G=240,R=240)
           mColorRange(1)=(B=240,G=240,R=240)
           mAttenuate=False
           mAttenKa=0.000000
           mWaveFrequency=0.060000
           mWaveAmplitude=8.000000
           mWaveShift=100000.000000
           mBendStrength=3.000000
           mWaveLockEnd=True
           LightType=LT_Steady
           LightHue=160
           LightSaturation=255
           LightBrightness=180.000000
           LightRadius=4.000000
           bDynamicLight=True
           bNetTemporary=False
           bReplicateInstigator=True
           RemoteRole=ROLE_SimulatedProxy
           Skins(0)=FinalBlend'XEffectMat.Link.LinkBeamBlueFB'
           Style=STY_Additive
      }
      I believe the problem is somewhere in this file. I hope that somebody may be able to find what the problem is.

      Comment


        #4
        Originally posted by NE1_4_69
        Thanks for the response cknight52, I have this topic posted on three forums and this is the only one that has made an actual attempt to help me.
        You could have at least said something in the other thread instead of insulting me in another forum, dipstooge.

        Comment


          #5
          My apologies Angel Mapper. I had actually thought about what I had posted after the fact. I meant no disrespect and certainly did not mean to insult anyone. I know you do not have to accept this and I'll understand if choose not to. This problem has been haunting me for quite sometime(along with a few others) and I have become very aggravated with it to say the least. I think I need to step back and take a break from this and cool my head. We all have our limits as to how much aggravation we can tolerate. I guess I'm getting close to mine.

          After I cool my head I will post the corrections if I manage to work this out.

          Again, my apologies to anyone who I may have offended.

          Comment


            #6
            I'm not sure exactly where your code is in the tree, but the problem might be in your Destroyed function. Instead of calling super.Destroyed(), call super(ClassAboveTheSuper).destroyed();

            Comment


              #7
              While I was clearing my head I couldn't remember checking the link sparks class. I can't believe I didn't check this before now. It turns out that when I set up the class for the blue link sparks I neglected to specify the light hue, light saturation and light brightness. After correcting this everything seems to be working fine. Thanks for all your help guys. I've got more problems with my mod but, I'll post them in a more appropriately titled thread.

              Comment

              Working...
              X