Foro de elhacker.net

Programación => Programación General => Mensaje iniciado por: benja vallejos en 26 Julio 2013, 07:34 am



Título: unreal goty o 1999
Publicado por: benja vallejos en 26 Julio 2013, 07:34 am
hola gente de elhacker bueno miren tengo una gran duda y necesito de alguien que sepa sobre programacion me gustaria saber de que trata este script y si alguien conoce su lenguaje.
//=============================================================================
// AsmdPulseRifle.
// Written By nOs*Wildcard
//=============================================================================
class AsmdPulseRifle expands WildcardsWeapons;

var float Angle, Count;
var PBolt PlasmaBeam;
var() sound DownSound;
var() int HitDamage;

auto state Pickup
{
   ignores AnimEnd;

   event BeginState()
   {
      MultiSkins[1]=Texture'AsmdPulseRifleSkin';
      MultiSkins[2]=None;
   }

   event EndState()
   {
      MultiSkins[1]=None;
      MultiSkins[2]=Texture'AsmdPulseRifleSkin';
   }

   // Landed on ground.
   simulated function Landed(Vector HitNormal)
   {
      local rotator newRot;

      newRot = Rotation;
      newRot.pitch = 0;
      SetRotation(newRot);
      if ( Role == ROLE_Authority )
      {
         bSimFall = false;
         SetTimer(2.0, false);
      }
   }
}

simulated event RenderOverlays( canvas Canvas )
{
   MultiSkins[1]=Texture'Ammoled';

   Texture'Ammoled'.NotifyActor = Self;
   Super.RenderOverlays(Canvas);
   Texture'Ammoled'.NotifyActor = None;

   MultiSkins[1]=Texture'AsmdPulseRifleSkin';
}

simulated function Destroyed()
{
   if ( PlasmaBeam != None )
      PlasmaBeam.Destroy();

   Super.Destroyed();
}

simulated function AnimEnd()
{
   if ( (Level.NetMode == NM_Client) && (Mesh != PickupViewMesh) )
   {
      if ( AnimSequence == 'SpinDown' )
         AnimSequence = 'Idle';
      PlayIdleAnim();
   }
}
// set which hand is holding weapon
function setHand(float Hand)
{
   if ( Hand == 2 )
   {
      FireOffset.Y = 0;
      bHideWeapon = true;
      if ( PlasmaBeam != None )
         PlasmaBeam.bCenter = true;
      return;
   }
   else
      bHideWeapon = false;
   PlayerViewOffset = Default.PlayerViewOffset * 100;
   if ( Hand == 1 )
   {
      if ( PlasmaBeam != None )
      {
         PlasmaBeam.bCenter = false;
         PlasmaBeam.bRight = false;
      }
      FireOffset.Y = Default.FireOffset.Y;
      Mesh = mesh(DynamicLoadObject("Botpack.PulseGunL", class'Mesh'));
   }
   else
   {
      if ( PlasmaBeam != None )
      {
         PlasmaBeam.bCenter = false;
         PlasmaBeam.bRight = true;
      }
      FireOffset.Y = -1 * Default.FireOffset.Y;
      Mesh = mesh'PulseGunR';
   }
}

// return delta to combat style
function float SuggestAttackStyle()
{
   local float EnemyDist;

   EnemyDist = VSize(Pawn(Owner).Enemy.Location - Owner.Location);
   if ( EnemyDist < 1000 )
      return 0.4;
   else
      return 0;
}

function float RateSelf( out int bUseAltMode )
{
   local Pawn P;

   if ( AmmoType.AmmoAmount <=0 )
      return -2;

   P = Pawn(Owner);
   if ( (P.Enemy == None) || (Owner.IsA('Bot') && Bot(Owner).bQuickFire) )
   {
      bUseAltMode = 0;
      return AIRating;
   }

   if ( P.Enemy.IsA('StationaryPawn') )
   {
      bUseAltMode = 0;
      return (AIRating + 0.4);
   }
   else
      bUseAltMode = int( 700 > VSize(P.Enemy.Location - Owner.Location) );

   AIRating *= FMin(Pawn(Owner).DamageScaling, 1.5);
   return AIRating;
}

simulated function PlayFiring()
{
   FlashCount++;
   AmbientSound = FireSound;
   SoundVolume = Pawn(Owner).SoundDampening*255;
   LoopAnim( 'shootLOOP', 1 + 0.5 * FireAdjust, 0.0);
   bWarnTarget = (FRand() < 0.2);
}

simulated function PlayAltFiring()
{
   
   FlashCount++;
   AmbientSound = AltFireSound;
   SoundVolume = Pawn(Owner).SoundDampening*255;
   LoopAnim( 'shootLOOP', 1 + 0.5 * FireAdjust, 0.0);
   bWarnTarget = (FRand() < 0.2);
}

