RuneStorm
http://www.runestorm.com/forums/

Custom BW
http://www.runestorm.com/forums/viewtopic.php?f=27&t=75603
Page 1 of 1

Author:  Unreaity [ Sat Jan 09, 2010 10:01 am ]
Post subject:  Custom BW

In the past I have made custom weapons for ut2004 :violence-instagib: by taking animations from other weapons that are on the internet or that come with ut. Is there a place where I can download the source code for BW so I can use some of the animations, I have looked at the .u files and the other files but i canonly make out things like:

Code:
class X3Knife extends BallisticWeapon;

#exec OBJ LOAD File=BallisticSounds3.uax

var   bool         bThrowingKinfe;
var() name         KnifeBackAnim;
var() name         KnifeThrowAnim;
var   float         NextThrowTime;

simulated event AnimEnd (int Channel)
{
    local name anim;
    local float frame, rate;

    GetAnimParams(0, anim, frame, rate);

   if (anim == 'PrepThrow' && bThrowingKinfe)
      return;
   super.AnimEnd(Channel);
}
//simulated function DoWeaponSpecial(optional byte i)
exec simulated function WeaponSpecial(optional byte i)
{
   if (AmmoAmount(0) < 2 || Level.TimeSeconds < NextThrowTime || bThrowingKinfe)
      return;
   PlayAnim('PrepThrow');
   bThrowingKinfe=true;
   ServerWeaponSpecial(i);
}
function ServerWeaponSpecial(optional byte i)
{
   bThrowingKinfe=true;
}

//simulated function DoWeaponSpecialRelease(optional byte i)
exec simulated function WeaponSpecialRelease(optional byte i)
{
   if (!bThrowingKinfe || AmmoAmount(0) < 2 || Level.TimeSeconds < NextThrowTime)
      return;
   PlaySound(Sound'BallisticSounds3.Knife.KnifeThrow',,1.0,,32,,);
   if (level.NetMode == NM_Client)
      PlayAnim('Throw', 1.5);
   ServerWeaponSpecialRelease(i);
}
function ServerWeaponSpecialRelease(optional byte i)
{
   PlayAnim('Throw');
}
simulated function Notify_X3Throw()
{
   ThrowKnife();
   SetBoneScale(0, 0.0, 'Knife');
}
simulated function ThrowKnife()
{
   bThrowingKinfe=false;
   NextThrowTime = Level.TimeSeconds + 0.15;
   if (Role == ROLE_Authority)
   {
      super.ConsumeAmmo(0, 1);
      DoFireEffect();
   }
}
// Get aim then spawn projectile
function DoFireEffect()
{
    local Vector StartTrace, X, Y, Z, Start, End, HitLocation, HitNormal;
    local Rotator RAim;
   local actor Other;
   local Projectile Proj;

    GetViewAxes(X,Y,Z);
    // the to-hit trace always starts right in front of the eye
    Start = Instigator.Location + Instigator.EyePosition();
    StartTrace = Start + X*10;
    if (!WeaponCentered())
       StartTrace = StartTrace + Hand * Y*10 + Z*0;

   RAim = BFireMode[0].GetFireAim(StartTrace);
   RAim = Rotator(BFireMode[0].GetFireSpread() >> RAim);

   End = Start + (Vector(RAim)*2000);
   Other = Trace (HitLocation, HitNormal, End, Start, true);

   if (Other != None)
      RAim = Rotator(HitLocation-StartTrace);

   Proj = Spawn (class'X3Projectile',,, StartTrace, RAim);
   Proj.Instigator = Instigator;
}

simulated function Notify_X3OutOfSight()
{
   SetBoneScale(0, 1.0, 'Knife');
}

simulated function bool HasAmmo()   {   return true;   }
//simulated function bool ConsumeAmmo(int Mode, float Load, optional bool bAmountNeededIsMax)   { return true;   }
//function ConsumeAmmo(int Mode, float Load)   {   }

// AI Interface =====
function bool CanAttack(Actor Other)
{
   return true;
}

// choose between regular or alt-fire
function byte BestMode()
{
   local Bot B;
   local float Result;

   B = Bot(Instigator.Controller);
   if ( (B == None) || (B.Enemy == None) )
      return 0;

   if (VSize(B.Enemy.Location - Instigator.Location) > FireMode[0].MaxRange()*1.5)
      return 1;
   Result = FRand();
   if (vector(B.Enemy.Rotation) dot Normal(Instigator.Location - B.Enemy.Location) < 0.0)
      Result += 0.3;
   else
      Result -= 0.3;

   if (Result > 0.5)
      return 1;
   return 0;
}

function float GetAIRating()
{
   local Bot B;
   local float Result, Dist;
   local vector Dir;

   B = Bot(Instigator.Controller);
   if ( (B == None) || (B.Enemy == None) )
      return AIRating;

   Dir = B.Enemy.Location - Instigator.Location;
   Dist = VSize(Dir);

   Result = AIRating;
   // Enemy too far away
   if (Dist > 1500)
      return 0.1;         // Enemy too far away
   // Better if we can get him in the back
   if (vector(B.Enemy.Rotation) dot Normal(Dir) < 0.0)
      Result += 0.08 * B.Skill;
   // If the enemy has a knife too, a gun looks better
   if (B.Enemy.Weapon != None && B.Enemy.Weapon.bMeleeWeapon)
      Result = FMax(0.0, Result *= 0.7 - (Dist/1000));
   // The further we are, the worse it is
   else
      Result = FMax(0.0, Result *= 1 - (Dist/1000));

   return Result;
}

// tells bot whether to charge or back off while using this weapon
function float SuggestAttackStyle()
{
   if (AIController(Instigator.Controller) == None)
      return 0.5;
   return AIController(Instigator.Controller).Skill / 4;
}

// tells bot whether to charge or back off while defending against this weapon
function float SuggestDefenseStyle()
{
   local Bot B;
   local float Result, Dist;

   B = Bot(Instigator.Controller);
   if ( (B == None) || (B.Enemy == None) )
      return -0.5;

   Dist = VSize(B.Enemy.Location - Instigator.Location);

   Result = -1 * (B.Skill / 6);
   Result *= (1 - (Dist/1500));
    return FClamp(Result, -1.0, -0.3);
}
// End AI Stuff =====



and this does not help me because the code I am looking for is for the R78A1 :violence-sniperdark: . which I cannot find in any of the files.
can someone please tell me where I could find this...

Author:  Captain Xavious [ Sat Jan 09, 2010 11:32 am ]
Post subject:  Re: Custom BW

viewtopic.php?f=27&t=55881

Check there.

Author:  Unreaity [ Sat Jan 09, 2010 12:47 pm ]
Post subject:  Re: Custom BW

thank you :text-thankyoublue:

Author:  Unreaity [ Sun Jan 10, 2010 9:50 am ]
Post subject:  Re: Custom BW

I am also curious, the code that i used for an example. did you write it by hand or did you use a program to make the c++ code? ???

Author:  Captain Xavious [ Sun Jan 10, 2010 9:18 pm ]
Post subject:  Re: Custom BW

Hmm? That was written by DarkCarnivour of RuneStorm. I just decompiled it with UEd.

Author:  Unreaity [ Wed Jan 13, 2010 6:59 pm ]
Post subject:  Re: Custom BW

i will ask him. thank you.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/