Page 1 of 1

Back to zooming...

Posted: Sun Nov 12, 2006 7:13 am
by lord_kungai
Ok...

here goes...


I've been feebly attempting to make UT mutators. It's kinda working - I made a few adreneline combos (just modifications of the UnrealWiki speed combo and stuff), and even a weapon (an instagib lightning gun)

I wanted to try replicating the Unreal 2 sniper rifle zoom, but I'm having some trouble doing that. Tim had given me some code earlier, and I managed to extract some of the U2 sniper rifle code directly from the U2weapons.u file, but I still don't know how to actually modify the actual SR/LG zoom code... :(

This is what I've gleaned so far:
Tim wrote:

Code: Select all

if ( PlayerController(Instigator.Controller).DesiredFOV == PlayerController(Instigator.Controller).DefaultFOV )
   {
        Super.RenderOverlays(Canvas);
      zoomed=false;
   }
   else
    {
      if ( FireMode[0].NextFireTime <= Level.TimeSeconds )
      {
         chargeBar = 1.0;
      }
      else
      {
         chargeBar = 1.0 - ((FireMode[0].NextFireTime-Level.TimeSeconds) / FireMode[0].FireRate);
      }

      CX = Canvas.ClipX/2;
      CY = Canvas.ClipY/2;
      Scale = Canvas.ClipX/1024;

      Canvas.Style = ERenderStyle.STY_Alpha;
      Canvas.SetDrawColor(0,0,0);

      // Draw the crosshair
      Canvas.SetPos(CX-169*Scale,CY-155*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',169*Scale,310*Scale, 164,35, 169,310);
      Canvas.SetPos(CX,CY-155*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',169*Scale,310*Scale, 332,345, -169,-310);

      // Draw Cornerbars
      Canvas.SetPos(160*Scale,160*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 111*Scale, 111*Scale , 0 , 0, 111, 111);

      Canvas.SetPos(Canvas.ClipX-271*Scale,160*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 111*Scale, 111*Scale , 111 , 0, -111, 111);

      Canvas.SetPos(160*Scale,Canvas.ClipY-271*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 111*Scale, 111*Scale, 0 , 111, 111, -111);

      Canvas.SetPos(Canvas.ClipX-271*Scale,Canvas.ClipY-271*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 111*Scale, 111*Scale , 111 , 111, -111, -111);


      // Draw the 4 corners
      Canvas.SetPos(0,0);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',160*Scale,160*Scale, 0, 274, 159, -158);

      Canvas.SetPos(Canvas.ClipX-160*Scale,0);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',160*Scale,160*Scale, 159,274, -159, -158);

      Canvas.SetPos(0,Canvas.ClipY-160*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',160*Scale,160*Scale, 0,116, 159, 158);

      Canvas.SetPos(Canvas.ClipX-160*Scale,Canvas.ClipY-160*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair',160*Scale,160*Scale, 159, 116, -159, 158);

      // Draw the Horz Borders
      Canvas.SetPos(160*Scale,0);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', Canvas.ClipX-320*Scale, 160*Scale, 284, 512, 32, -160);

      Canvas.SetPos(160*Scale,Canvas.ClipY-160*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', Canvas.ClipX-320*Scale, 160*Scale, 284, 352, 32, 160);

      // Draw the Vert Borders
      Canvas.SetPos(0,160*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 160*Scale, Canvas.ClipY-320*Scale, 0,308, 160,32);

      Canvas.SetPos(Canvas.ClipX-160*Scale,160*Scale);
      Canvas.DrawTile(texture'NewSniperRifle.COGAssaultZoomedCrosshair', 160*Scale, Canvas.ClipY-320*Scale, 160,308, -160,32);

      // Draw the Charging meter
      Canvas.DrawColor = ChargeColor;
U2weapons.u wrote:

Code: Select all

// WeaponInvSniperRifle.uc
// $Author: Aleiby $
// $Date: 8/19/02 8:12p $
// $Revision: 1 $
//=============================================================================
class WeaponInvSniperRifleSmall extends WeaponInvSniperRifle;


ÿÿÿÿÿÿÿÿ
// WeaponInvSniperRifle.uc
// $Author: Aleiby $
// $Date: 12/02/02 5:28p $
// $Revision: 47 $
//=============================================================================
class WeaponInvSniperRifle extends U2Weapon;

#exec OBJ LOAD File=..\Meshes\GlmWeaponsG.ugx
#exec OBJ LOAD File=..\System\ParticleRes\SniperFX.u
#exec OBJ LOAD File=..\System\ParticleRes\SniperTracer.u
#exec OBJ LOAD File=..\Textures\WeaponFXT.utx

var vector PawnLocation;			// track Pawn location to compute "StillTime"
var float StillTime, StillStart;	// adjust WeaponAimSpread for Bots based on StillTime

var bool bZoomed, bWasZoomed;
var float ZoomFOV;

var vector RingLoc;
var() float RingDelayFactor;
var float Angle, Radius;
var Point RingLocation;

var() Sound ZoomInSound;
var() Sound ZoomOutSound;
var() Sound AdjustZoomSound;

simulated function int GetFireAmmoUsed() 
{ 
	if( U2NPCController(Instigator.Controller) != None )
		return AmmoType.AmmoAmount; // force NPCs to reload after every shot?
	else
		return Super.GetFireAmmoUsed();
}

/*mdf-tbd: not used currently?
event Timer()
{
	local Actor Target;
	local float bestAim, bestDist;
	local vector FireDir;

	bestAim = 0.95;
	if( Instigator == None )
	{
		GotoState('');
		return;
	}
	if( VSize( Instigator.Location - PawnLocation ) <6> 0.62 * Hit.Actor.CollisionHeight ) //CDH head shot (replace with mesh trace damage)
	{
		EffectiveDamage *= 1.5;
	}
	Super.ProcessTraceHitEx( HitDirection, Hit, EffectiveDamage );
}

//override so altfiring state is not used, and so that we don't use ammo or switch weapons
simulated function AltFire()
{
	if( bZoomed )
		UnZoom();
	else
		Zoom();
}

simulated function NotifyCutsceneBegin()
{
	if( bZoomed )
		UnZoom(true);
}

//prevents weapon switching for the sniper rifle
simulated function bool PutDown()
{
	if (bZoomed)
	{
		Pawn(Owner).PendingWeapon = None;
		return false;
	}
	return Super.PutDown();
}

simulated function SetPlayerFOV( float NewFOV )
{
	assert( bZoomed );

	ZoomFOV = FClamp( NewFOV, 1.0, 60.0 );

	if( PlayerController(Instigator.Controller) != None )
	{
		PlayerController(Instigator.Controller).DesiredFOV = ZoomFOV;
	}
}


exec simulated function ZoomIn()
{
	if( bZoomed )
	{
		if( ZoomFOV > 20 )
		{
			// 90 --> 20 by 10
			SetPlayerFOV( ZoomFOV - 10 );
		}
		else if( ZoomFOV > 5 )
		{
			// 20 --> 5 by 5
			SetPlayerFOV( ZoomFOV - 5 );
		}
		else
		{
			// 5 --> 1 by 2
			SetPlayerFOV( ZoomFOV - 2 );
		}
		PlaySound( AdjustZoomSound );
	}
}


exec simulated function ZoomOut()
{
	if( bZoomed )
	{
		if( ZoomFOV >= 20 )
		{
			// 20 --> 90 by 10
			SetPlayerFOV( ZoomFOV + 10 );
		}
		else if( ZoomFOV >= 5 )
		{
			// 5 --> 20 by 5
			SetPlayerFOV( ZoomFOV + 5 );
		}
		else
		{
			// 1 --> 5 by 2
			SetPlayerFOV( ZoomFOV + 2 );
		}
		PlaySound( AdjustZoomSound );
	}	
}

simulated function Zoom()
{
	//only execute this code on the local machine and server ... not the third-person players
	if ( !bZoomed && Instigator.Controller != None )
	{
		bZoomed = true;
		SetPlayerFOV( ZoomFOV );
		if( U2PCOwner != None ) U2PCOwner.SendEvent("Rotate");
		PlaySound( ZoomInSound );
	}	
}

simulated function UnZoom( optional bool bForce )
{
	//only execute this code on the local machine and server ... not the third-person players
	if ( bZoomed && Instigator.Controller != None )
	{
		bZoomed = false;
		if( PlayerController(Instigator.Controller) != None )
		{
			PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV;
			if( bForce )
				PlayerController(Instigator.Controller).FOVAngle = PlayerController(Instigator.Controller).DefaultFOV;
		}
		if( U2PCOwner != None ) U2PCOwner.SendEvent("UnRotate");
		PlaySound( ZoomOutSound );
	}	
}

simulated function ClearWeaponEffects()
{
	Super.ClearWeaponEffects();
	UnZoom();
}

simulated state Unloading
{
	simulated event BeginState()
	{
		Super.BeginState();
		bWasZoomed = bZoomed;
		UnZoom();
	}
	simulated event EndState()
	{
		Super.EndState();
		if (bWasZoomed)
			Zoom();
	}
}

simulated state Reloading
{
	simulated event BeginState()
	{
		Super.BeginState();
		bWasZoomed = bZoomed;
		UnZoom();
	}
	simulated event EndState()
	{
		Super.EndState();
		if (bWasZoomed)
			Zoom();
	}
}

simulated state DownWeapon
{
ignores Fire, AltFire;

	simulated event BeginState()
	{
		UnZoom();
		Super.BeginState();
	}
}

simulated function ClientTraceImpact( CheckResult Hit )
{
	UpdateTracer(Hit,1);
//	UpdateTracer(Hit,2);
//	UpdateTracer(Hit,3);
}

simulated function UpdateTracer( CheckResult Hit, int Index )
{
	local PulseLineGenerator Tracer;
	Tracer = PulseLineGenerator(DecoEffects[Index].Effect);
	if (!Tracer) return;

	if (Tracer.Connections.length!=1)
		Tracer.Connections.length = 1;

	Tracer.Connections[0].StartActor = Tracer;
	Tracer.Connections[0].End = Hit.Location;
	Tracer.BeamTexture.ResetModifiers();
}
SniperZoom.uc wrote:

Code: Select all

class SniperZoom extends WeaponFire;

defaultproperties
{
    FireAnim=Idle
    FireRate=0.1
    bModeExclusive=false
    bWaitForRelease=true
    BotRefireRate=0.3
}










I was just hoping someone could help me string the pieces together... :?

Posted: Sun Nov 12, 2006 8:23 am
by lord_kungai
Wait...



I think I've gotten it...


Or at least some of it...



The sniper zoom code is in the SR/LG ITSELF!

Or at least, parts of it...


Ding it...

Posted: Sun Nov 12, 2006 8:56 am
by lord_kungai
Ok, he is what I have sort of dome...


I'll post the code that I've modified...

Code: Select all

var int zoomStop; //this variable will have three values: 1, when not in zoom, 2 and 4 when in zoom. I'm not quite sure where to initialise this variable, though...


...


simulated function ClientStartFire(int mode)
{
    if (mode == 1)
    {
        FireMode[mode].bIsFiring = true;
        if( Instigator.Controller.IsA( 'PlayerController' ) )
            {

            //PlayerController(Instigator.Controller).ToggleZoom();
            //the above comment was the original zooming code, but now I need to make this somehow multiply the zoom by the zoomStop variable. IE: divide the FOV by the zoomStop variable. So...:

            if(zoomStop == 1)
                {
                zoomStop = 2;
                PlayerController(Instigator.Controller).ToggleZoom();
                PlayerController(Instigator.Controller).StopZoom();
                }
            else if(zoomStop == 2)
                {
                zoomStop = 4;
                PlayerController(Instigator.Controller).EndZoom();
                PlayerController(Instigator.Controller).ToggleZoom();
                PlayerController(Instigator.Controller).StopZoom();
                }
            else if(zoomStop == 4)
                {
                zoomStop = 1;
                PlayerController(Instigator.Controller).EndZoom();
                }

            PlayerController(Instigator.Controller).DesiredFOV  = PlayerController(Instigator.Controller).FOV * zoomStop;
            //I'm not sure about this...

            }
    }
    else
    {
        Super.ClientStartFire(mode);
    }
}


It's really... rough. Please help... :?

Posted: Sun Nov 12, 2006 12:10 pm
by lord_kungai
I GOT IT!!!

Code: Select all

class ZoomStopSniperRifle extends SniperRifle;

var bool isZoomStop;
var int zoomStop;

simulated function ClientWeaponThrown()
{
    if( (Instigator != None) && (PlayerController(Instigator.Controller) != None) )
        {
        PlayerController(Instigator.Controller).DesiredFOV  = PlayerController(Instigator.Controller).DefaultFOV;
        }
    Super.ClientWeaponThrown();
}

simulated function ClientStartFire(int mode)
{
    if (mode == 1)
    {
        FireMode[mode].bIsFiring = true;
        if( Instigator.Controller.IsA( 'PlayerController' ) )
            {
		    if(PlayerController(Instigator.Controller).DesiredFOV == PlayerController(Instigator.Controller).DefaultFOV)
		    {
			  zoomStop=-1;
		    }

		    if(!isZoomStop)
		    {
		        zoomStop++;
			  isZoomStop = true;
		    }

		    if(zoomStop == 0)
		    {
			  PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV/3;
		    }
		    else if(zoomStop == 1)
		    {
			  PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV/6;
		    }
		    else if(zoomStop == 2)
		    {
			  PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV/9;
		    }
		    else if(zoomStop == 3)
		    {
			  PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV;
		    }
            }
    }
    else
    {
        Super.ClientStartFire(mode);
    }
}

simulated function ClientStopFire(int mode)
{
    if (mode == 1)
    {
	  FireMode[mode].bIsFiring = false;
        if( PlayerController(Instigator.Controller) != None )
	  {
            isZoomStop = false;
	  }
    }
    else
    {
        Super.ClientStopFire(mode);
    }
}

simulated function bool PutDown()
{
    if( Instigator.Controller.IsA( 'PlayerController' ) )
        {
        PlayerController(Instigator.Controller).DesiredFOV  = PlayerController(Instigator.Controller).DefaultFOV;
        }
    if ( Super.PutDown() )
    {
		GotoState('');
		return true;
	}
	return false;
}

defaultproperties
{
    PickupClass=class'ZoomStopSniperRiflePickup'
    zoomStop=-1
    isZoomStop=false
}

Code: Select all

class ZoomStopMut extends Mutator
    config(user);

function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
    local int i;
    local WeaponLocker L;

    bSuperRelevant = 0;

    if ( xWeaponBase(Other) != None )
    {
        if ( string( xWeaponBase(Other).WeaponType ) ~= "XWeapons.SniperRifle" )
        {
            xWeaponBase(Other).WeaponType = class'ZoomStopSniperRifle';
            return false;
        }
    }
    else if ( WeaponPickup(Other) != None )
    {
        if ( string(Other.Class) ~= "XWeapons.SniperRiflePickup" )
        {
            ReplaceWith( Other, "ZoomStopSniperRiflePickup" );
            return false;
        }
    }
    else if ( WeaponLocker(Other) != None )
    {
        L = WeaponLocker(Other);

        for (i = 0; i < L.Weapons.Length; i++)
        {
            if ( string( L.Weapons[i].WeaponClass ) ~= "XWeapons.SniperRifle" )
                L.Weapons[i].WeaponClass = class'ZoomStopSniperRifle';
        }
    }

    return true;
}

defaultproperties
{
     GroupName="Zoom Stop Sniper Rifle"
     FriendlyName="Zoom Stop Sniper Rifle"
     Description="Upgrades the Lighning Gun with the Zoom Stop enhancement: 3x, 6x and 9x scopes are available"
}

Code: Select all

class ZoomStopSniperRiflePickup extends SniperRiflePickup;

defaultproperties
{
    InventoryType=class'ZoomStopSniperRifle'
}
Perfectly functional zoomstops!

Posted: Sun Nov 12, 2006 12:51 pm
by lord_kungai
I FCKING DID IT!!!

No, not sex...



THE DYNAMIC ZOOM!!!

Code: Select all

class DZSniperRifle extends SniperRifle;

var bool isZoom;
var bool clicky;
var int zoomDepth;

simulated function ClientWeaponThrown()
{
    if( (Instigator != None) && (PlayerController(Instigator.Controller) != None) )
        {
        PlayerController(Instigator.Controller).DesiredFOV  = PlayerController(Instigator.Controller).DefaultFOV;
        }
    Super.ClientWeaponThrown();
}

simulated function ClientStartFire(int mode)
{
    if (mode == 1)
    {
        FireMode[mode].bIsFiring = true;
        if( Instigator.Controller.IsA( 'PlayerController' ) )
            {
		    if(!clicky)
		    {
			  if(isZoom)
			  {
				isZoom=false;
				PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV;
			  }
			  else
			  {
				isZoom=true;
				PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV - 1 - zoomDepth;
			  }
			  clicky=true;
		    }
            }
    }
    else
    {
        Super.ClientStartFire(mode);
    }
}

simulated function ClientStopFire(int mode)
{
    if (mode == 1)
    {
	  FireMode[mode].bIsFiring = false;
        if( PlayerController(Instigator.Controller) != None )
	  {
            clicky = false;
	  }
    }
    else
    {
        Super.ClientStopFire(mode);
    }
}

simulated function Weapon PrevWeapon(Weapon CurrentChoice, Weapon CurrentWeapon)
{
if(isZoom)
{
if(zoomDepth>=10)
{
zoomDepth -= 10;
PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV - 1 - zoomDepth;
}
}
else
{
    if ( HasAmmo() )
    {
        if ( (CurrentChoice == None) )
        {
            if ( CurrentWeapon != self )
                CurrentChoice = self;
        }
        else if ( InventoryGroup == CurrentWeapon.InventoryGroup )
        {
            if ( (GroupOffset <CurrentWeapon> CurrentChoice.GroupOffset)) )
                CurrentChoice = self;
		}
        else if ( InventoryGroup == CurrentChoice.InventoryGroup )
        {
            if ( GroupOffset > CurrentChoice.GroupOffset )
                CurrentChoice = self;
        }
        else if ( InventoryGroup > CurrentChoice.InventoryGroup )
        {
			if ( (InventoryGroup <CurrentWeapon> CurrentWeapon.InventoryGroup) )
                CurrentChoice = self;
        }
        else if ( (CurrentChoice.InventoryGroup > CurrentWeapon.InventoryGroup)
                && (InventoryGroup < CurrentWeapon.InventoryGroup) )
            CurrentChoice = self;
    }
    if ( Inventory == None )
        return CurrentChoice;
    else
        return Inventory.PrevWeapon(CurrentChoice,CurrentWeapon);
}
}

simulated function Weapon NextWeapon(Weapon CurrentChoice, Weapon CurrentWeapon)
{
if(isZoom)
{
if(zoomDepth<70> CurrentWeapon.GroupOffset)
                && ((CurrentChoice.InventoryGroup != InventoryGroup) || (GroupOffset < CurrentChoice.GroupOffset)) )
                CurrentChoice = self;
        }
        else if ( InventoryGroup == CurrentChoice.InventoryGroup )
        {
			if ( GroupOffset < CurrentChoice.GroupOffset )
                CurrentChoice = self;
        }

        else if ( InventoryGroup <CurrentChoice> CurrentWeapon.InventoryGroup)
                || (CurrentChoice.InventoryGroup < CurrentWeapon.InventoryGroup) )
                CurrentChoice = self;
        }
        else if ( (CurrentChoice.InventoryGroup <CurrentWeapon> CurrentWeapon.InventoryGroup) )
            CurrentChoice = self;
    }
    if ( Inventory == None )
        return CurrentChoice;
    else
        return Inventory.NextWeapon(CurrentChoice,CurrentWeapon);
}
}

simulated function bool PutDown()
{
    if( Instigator.Controller.IsA( 'PlayerController' ) )
        {
        PlayerController(Instigator.Controller).DesiredFOV  = PlayerController(Instigator.Controller).DefaultFOV;
        }
    if ( Super.PutDown() )
    {
		GotoState('');
		return true;
	}
	return false;
}

defaultproperties
{
    PickupClass=class'DZSniperRiflePickup'
    isZoom=false
    clicky=false
    zoomdepth=0
}

Code: Select all

class DynamicZoomMut extends Mutator
    config(user);

function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
    local int i;
    local WeaponLocker L;

    bSuperRelevant = 0;

    if ( xWeaponBase(Other) != None )
    {
        if ( string( xWeaponBase(Other).WeaponType ) ~= "XWeapons.SniperRifle" )
        {
            xWeaponBase(Other).WeaponType = class'DZSniperRifle';
            return false;
        }
    }
    else if ( WeaponPickup(Other) != None )
    {
        if ( string(Other.Class) ~= "XWeapons.SniperRiflePickup" )
        {
            ReplaceWith( Other, "DZSniperRiflePickup" );
            return false;
        }
    }
    else if ( WeaponLocker(Other) != None )
    {
        L = WeaponLocker(Other);

        for (i = 0; i < L.Weapons.Length; i++)
        {
            if ( string( L.Weapons[i].WeaponClass ) ~= "XWeapons.SniperRifle" )
                L.Weapons[i].WeaponClass = class'DZSniperRifle';
        }
    }

    return true;
}

defaultproperties
{
     GroupName="Dynamic Zoom Lightning Gun"
     FriendlyName="Dynamic Zoom Lightning Gun"
     Description="Upgrades the Lighning Gun with the Dynamic Zoom enhancement. While in zoom mode, the zoom can be adjusted using the weapon selection keys, or the mouse wheel"
}

Code: Select all

class DZSniperRiflePickup extends SniperRiflePickup;

defaultproperties
{
    InventoryType=class'DZSniperRifle'
}

Posted: Mon Nov 13, 2006 12:29 am
by jb
Sorry have been away from the PC or a few days and did not see your post till now. Congrads for getting it to work!

Posted: Mon Nov 13, 2006 8:34 am
by lord_kungai
Check it out! Just compile the text as uc files and then use the mutators! Tell me how they are... plz... :D

Posted: Tue Dec 19, 2006 10:29 pm
by Kyllian
Well, I can get the ZoomStopSniperRifle code to compile, but the DZSniperRifle code gives me this on compile

Code: Select all

Analyzing...
Parsing DZSniperRifle
C:\UT2004\DZSnipe\Classes\DZSniperRifle.uc(124) : Error, Unexpected 'else'
Compile aborted due to errors.
Failure - 1 error(s), 0 warning(s)
Which I believe is this line under simulated function Weapon NextWeapon(Weapon CurrentChoice, Weapon CurrentWeapon):

Code: Select all

        else if ( (CurrentChoice.InventoryGroup <CurrentWeapon> CurrentWeapon.InventoryGroup) )

Posted: Wed Dec 20, 2006 11:01 am
by lord_kungai
Oh yeah...

this was a typo mistake that even i got...

I corrected it bu forgot to post the corrections 8D

Posted: Thu Dec 21, 2006 12:13 am
by Kyllian
lord_kungai wrote:I corrected it bu forgot to post the corrections 8D
Where's the fix then? =P

Posted: Thu Dec 21, 2006 10:23 am
by lord_kungai
Kyllian wrote:
lord_kungai wrote:I corrected it bu forgot to post the corrections 8D
Where's the fix then? =P
It didn't come?

WTH?

Anyways, here:

DZSniperRiflePickup.uc

Code: Select all

class DZSniperRiflePickup extends SniperRiflePickup;

defaultproperties
{
    InventoryType=class'DZSniperRifle'
}
DZSniperRifle.uc

Code: Select all

class DZSniperRifle extends SniperRifle;

var bool isZoom;
var bool clicky;
var int zoomDepth;

simulated function ClientWeaponThrown()
{
    if( (Instigator != None) && (PlayerController(Instigator.Controller) != None) )
        {
        PlayerController(Instigator.Controller).DesiredFOV  = PlayerController(Instigator.Controller).DefaultFOV;
        }
    Super.ClientWeaponThrown();
}

simulated function ClientStartFire(int mode)
{
    if (mode == 1)
    {
        FireMode[mode].bIsFiring = true;
        if( Instigator.Controller.IsA( 'PlayerController' ) )
            {
		    if(!clicky)
		    {
			  if(isZoom)
			  {
				isZoom=false;
				PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV;
			  }
			  else
			  {
				isZoom=true;
				PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV - 1 - zoomDepth;
			  }
			  clicky=true;
		    }
            }
    }
    else
    {
        Super.ClientStartFire(mode);
    }
}

simulated function ClientStopFire(int mode)
{
    if (mode == 1)
    {
	  FireMode[mode].bIsFiring = false;
        if( PlayerController(Instigator.Controller) != None )
	  {
            clicky = false;
	  }
    }
    else
    {
        Super.ClientStopFire(mode);
    }
}

simulated function Weapon PrevWeapon(Weapon CurrentChoice, Weapon CurrentWeapon)
{
if(isZoom)
{
if(zoomDepth>=10)
{
zoomDepth -= 10;
PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV - 1 - zoomDepth;
}
}
else
{
    if ( HasAmmo() )
    {
        if ( (CurrentChoice == None) )
        {
            if ( CurrentWeapon != self )
                CurrentChoice = self;
        }
        else if ( InventoryGroup == CurrentWeapon.InventoryGroup )
        {
            if ( (GroupOffset <CurrentWeapon> CurrentChoice.GroupOffset)) )
                CurrentChoice = self;
		}
        else if ( InventoryGroup == CurrentChoice.InventoryGroup )
        {
            if ( GroupOffset > CurrentChoice.GroupOffset )
                CurrentChoice = self;
        }
        else if ( InventoryGroup > CurrentChoice.InventoryGroup )
        {
			if ( (InventoryGroup <CurrentWeapon> CurrentWeapon.InventoryGroup) )
                CurrentChoice = self;
        }
        else if ( (CurrentChoice.InventoryGroup > CurrentWeapon.InventoryGroup)
                && (InventoryGroup < CurrentWeapon.InventoryGroup) )
            CurrentChoice = self;
    }
    if ( Inventory == None )
        return CurrentChoice;
    else
        return Inventory.PrevWeapon(CurrentChoice,CurrentWeapon);
}
}

simulated function Weapon NextWeapon(Weapon CurrentChoice, Weapon CurrentWeapon)
{
if(isZoom)
{
if(zoomDepth<70> CurrentWeapon.GroupOffset)
                && ((CurrentChoice.InventoryGroup != InventoryGroup) || (GroupOffset < CurrentChoice.GroupOffset)) )
                CurrentChoice = self;
        }
        else if ( InventoryGroup == CurrentChoice.InventoryGroup )
        {
			if ( GroupOffset < CurrentChoice.GroupOffset )
                CurrentChoice = self;
        }

        else if ( InventoryGroup <CurrentChoice> CurrentWeapon.InventoryGroup)
                || (CurrentChoice.InventoryGroup < CurrentWeapon.InventoryGroup) )
                CurrentChoice = self;
        }
        else if ( (CurrentChoice.InventoryGroup <CurrentWeapon> CurrentWeapon.InventoryGroup) )
            CurrentChoice = self;
    }
    if ( Inventory == None )
        return CurrentChoice;
    else
        return Inventory.NextWeapon(CurrentChoice,CurrentWeapon);
}
}

simulated function bool PutDown()
{
    if( Instigator.Controller.IsA( 'PlayerController' ) )
        {
        isZoom=false;
	  PlayerController(Instigator.Controller).DesiredFOV = PlayerController(Instigator.Controller).DefaultFOV;
        }
    if ( Super.PutDown() )
    {
		GotoState('');
		return true;
	}
	return false;
}

defaultproperties
{
    PickupClass=class'DZSniperRiflePickup'
    isZoom=false
    clicky=false
    zoomdepth=0
}
DynamicZoomMut.uc

Code: Select all

class DynamicZoomMut extends Mutator
    config(user);

function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
    local int i;
    local WeaponLocker L;

    bSuperRelevant = 0;

    if ( xWeaponBase(Other) != None )
    {
        if ( string( xWeaponBase(Other).WeaponType ) ~= "XWeapons.SniperRifle" )
        {
            xWeaponBase(Other).WeaponType = class'DZSniperRifle';
            return false;
        }
    }
    else if ( WeaponPickup(Other) != None )
    {
        if ( string(Other.Class) ~= "XWeapons.SniperRiflePickup" )
        {
            ReplaceWith( Other, "DZSniperRiflePickup" );
            return false;
        }
    }
    else if ( WeaponLocker(Other) != None )
    {
        L = WeaponLocker(Other);

        for (i = 0; i < L.Weapons.Length; i++)
        {
            if ( string( L.Weapons[i].WeaponClass ) ~= "XWeapons.SniperRifle" )
                L.Weapons[i].WeaponClass = class'DZSniperRifle';
        }
    }

    return true;
}

defaultproperties
{
     GroupName="Dynamic Zoom"
     FriendlyName="Dynamic Zoom"
     Description="Upgrades the Lighning Gun with the Dynamic Zoom enhancement. While in zoom mode, the zoom can be adjusted using the weapon selection keys or the mouse wheel"
}

Posted: Thu Dec 21, 2006 10:34 am
by lord_kungai
Hmmm....


This code is compiling for me, but there doesn't appear to be a change in the code since my previous post, unless some kind soul decided to take pity on me and hack into a mod account and change it... :P

Posted: Thu Dec 21, 2006 10:52 pm
by Kyllian
Still can't get it to compiole
Exact same error as before

I'm confused as to how you can get it to compile and I cannot, even with it being the same code
Maybe something is getting borked when you post it in

Code: Select all

 tags