function AltFire( float Value )
{
   if ( AmmoType == None )
   {
      // ammocheck
      GiveAmmo(Pawn(Owner));
   }
   if (AmmoType.UseAmmo(1))
   {
      GotoState('AltFiring');
      bCanClientFire = true;
      bPointing=True;
      Pawn(Owner).PlayRecoil(FiringSpeed);
      ClientAltFire(value);
      ProjectileFire(AltProjectileClass, AltProjectileSpeed, bAltWarnTarget);
   }
}

simulated event RenderTexture(ScriptedTexture Tex)
{
   local Color C;
   local string Temp;
   
   Temp = String(AmmoType.AmmoAmount);

   while(Len(Temp) < 3) Temp = "0"$Temp;

   Tex.DrawTile( 30, 100, (Min(AmmoType.AmmoAmount,AmmoType.Default.AmmoAmount)*196)/AmmoType.Default.AmmoAmount, 10, 0, 0, 1, 1, Texture'AmmoCountBar', False );

   if(AmmoType.AmmoAmount < 10)
   {
      C.R = 255;
      C.G = 255;
      C.B = 0;   
   }
   else
   {
      C.R = 255;
      C.G = 0;
      C.B = 255;
   }

   Tex.DrawColoredText( 56, 14, Temp, Font'LEDFont', C );   
}


///////////////////////////////////////////////////////
state NormalFire
{
   ignores AnimEnd;

   function Projectile ProjectileFire(class<projectile> ProjClass, float ProjSpeed, bool bWarn)
   {
      local Vector Start, X,Y,Z;

      Owner.MakeNoise(Pawn(Owner).SoundDampening);
      GetAxes(Pawn(owner).ViewRotation,X,Y,Z);
      Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
      AdjustedAim = pawn(owner).AdjustAim(ProjSpeed, Start, AimError, True, bWarn);   
      Start = Start - Sin(Angle)*Y*4 + (Cos(Angle)*4 - 10.78)*Z;
      Angle += 1.8;
      return Spawn(ProjClass,,, Start,AdjustedAim);   
   }

   function Tick( float DeltaTime )
   {
      if (Owner==None)
         GotoState('Pickup');
   }

   function BeginState()
   {
      Super.BeginState();
      Angle = 0;
      AmbientGlow = 200;
   }

   function EndState()
   {
      PlaySpinDown();
      AmbientSound = None;
      AmbientGlow = 0;   
      OldFlashCount = FlashCount;   
      Super.EndState();
   }

Begin:
   Sleep(0.18);
   Finish();
}

simulated function PlaySpinDown()
{
   if ( (Mesh != PickupViewMesh) && (Owner != None) )
   {
      PlayAnim('Spindown', 1.0, 0.0);
      Owner.PlayOwnedSound(DownSound, SLOT_None,1.0*Pawn(Owner).SoundDampening);
   }
}   

state ClientFiring
{
   simulated function Tick( float DeltaTime )
   {
      if ( (Pawn(Owner) != None) && (Pawn(Owner).bFire != 0) )
         AmbientSound = FireSound;
      else
         AmbientSound = None;
   }

   simulated function AnimEnd()
   {
      if ( (AmmoType != None) && (AmmoType.AmmoAmount <= 0) )
      {
         PlaySpinDown();
         GotoState('');
      }
      else if ( !bCanClientFire )
         GotoState('');
      else if ( Pawn(Owner) == None )
      {
         PlaySpinDown();
         GotoState('');
      }
      else if ( Pawn(Owner).bFire != 0 )
         Global.ClientFire(0);
      else if ( Pawn(Owner).bAltFire != 0 )
         Global.ClientAltFire(0);
      else
      {
         PlaySpinDown();
         GotoState('');
      }
   }
}

///////////////////////////////////////////////////////////////
state ClientAltFiring
{
   simulated function AnimEnd()
   {
      if ( AmmoType.AmmoAmount <= 0 )
      {
         PlayIdleAnim();
         GotoState('');
      }
      else if ( !bCanClientFire )
         GotoState('');
      else if ( Pawn(Owner) == None )
      {
         PlayIdleAnim();
         GotoState('');
      }
      else if ( Pawn(Owner).bAltFire != 0 )
         LoopAnim( 'shootLOOP', 1 + 0.5 * FireAdjust, 0.0);
      else if ( Pawn(Owner).bFire != 0 )
         Global.ClientFire(0);
      else
      {
         PlayIdleAnim();
         GotoState('');
      }
   }
}

