For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Can't understand something in Krall's code.

Ask UnrealEd 1 mapping related questions, or give hints, tips and tricks
User avatar
SFJake
OldUnreal Member
Posts: 252
Joined: Sun Aug 15, 2010 4:31 pm

Can't understand something in Krall's code.

Post by SFJake »

Code: Select all

function PlayTakeHit(float tweentime, vector HitLoc, int damage)
{
      local carcass carc;
      local LeglessKrall rep;
      local pawn OtherPawn;

      if ( (Health > 30) || (damage < 24) || (HitLoc.Z > Location.Z) || (FRand() < 0.6) || Level.Game.bVeryLowGore )
      {
            Super.PlayTakeHit(tweentime, HitLoc, damage);
            return;
      }

      carc = Spawn(class 'CreatureChunks',,, Location - CollisionHeight * vect(0,0,0.5), Rotation + rot(3000,0,16384) );
      if (carc != None)
      {
            carc.Mesh = mesh'KrallFoot';
            carc.Initfor(self);
            carc.Velocity = Velocity + VSize(Velocity) * VRand();
            carc.Velocity.Z = FMax(carc.Velocity.Z, Velocity.Z);
      }
      carc = Spawn(class 'CreatureChunks',,, Location - CollisionHeight * vect(0,0,0.5), Rotation + rot(3000,0,16384) );
      if (carc != None)
      {
            carc.Mesh = mesh'KrallFoot';
            carc.Initfor(self);
            carc.Velocity = Velocity + VSize(Velocity) * VRand();
            carc.Velocity.Z = FMax(carc.Velocity.Z, Velocity.Z);
      }

      SetCollision(false, false, false);
      OtherPawn = Level.PawnList;
      while ( OtherPawn != None )
      {
            OtherPawn.Killed(enemy, self, '');
            OtherPawn = OtherPawn.nextPawn;
      }
      if ( CarriedDecoration != None )
            DropDecoration();
      TriggerEvent(Event,Self,Enemy);
      Level.Game.DiscardInventory(self);
      Velocity.Z *= 1.3;
      rep = Spawn(class'LeglessKrall');
      if (rep!=none)
            rep.InitFor(self);
      destroy();
}
I'm trying to manipulate the odds of a LeglessKrall spawning when a new Krall is killed. This is the only part of the code where LeglessKrall is referenced, yet, there is nothing random about it. But it clearly doesn't spawn all the time or even often at all.

What am I missing?
SFJake Center -
Unreal Nightmare - http://sfjake.byethost7.com/unrealnmproject.html
User avatar
Bleeder91[NL]
OldUnreal Member
Posts: 1062
Joined: Sun Oct 04, 2009 7:22 pm

Re: Can't understand something in Krall's code.

Post by Bleeder91[NL] »

first line there's a FRand().
So if all the things such as health damage and hitlocation match, there's a 40% chance that it goes legless.
Image
User avatar
SFJake
OldUnreal Member
Posts: 252
Joined: Sun Aug 15, 2010 4:31 pm

Re: Can't understand something in Krall's code.

Post by SFJake »

Well that wasn't hard.

I shouldn't check those things when its late and I'm tired. :P

Thanks.
SFJake Center -
Unreal Nightmare - http://sfjake.byethost7.com/unrealnmproject.html

Return to “UnrealEd, the editor for Unreal up to version  226”