state AltFiring
{
   ignores AnimEnd;

   function Projectile ProjectileFire(class<projectile> ProjClass, float ProjSpeed, bool bWarn)
   {
      local Vector Start, X,Y,Z;

      Owner.MakeNoise(Pawn(Owner).SoundDampening);
      GetAxes(Pawn(owner).ViewRotation,X,Y,Z);
      Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
      AdjustedAim = pawn(owner).AdjustAim(ProjSpeed, Start, AimError, True, bWarn);   
      Start = Start - Sin(Angle)*Y*4 + (Cos(Angle)*4 - 10.78)*Z;
      Angle += 1.8;
      return Spawn(ProjClass,,, Start,AdjustedAim);   
   }

   function Tick( float DeltaTime )
   {
      if (Owner==None)
         GotoState('Pickup');
   }

   function BeginState()
   {
      Super.BeginState();
      Angle = 0;
      AmbientGlow = 200;
   }

   function EndState()
   {
      PlaySpinDown();
      AmbientSound = None;
      AmbientGlow = 0;   
      OldFlashCount = FlashCount;   
      Super.EndState();
   }

Begin:
   Sleep(0.18);
   Finish();
}

state Idle
{
Begin:
   bPointing=False;
   if ( (AmmoType != None) && (AmmoType.AmmoAmount<=0) )
      Pawn(Owner).SwitchToBestWeapon();  //Goto Weapon that has Ammo
   if ( Pawn(Owner).bFire!=0 ) Fire(0.0);
   if ( Pawn(Owner).bAltFire!=0 ) AltFire(0.0);   

   Disable('AnimEnd');
   PlayIdleAnim();
}

///////////////////////////////////////////////////////////
simulated function PlayIdleAnim()
{
   if ( Mesh == PickupViewMesh )
      return;

   if ( (AnimSequence == 'BoltLoop') || (AnimSequence == 'BoltStart') )
      PlayAnim('BoltEnd');      
   else if ( AnimSequence != 'SpinDown' )
      TweenAnim('Idle', 0.1);
}

simulated function TweenDown()
{
   if ( IsAnimating() && (AnimSequence != '') && (GetAnimGroup(AnimSequence) == 'Select') )
      TweenAnim( AnimSequence, AnimFrame * 0.4 );
   else
      TweenAnim('Down', 0.26);
}

function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
   local int i;
   local PlayerPawn PlayerOwner;

   if (Other==None)
   {
      HitNormal = -X;
      HitLocation = Owner.Location + X*10000.0;
   }

   PlayerOwner = PlayerPawn(Owner);
   if ( PlayerOwner != None )
      PlayerOwner.ClientInstantFlash( -0.4, vect(450, 190, 650));
   SpawnEffect(HitLocation, Owner.Location + CalcDrawOffset() + (FireOffset.X + 20) * X + FireOffset.Y * Y + FireOffset.Z * Z);

   if ( ShockProj(Other)!=None )
   {
      AmmoType.UseAmmo(2);
      ShockProj(Other).SuperExplosion();
   }
   else
      Spawn(class'ut_RingExplosion5',,, HitLocation+HitNormal*8,rotator(HitNormal));

   if ( (Other != self) && (Other != Owner) && (Other != None) )
      Other.TakeDamage(HitDamage, Pawn(Owner), HitLocation, 60000.0*X, MyDamageType);
}

function SpawnEffect(vector HitLocation, vector SmokeLocation)
{
   local ShockBeam Smoke,shock;
   local Vector DVector;
   local int NumPoints;
   local rotator SmokeRotation;

   DVector = HitLocation - SmokeLocation;
   NumPoints = VSize(DVector)/135.0;
   if ( NumPoints < 1 )
      return;
   SmokeRotation = rotator(DVector);
   SmokeRotation.roll = Rand(65535);
   
   Smoke = Spawn(class'ShockBeam',,,SmokeLocation,SmokeRotation);
   Smoke.MoveAmount = DVector/NumPoints;
   Smoke.NumPuffs = NumPoints - 1;   
}



Título: Re: unreal goty o 1999
Publicado por: xustyx en 26 Julio 2013, 10:10 am
Parece ser un Mutator de la ASMD :) el lenguaje creo que es UnrealScript.


Título: Re: unreal goty o 1999
Publicado por: benja vallejos en 26 Julio 2013, 23:38 pm
pero conoces lo que describe en cada inea?


Título: Re: unreal goty o 1999
Publicado por: xustyx en 2 Agosto 2013, 00:29 am
Visto en plano pues algo se entiende pero hay que mirarselo bien, es una classe, y como toda clase tendra sus metodos, propiedades, atributos etc... etc... aparte parece que hereda, la verdad no se UnrealScript, pero por lo que veo se asemeja mucho al estandar.