We just reached 25,000 articles on this wiki! 🥳
If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Harry Potter och Hemligheternas kammare (Windows, Mac OS Classic, Mac OS X)/Oanvända programskript och konstigheter

From The Cutting Room Floor
Jump to navigation Jump to search

This is a sub-page of Harry Potter and the Chamber of Secrets (Windows, Mac OS Classic, Mac OS X)/Unused Scripts and Oddities.

This cactus is UNDER CONSTRUCTION
This article is a work in progress.
...Well, all the articles here are, in a way. But this one moreso, and the article may contain incomplete information and editor's notes.

Här är det var alla oanvända programskript är använda, men konstigheter från redan använda skript kommer också att dokumenteras här.

Kvarlämningar

Boulder (Rullsten)

Rullstenen från förra spelet används inte här, samma med dess skript.

//================================================================================
// Boulder.
//================================================================================

class Boulder extends HProp;

function bool HandleSpellFlipendo (optional baseSpell spell, optional Vector vHitLocation)
{
  GotoState('patrol');
  return True;
}

function Trigger (Actor Other, Pawn EventInstigator)
{
  HandleSpellFlipendo();
}

function _PostPawnAtPatrolPoint (PatrolPoint CurrentP, PatrolPoint NextP)
{
  if ( CurrentP.PauseTime > byte(0) )
  {
    LoopAnim(IdleAnimName);
    GotoState('stateIdle');
  } else {
    Super._PostPawnAtPatrolPoint(CurrentP,NextP);
  }
}

defaultproperties
{
    IdleAnimName=Stop

    WalkAnimName=Roll

    RunAnimName=Roll

    Physics=1

    Mesh=SkeletalMesh'HPModels.skboulderMesh'

    CollisionRadius=44.00

    CollisionHeight=44.00

}

Spelarprogramskript

TestChar (Testkaraktär)

Ett enkelt programskript till för att testa patrollpunkter och splines, men som använder en julgrans maska?

//================================================================================
// TestChar.
//================================================================================

class TestChar extends HChar;

var() name Start[3];
var() name End[3];
var float MyTimer;
var int CurrentPiece;

function OnEvent (name EventName)
{
  if ( EventName == 'ActionDone' )
  {
    PlayerHarry.ClientMessage("ActionDone");
    if ( IsInState('patrolFollowSpline') )
    {
      GotoState('DoSplineFollowWait');
    }
  }
}

function FollowNextSplinePath ()
{
  CurrentPiece++;
  if ( CurrentPiece >= 3 )
  {
    CurrentPiece = 0;
  }
  FollowSplinePath('InterpolationPointSet3',60.0,30.0,Start[CurrentPiece],End[CurrentPiece],,4);
}

auto state() DoNothing
{
  FollowSplinePath('InterpolationPointSet3',60.0);
}

state patrolFollowSpline extends patrolFollowSpline
{
  function Tick (float dtime)
  {
    MyTimer += dtime;
    if ( MyTimer >= byte(10) )
    {
      MyTimer = 0.0;
      GotoState('sldkfj');
    }
  }
  
  function Timer ()
  {
  }
  
}

state() DoSplineFollow
{
  CurrentPiece = -1;
  FollowNextSplinePath();
}

state() stateDoMoveTo
{
  Sleep(2.0);
  CutCommand("FlyTo baseCam EaseBetween Fixed x=-12.34 time=1.5");
}

state DoSplineFollowWait
{
  Sleep(2.0);
  FollowNextSplinePath();
}

state stateGotoPatrol
{
  GotoState('patrol');
}

state stateMoveAround
{
  MoveTo(Location + Normal(VRand() * Vec(1.0,1.0,0.0)) * byte(150));
  goto ('Begin');
}

defaultproperties
{
    Mesh=SkeletalMesh'HProps.skChristmasTreeMesh'

}

harry

Det största programskriptet i spelet.

När en bana först laddas och Harry gör ett första hopp används en annorlunda animation som inte ses igen tills en bana laddas igen.

if ( iEctoRefCount > 0 )
  {
    PlayAnim(HarryAnims[bool(HarryAnimSet)].Jump,,0.1,HarryAnimType);
    HarryAnimChannel.DoEctoJump();
    return;
  } else {
    if ( iSleepyAnimTimer > 0 )
    {
      PlayAnim(HarryAnims[bool(HarryAnimSet)].Jump,,0.1,HarryAnimType);
      HarryAnimChannel.DoSleepyJump();
      return;
    }
  }

I samband med "AddHousePoints" finns denna oanvända funktion.

function Add60HousePointsToGryffindor ()
{
  numHousePointsHarry += 60;
  numHousePointsGryffindor += 60;
  numLastHousePointsHarry = 60;
  if ( numHousePointsSlytherin >= numHousePointsGryffindor )
  {
    numHousePointsSlytherin = numHousePointsGryffindor - 1;
  }
}

Filmer

Adv1TutManager

Detta är ett tidigt och ofärdigt programskript för den första banan. Troligast började utvecklarna skriva i det innan de gick vidare till .int-filer för resten av filmklippen.

//================================================================================
// Adv1TutManager.
//================================================================================

class Adv1TutManager extends Director;

var() float LookAtRonConeAngle;
var() name Event_HarrySeesRon;
var() name Event_PushForward;
var() name Event_PushBackward;
var() name Event_PushStrafeLeft;
var() name Event_PushStrafeRight;
var Ron Ron;
var harry PlayerHarry;
var bool bTriggerReceived;
var bool bConditionMet;

function PostBeginPlay ()
{
  foreach AllActors(Class'Ron',Ron)
  {
    goto JL0014;
  }
  foreach AllActors(Class'harry',PlayerHarry)
  {
    PlayerHarry.Adv1TutManager = self;
    goto JL0039;
  }
}

function ForwardPushed ()
{
}

function BackwardPushed ()
{
}

function StrafeLeftPushed ()
{
}

function StrafeRightPushed ()
{
}

auto state stateStart
{
  function Trigger (Actor Other, Pawn EventInstigator)
  {
    PlayerHarry.ClientMessage("**** Trigger, wait for look at ron");
    GotoState('stateWaitForHarryLookAtRon');
  }
  
}

state stateWaitForHarryLookAtRon
{
  if ( Normal(Ron.Location - PlayerHarry.Cam.Location) Dot PlayerHarry.Cam.Rotation > Cos(LookAtRonConeAngle * byte(2) * 3.14159989 / byte(360)) )
  {
    PlayerHarry.ClientMessage("**** See Ron");
  } else {
    Sleep(0.1);
    if (! False ) goto JL0000;
  }
  TriggerEvent(Event_HarrySeesRon,self,PlayerHarry);
  GotoState('stateWaitForHarryMoveForward');
}

state stateWaitForHarryMoveForward
{
  function BeginState ()
  {
    bTriggerReceived = False;
    bConditionMet = False;
  }
  
  function Trigger (Actor Other, Pawn EventInstigator)
  {
    PlayerHarry.ClientMessage("*** waitforharrymoveforward trigger");
    bTriggerReceived = True;
    PlayerHarry.bLockOutForward = False;
  }
  
  function ForwardPushed ()
  {
    PlayerHarry.ClientMessage("*** pushforward");
    if ( bTriggerReceived )
    {
      bConditionMet = True;
    }
  }
  
  Sleep(0.1);
  if (! bConditionMet ) goto JL0000;
  Sleep(0.5);
  PlayerHarry.bLockOutForward = True;
  TriggerEvent(Event_PushForward,self,PlayerHarry);
  GotoState('stateWaitForHarryMoveBackward');
}

state stateWaitForHarryMoveBackward
{
  function BeginState ()
  {
    bTriggerReceived = False;
    bConditionMet = False;
  }
  
  function Trigger (Actor Other, Pawn EventInstigator)
  {
    bTriggerReceived = True;
    PlayerHarry.bLockOutBackward = False;
  }
  
  function BackwardPushed ()
  {
    if ( bTriggerReceived )
    {
      bConditionMet = True;
    }
  }
  
  Sleep(0.1);
  if (! bConditionMet ) goto JL0000;
  Sleep(0.5);
  PlayerHarry.bLockOutBackward = True;
  TriggerEvent(Event_PushBackward,self,PlayerHarry);
  GotoState('stateWaitForHarryStrafeLeft');
}

state stateWaitForHarryStrafeLeft
{
  function BeginState ()
  {
    bTriggerReceived = False;
    bConditionMet = False;
  }
  
  function Trigger (Actor Other, Pawn EventInstigator)
  {
    bTriggerReceived = True;
    PlayerHarry.bLockOutStrafeLeft = False;
  }
  
  function StrafeLeftPushed ()
  {
    if ( bTriggerReceived )
    {
      bConditionMet = True;
    } else {
      PlayerHarry.ClientMessage("Trigger not received yet");
    }
  }
  
  Sleep(0.1);
  if (! bConditionMet ) goto JL0000;
  Sleep(0.5);
  PlayerHarry.bLockOutStrafeLeft = True;
  TriggerEvent(Event_PushStrafeLeft,self,PlayerHarry);
  GotoState('stateWaitForHarryStrafeRight');
}

state stateWaitForHarryStrafeRight
{
  function BeginState ()
  {
    bTriggerReceived = False;
    bConditionMet = False;
  }
  
  function Trigger (Actor Other, Pawn EventInstigator)
  {
    bTriggerReceived = True;
    PlayerHarry.bLockOutStrafeRight = False;
  }
  
  function StrafeRightPushed ()
  {
    if ( bTriggerReceived )
    {
      bConditionMet = True;
    }
  }
  
  Sleep(0.1);
  if (! bConditionMet ) goto JL0000;
  Sleep(0.5);
  PlayerHarry.bLockOutStrafeRight = True;
  TriggerEvent(Event_PushStrafeRight,self,PlayerHarry);
  GotoState('stateKeepHarryLocked');
}

state stateKeepHarryLocked
{
  function Trigger (Actor Other, Pawn EventInstigator)
  {
    PlayerHarry.bLockOutForward = False;
    PlayerHarry.bLockOutBackward = False;
    PlayerHarry.bLockOutStrafeLeft = False;
    PlayerHarry.bLockOutStrafeRight = False;
    GotoState('stateDone1');
  }
  
}

state stateDone1
{
}

defaultproperties
{
    LookAtRonConeAngle=10.00

}

Snape

Om Snape upptäckte en hade han tagit ifrån fler och fler elevhemspoäng från en. Röstklippen finns fortfarande kvar i spelet och det går att implementera programskriptet, vilket kan ses nedan vid 1:44:

//================================================================================
// Snape.
//================================================================================

class Snape extends Characters;

var float fWaitTime;
var float fCurrTime;
var float fDuration;
var int iPointsToDeduct;

function AdjustHousePoints (int Points)
{
  local StatusGroup sgHousePoints;
  local int Count;

  if ( Points == 0 )
  {
    return;
  }
  Count = HousePointsCount();
  if ( Count + Points < 0 )
  {
    Points =  -Count;
  }
  sgHousePoints = PlayerHarry.managerStatus.GetStatusGroup(Class'StatusGroupHousePoints');
  sgHousePoints.IncrementCount(Class'StatusItemGryffindorPts',Points);
}

function int HousePointsCount ()
{
  local StatusGroup sgHousePoints;
  local int Count;

  sgHousePoints = PlayerHarry.managerStatus.GetStatusGroup(Class'StatusGroupHousePoints');
  Count = sgHousePoints.GetStatusItem(Class'StatusItemGryffindorPts').nCount;
  return Count;
}

function float PlaySnapeSoundText ()
{
  local float duration;

  switch (Rand(6))
  {
    case 0:
    duration = DeliverLocalizedDialog("PC_Snp_SnpDeductHP_03",True,0.0);
    iPointsToDeduct = 0;
    break;
    case 1:
    duration = DeliverLocalizedDialog("PC_Snp_SnpDeductHP_04",True,0.0);
    iPointsToDeduct = 5;
    break;
    case 2:
    duration = DeliverLocalizedDialog("PC_Snp_SnpDeductHP_05",True,0.0);
    iPointsToDeduct = 10;
    break;
    case 3:
    duration = DeliverLocalizedDialog("PC_Snp_SnpDeductHP_06",True,0.0);
    iPointsToDeduct = 15;
    break;
    case 4:
    duration = DeliverLocalizedDialog("PC_Snp_SnpDeductHP_07",True,0.0);
    iPointsToDeduct = 20;
    break;
    case 5:
    duration = DeliverLocalizedDialog("PC_Snp_SnpDeductHP_08",True,0.0);
    iPointsToDeduct = 0;
    break;
    default:
    duration = 0.0;
    iPointsToDeduct = 0;
    break;
  }
  return duration;
}

function PreBeginPlay ()
{
  Super.PreBeginPlay();
}

function Tick (float DeltaTime)
{
  Super.Tick(DeltaTime);
  if ( GetStateName() != 'patrol' )
  {
    return;
  }
  if ( PlayerHarry.CutNotifyActor != None )
  {
    return;
  }
  if ( HousePointsCount() <= 0 )
  {
    return;
  }
  fCurrTime += DeltaTime;
  if ( fCurrTime < fWaitTime )
  {
    return;
  }
  fCurrTime = 0.0;
  fWaitTime = 1.0;
  if ( VSize(Location - PlayerHarry.Location) < SightRadius )
  {
    if ( LineOfSightTo(PlayerHarry) )
    {
      vLastLocation = Location;
      GotoState('stateGotoHarry');
    } else {
    }
  }
}

function Bump (Actor Other)
{
  if ( Other != PlayerHarry )
  {
    return;
  }
  if ( GetStateName() != 'stateGotoHarry' )
  {
    return;
  }
  GotoState('stateSaySomething');
}

state stateSaySomething
{
  fWaitTime = 10.0;
  if ( PlayerHarry.CutNotifyActor == None )
  {
    Acceleration = vect(0.00,0.00,0.00);
    Velocity = vect(0.00,0.00,0.00);
    TurnTo(PlayerHarry.Location);
    PlayerHarry.CutCommand("Capture","");
    PlayerHarry.CutNotifyActor = self;
    fDuration = PlaySnapeSoundText();
    switch (Rand(3))
    {
      case 0:
      LoopAnim('talk_rhand');
      break;
      case 1:
      LoopAnim('talk_lhand');
      break;
      case 2:
      LoopAnim('talk_bothhands');
      break;
      default:
    }
    Sleep(fDuration - byte(1));
    FinishAnim();
    LoopAnim('Idle');
    Sleep(1.0);
    FinishAnim();
    PlayerHarry.CutCommand("Release","");
    PlayerHarry.CutNotifyActor = None;
    AdjustHousePoints( -iPointsToDeduct);
  }
  GotoState('patrol');
}

state stateGotoHarry
{
  LoopAnim('Walk');
  MoveTo(PlayerHarry.Location);
  FinishAnim();
  GotoState('patrol');
}

defaultproperties
{
    fWaitTime=1.00

    bLoopPath=True

    SightRadius=150.00

    IdleAnimName=Walk

    RunAnimName=Walk

    Mesh=SkeletalMesh'HPModels.skProfSnapeMesh'

    AmbientGlow=65

    CollisionRadius=20.00

    CollisionHeight=48.00

}

Flying Car (Flygande bil)

Tydligen skulle det finnas en bana för den flygande bilen istället för en enkel scen.

FlyingCarHarry

Det visas här, bilen hade styrts likt Harry i Quidditch och man behövde undvika hinder på en rak väg.

//================================================================================
// FlyingCarHarry.
//================================================================================

class FlyingCarHarry extends BroomHarry
  Config(User);

var Vector vCurrentTetherDistance;
var() float strafeSpeed;
var() float updownSpeed;
var() float rollAmount;
var() float pitchAmount;
var() float yawAmount;
var() float MaxDistanceToSide;
var() float MaxDistanceUpDown;
var() float AirSpeedNormal;
var() float AirSpeedBoost;
var() name PathName;
var Rotator guideRotation;
var float sideDistance;
var float upDistance;
var FlyingFordPathGuide guide;
var Vector vTurbulence;
var float fLightningYaw;
var float fLightningPitch;

function PreBeginPlay ()
{
  Super.PreBeginPlay();
  foreach AllActors(Class'Director',Director)
  {
    goto JL001A;
  }
}

function PostBeginPlay ()
{
  Super.PostBeginPlay();
  PrimaryAnim = 'Flying';
  SecondaryAnim = 'None';
  LoopAnim(PrimaryAnim);
  LookForTarget = None;
  bLookingForTarget = False;
  fRotationRateYaw = 20000.0;
  RotationRate.Yaw = 20000;
  RotationRate.Roll = 10000;
  RotationRate.Pitch = 20000;
  vCurrentTetherDistance = Vec(0.0,0.0,0.0);
}

event Possess ()
{
  Super.Possess();
  Log("BroomHarry in State " $ string(GetStateName()) $ ".");
  Director.OnPlayerPossessed();
  SetLocation(guide.Location);
  SetRotation(guide.Rotation);
}

function DeterminePrimaryAnim ()
{
  local float Speed;

  Speed = VSize(Velocity);
  SetPrimaryAnimation('Flying',,1.0);
  Trail.ParentBlend = byte(Min(Speed / byte(200) = 1));
}

function UpdateBroomSound ()
{
  local float fSpeed;
  local float fSpeedFactor;
  local float fTurnFactor;
  local float fVolume;
  local float fPitch;

  fSpeed = VSize(Velocity);
  if ( fSpeed < byte(50) )
  {
    fVolume = 0.0;
    fPitch = 1.5;
  } else {
    if ( fSpeed <= AirSpeedNormal )
    {
      fSpeedFactor = (fSpeed - byte(50)) / (AirSpeedNormal - byte(50));
      fVolume = 0.62 * fSpeedFactor;
      fPitch = 0.2 * fSpeedFactor + 1.5;
    } else {
      fSpeedFactor = (fSpeed - AirSpeedNormal) / (AirSpeedBoost - AirSpeedNormal);
      fVolume = 0.41 * fSpeedFactor + 0.62;
      fPitch = 0.151 * fSpeedFactor + 1.75;
    }
  }
  if ( Rotation.Roll <= 32768 )
  {
    fTurnFactor = byte(Rotation.Roll) / 4096.0;
  } else {
    if ( Rotation.Roll > 32768 )
    {
      fTurnFactor = (65536.0 - byte(Rotation.Roll)) / 4096.0;
    }
  }
  if ( Rotation.Pitch <= 32768 )
  {
    fTurnFactor += byte(Rotation.Pitch) / 8192.0;
  } else {
    if ( Rotation.Pitch > 32768 )
    {
      fTurnFactor += byte((65536 - Rotation.Pitch)) / 8192.0;
    }
  }
  fTurnFactor *= 0.5;
  if ( fTurnFactor > 1.0 )
  {
    fTurnFactor = 1.0;
  }
  fVolume *= 1.0 + 2.0 * fTurnFactor;
  fPitch *= 1.0 + 1.0 * fTurnFactor;
  if ( (fTurnFactor > 0.0) && (fTurnFactor < 0.1) )
  {
    if ( fSpeedFactor > 0.69999999 )
    {
      PlayFastWhooshSound();
    } else {
      PlaySlowWhooshSound();
    }
  }
  if (  !ModifySound(0,fTurnFactor,MainBroomSound,3) )
  {
    PlaySound(MainBroomSound,3,fTurnFactor,True,,1.0);
  }
  if (  !ModifySound(0,fVolume,BroomSound,1) )
  {
    PlaySound(BroomSound,1,fVolume,True,,fPitch);
  } else {
    ModifySound(2,fPitch,BroomSound,1);
  }
}

function Vector SideDirection (float fYawControl)
{
  local Vector vGuideDirection;
  local Vector vUp;
  local Vector vDown;
  local Vector vRight;
  local Vector vLeft;

  vGuideDirection = guide.Rotation;
  vUp = Vec(0.0,0.0,1.0);
  vDown = Vec(0.0,0.0,-1.0);
  vLeft = vGuideDirection Cross vDown;
  return vLeft;
}

state PlayerWalking extends PlayerWalking
{
  ignores  Mount, AltFire;
  
  function BeginState ()
  {
    Super.BeginState();
    SetPhysics(4);
    Cam.SetCameraMode(5);
  }
  
  function UpdateRotation (float DeltaTime, float maxPitch)
  {
    local Rotator NewRotation;
    local float YawVal;
    local float DeltaYaw;
    local int nDeltaYaw;
    local float DeltaPitch;
    local float fPitchLimitHi;
    local float fPitchLimitLo;
    local float fEffectiveMousePitch;
    local Vector MovementDirection;
    local float CarYawVal;
  
    NewRotation = Rotation;
    fPitchLimitHi = byte(PitchLimitUp) * byte(16384) / 90.0;
    fPitchLimitLo = 65536.0 - byte(PitchLimitDown) * byte(16384) / 90.0;
    if ( False )
    {
      if ( fMousePitch > 0.151 )
      {
        fEffectiveMousePitch = fMousePitch - 0.151;
        if ( fEffectiveMousePitch > 1.0 )
        {
          fEffectiveMousePitch = 1.0;
        }
      } else {
        if ( fMousePitch < -0.151 )
        {
          fEffectiveMousePitch = fMousePitch + 0.151;
          if ( fEffectiveMousePitch < -1.0 )
          {
            fEffectiveMousePitch = -1.0;
          }
        } else {
          fEffectiveMousePitch = 0.0;
        }
      }
      if ( (fEffectiveMousePitch < 0.0) &&  !bLastPitchNeg )
      {
        NoteAnotherReversal();
        bLastPitchNeg = True;
      } else {
        if ( (fEffectiveMousePitch > 0.0) && bLastPitchNeg )
        {
          NoteAnotherReversal();
          bLastPitchNeg = False;
        }
      }
      NewRotation.Pitch = fEffectiveMousePitch * fPitchLimitHi = NewRotation.Pitch = NewRotation.Pitch & 65535;
    } else {
      if ( (fPitchControl < 0.0) &&  !bLastPitchNeg )
      {
        NoteAnotherReversal();
        bLastPitchNeg = True;
      } else {
        if ( (fPitchControl > 0.0) && bLastPitchNeg )
        {
          NoteAnotherReversal();
          bLastPitchNeg = False;
        }
      }
      if ( Abs(fPitchControl) < 0.05 )
      {
        if ( Rotation.Pitch >= 32768 )
        {
          DeltaPitch = 65536.0 - byte(Rotation.Pitch);
        } else {
          DeltaPitch = byte(Rotation.Pitch);
        }
        fPitchControl = DeltaPitch / byte(RotationRate.Pitch) * DeltaTime;
        if ( fPitchControl > 1.0 )
        {
          fPitchControl = 1.0;
        }
        if ( Rotation.Pitch < 32768 )
        {
          fPitchControl =  -fPitchControl;
        }
      }
      NewRotation.Pitch += byte(RotationRate.Pitch) * DeltaTime * fPitchControl = );
      {
        if ( fPitchControl > byte(0) )
        {
          NewRotation.Pitch = fPitchLimitHi = �} else {;
          NewRotation.Pitch = fPitchLimitLo = if ( (fYawControl < 0.0) &&  !bLastYawNeg );
          // There are 3 jump destination(s) inside the last statement!
          {
            NoteAnotherReversal();
            bLastYawNeg = True;
          } else {
            if ( (fYawControl > 0.0) && bLastYawNeg )
            {
              NoteAnotherReversal();
              bLastYawNeg = False;
            }
          }
        }
      }
    }
    if ( Abs(fYawControl) < 0.05 )
    {
      if ( bHittingWall )
      {
        fYawControl = byte(WallAvoidanceYaw) * fWallAvoidanceRate / fRotationRateYaw * DeltaTime;
        fLastTimeAvoidedWall = Level.TimeSeconds;
      }
    } else {
      fLastTimeAvoidedWall = -1.0;
    }
    bHittingWall = False;
    if ( fYawControl > 1.0 )
    {
      fYawControl = 1.0;
    } else {
      if ( fYawControl < -1.0 )
      {
        fYawControl = -1.0;
      }
    }
    YawVal = fRotationRateYaw * DeltaTime * fYawControl;
    if ( Acceleration == vect(0.00,0.00,0.00) )
    {
      YawVal = 4.0 / 3.0 * YawVal;
    }
    CarYawVal = 4096.0 * fYawControl;
    sideDistance += YawVal / strafeSpeed;
    if ( NewRotation.Pitch != 0 )
    {
      if ( NewRotation.Pitch > 32768 )
      {
        upDistance += byte((NewRotation.Pitch - 65535)) / updownSpeed;
      } else {
        upDistance += byte(NewRotation.Pitch) / updownSpeed;
      }
    }
    if ( sideDistance > MaxDistanceToSide )
    {
      sideDistance = MaxDistanceToSide;
      CarYawVal = 0.0;
    }
    if ( sideDistance <  -MaxDistanceToSide )
    {
      sideDistance =  -MaxDistanceToSide;
      CarYawVal = 0.0;
    }
    if ( upDistance > MaxDistanceUpDown )
    {
      upDistance = MaxDistanceUpDown;
    }
    if ( upDistance <  -MaxDistanceUpDown )
    {
      upDistance =  -MaxDistanceUpDown;
    }
    MovementDirection = SideDirection(fYawControl);
    vCurrentTetherDistance.X = sideDistance * MovementDirection.X;
    vCurrentTetherDistance.Y = sideDistance * MovementDirection.Y;
    vCurrentTetherDistance.Z = upDistance;
    vCurrentTetherDistance += vTurbulence;
    SetLocation(guide.Location + vCurrentTetherDistance);
    NewRotation.Pitch += pitchAmount * fPitchControl = );
    guideRotation = guide.Rotation;
    guideRotation.Yaw += CarYawVal = );
    guideRotation.Yaw += fLightningYaw = );
    if ( AirSpeed == AirSpeedNormal )
    {
      guide.IPSpeed = 0.0;
    } else {
      guide.IPSpeed = AirSpeedBoost;
    }
  }
  
  function HitWall (Vector HitNormal, Actor Wall)
  {
    local Vector WallFaceDir;
    local Rotator WallFaceRot;
    local Vector Up;
    local Vector FlightDir;
    local float fSpeed;
    local int EffectiveDamage;
    local float fVolume;
    local bool bTurnToRight;
  
    if ( HitNormal.Z < -0.99989998 )
    {
      return;
    }
    if (  !bHitWall )
    {
      bHitWall = True;
      fSpeed = VSize(Velocity);
      fVolume = fSpeed / AirSpeedNormal;
      if (! WallDamage > 0 ) goto JL0053;
      Director.OnHitEvent(self);
    }
    if ( Abs(HitNormal.Z) >= 0.9851 )
    {
      return;
    } else {
      fWallAvoidanceRate = 1.0 - Abs(HitNormal.Z) / 0.9851;
    }
    Up.X = 0.0;
    Up.Y = 0.0;
    Up.Z = 1.0;
    WallFaceDir = HitNormal Cross Up;
    WallFaceRot = rotator(WallFaceDir);
    FlightDir = Rotation;
    if ( (fLastTimeAvoidedWall != -1.0) && (Level.TimeSeconds - fLastTimeAvoidedWall < 1.0) )
    {
      bTurnToRight = bLastAvoidanceRight;
    } else {
      bTurnToRight = FlightDir Dot WallFaceDir >= 0.0;
      bLastAvoidanceRight = bTurnToRight;
    }
    if ( bTurnToRight )
    {
      WallAvoidanceYaw = WallFaceRot.Yaw + 1000 - Rotation.Yaw & 65535;
      if ( WallAvoidanceYaw > 24576 )
      {
        WallAvoidanceYaw = 24576;
      }
    } else {
      WallAvoidanceYaw = WallFaceRot.Yaw + 32768 - 1000 - Rotation.Yaw & 65535;
      if ( WallAvoidanceYaw < 40960 )
      {
        WallAvoidanceYaw = 40960;
      }
      WallAvoidanceYaw -= 65536;
    }
    bHittingWall = True;
  }
  
  event Timer ()
  {
  }
  
}

defaultproperties
{
    strafeSpeed=100.00

    updownSpeed=150.00

    rollAmount=3.00

    pitchAmount=9.00

    yawAmount=8.00

    MaxDistanceToSide=1000.00

    MaxDistanceUpDown=75.00

    AirSpeedNormal=800.00

    AirSpeedBoost=800.00

    PitchLimitUp=45

    PitchLimitDown=45

    WallDamage=1

    IdleAnimName='

    Mesh=SkeletalMesh'HPModels.skFordFlyingMesh'

    bAlignBottom=False

    RotationRate=(Pitch=24000,Yaw=150000,Roll=6000),

}

FlyingFordDirector

Detta programskript är likt det första, men det verkar som att man behövde hålla sig dold från mugglare då en mätare annars fylls på och man troligen behövde försöka igen.

//================================================================================
// FlyingFordDirector.
//================================================================================

class FlyingFordDirector extends Director;

enum CarLocations {
  LOC_NONE,
  LOC_SAFE,
  LOC_TOWN
};

var FlyingCarHarry PlayerHarry;
var MuggleMeterManager MuggleMeter;
var FlyingFordPathGuide guide;
var FlyingFordHedwig Hedwig;
var Boeing747 Plane;
var DynamicInterpolationPoint Points[2];
var baseConsole Console;
var int SafeRefCount;
var int TownRefCount;
var float fDefaultRandomDialog;
var float fRandomDialog;
var() float fOverTownMeter;
var() float fOverSheepMeter;
var() float fOverPlaneMeter;
var() float fResetMeter;
var() float HedwigMaxDistance;
var() float HedwigPrepivotDistanceFront;
var() float HedwigPrepivotDistanceUp;
var float fWindViolence;
var Vector vDirection;
var float fTurbulence;
var Vector distanceMinusZ;
var FlyingFordLightning lightningZone;
var ThunderLightning lightning;
var bool blightningStrike;
var Vector strikeDirection;
var Vector tempDistance;
var float fLightningViolence;
var int iLightningLoops;
var float fTimeBetweenchanges;
var CarLocations CarLocation;

function PreBeginPlay ()
{
  local DynamicInterpolationPoint p;
  local int Counter;

  Super.PreBeginPlay();
JL001A:
  foreach AllActors(Class'FlyingCarHarry',PlayerHarry)
  {
    goto JL001A;
  }
  foreach AllActors(Class'MuggleMeterManager',MuggleMeter)
  {
    goto JL002F;
  }
  foreach AllActors(Class'Boeing747',Plane)
  {
    goto JL0044;
  }
  PlayerHarry.ClientMessage("Make sure I get here");
  guide = Spawn(Class'FlyingFordPathGuide',,,Location + Vec(200.0,50.0,0.0),Rotation);
  guide.PathName = PlayerHarry.PathName;
  guide.AirSpeedNormal = PlayerHarry.AirSpeedNormal;
  Log("*************What is the pathname for the car  :  " $ string(PlayerHarry.PathName));
  PlayerHarry.guide = guide;
  Hedwig = Spawn(Class'FlyingFordHedwig',,,Location + Vec(50.0,50.0,-50.0),Rotation);
}

function PostBeginPlay ()
{
  Super.PostBeginPlay();
  InitialState = 'GameIntro';
  CarLocation = 1;
  Hedwig.SetOwner(guide);
  Hedwig.AttachToOwner();
  Hedwig.bTrailerPrePivot = True;
  Hedwig.PrePivot = Vec(HedwigPrepivotDistanceFront,0.0,HedwigPrepivotDistanceUp);
}

function OnTouchEvent (Pawn Subject, Actor Object)
{
  if ( Object.Tag == 'FlyingFordSafe' )
  {
    IncrementSafeCount();
  } else {
    if ( Object.Tag == 'FlyingFordTown' )
    {
      IncrementTownCount();
    } else {
      if ( Object.Tag == 'FlyingFordWind' )
      {
        goto JL00D7;
      }
      if ( Object.Tag == 'FlyingFordWindTrigger' )
      {
        PlayerHarry.ClientMessage("The trigger has been touched");
      } else {
        if ( Object.Tag == 'FlyingFordLightning' )
        {
          lightningZone = FlyingFordLightning(Object);
          GotoState('GameLightning');
        } else {
        }
      }
    }
  }
  if ( SetCarLocation() )
  {
    UpdateHud();
  }
}

function OnUnTouchEvent (Pawn Subject, Actor Object)
{
  if ( Object.Tag == 'FlyingFordSafe' )
  {
    DecrementSafeCount();
  } else {
    if ( Object.Tag == 'FlyingFordTown' )
    {
      DecrementTownCount();
    } else {
      if ( Object.Tag == 'FlyingFordLightning' )
      {
        if ( IsInState('GameLightning') )
        {
          PlayerHarry.ClientMessage("Return to state GamePlay from an UNTouch message  " $ string(GetStateName()));
          GotoState('GamePlay');
        }
      } else {
      }
    }
  }
  if ( SetCarLocation() )
  {
    UpdateHud();
  }
}

function OnHitEvent (Pawn Subject)
{
  PlayerHarry.ClientMessage(string(Subject.Name) $ " hit an obstacle");
}

function OnCutSceneEvent (name CutSceneTag)
{
  PlayerHarry.ClientMessage("CutScene " $ string(CutSceneTag) $ " triggered Director");
}

function OnTriggerEvent (Actor Other, Pawn EventInstigator)
{
  PlayerHarry.ClientMessage(string(Other) $ " triggered Director with " $ string(EventInstigator));
  if ( Other != None )
  {
    PlayerHarry.ClientMessage("We have triggered an airplane");
    GotoState('GameAirplane');
  } else {
  }
}

function Trigger (Actor Other, Pawn EventInstigator)
{
  local CutScene CutScene;
  local CutScript CutScript;

  CutScene = CutScene(Other);
  CutScript = CutScript(Other);
  if ( (CutScene != None) || (CutScript != None) )
  {
    OnCutSceneEvent(CutScene.Tag);
  } else {
    OnTriggerEvent(Other,EventInstigator);
  }
}

function OnPlayerPossessed ()
{
  Super.OnPlayerPossessed();
  Log("Player possessed");
  Console = baseConsole(PlayerHarry.Player.Console);
  TriggerEvent('FlyingFordIntro',self,None);
}

function OnPlayerDying ()
{
  PlayerHarry.ClientMessage("Player dying...");
}

function OnPlayersDeath ()
{
  PlayerHarry.ClientMessage("Player died; restarting game");
  Level.Game.RestartGame();
}

function OnActionKeyPressed ()
{
  PlayerHarry.ClientMessage("Action key pressed");
}

function StartTurbulence (float violence, Vector Direction)
{
  fWindViolence = violence;
  vDirection = Direction;
  GotoState('GameWind');
}

function StartLightning ()
{
  local ThunderLightning tempObject;
  local name nameOfStorm;

  PlayerHarry.ClientMessage("StartLightning has been entered");
  nameOfStorm = lightningZone.stormName;
  foreach AllActors(Class'ThunderLightning',tempObject)
  {
    if ( tempObject.stormName == nameOfStorm )
    {
      lightning = tempObject;
    }
  }
  fLightningViolence = lightningZone.fLightningViolence;
  iLightningLoops = lightningZone.iLightningLoops;
  fTimeBetweenchanges = lightningZone.fTimeBetweenchanges;
}

function IncrementSafeCount ()
{
  SafeRefCount++;
  Log("Safe Count : " $ string(SafeRefCount));
}

function DecrementSafeCount ()
{
  SafeRefCount--;
  if ( SafeRefCount < 0 )
  {
    SafeRefCount = 0;
  }
  Log("Safe Count : " $ string(SafeRefCount));
}

function IncrementTownCount ()
{
  TownRefCount++;
  Log("Town Count : " $ string(TownRefCount));
}

function DecrementTownCount ()
{
  TownRefCount--;
  if ( TownRefCount < 0 )
  {
    TownRefCount = 0;
  }
  Log("Town Count : " $ string(TownRefCount));
}

function bool SetCarLocation ()
{
  local CarLocations currentLocation;

  currentLocation = CarLocation;
  if ( SafeRefCount > 0 )
  {
    CarLocation = 1;
  } else {
    if ( TownRefCount > 0 )
    {
      CarLocation = 2;
    } else {
      CarLocation = 0;
    }
  }
  if ( bool(currentLocation) == bool(CarLocation) )
  {
    return False;
  } else {
    return True;
  }
}

function UpdateHud ()
{
  switch (CarLocation)
  {
    case 1:
    Log("Resetting the MuggleMeter");
}

state GameIntro
{
  function BeginState ()
  {
  }
  
  function OnCutSceneEvent (name CutSceneTag)
  {
    MuggleMeter.BeginDetection();
    GotoState('GamePlay');
  }
  
}

state GamePlay
{
  PlayerHarry.ClientMessage("We are in GamePlay.");
  Hedwig.LoopAnim('Drop');
}

state GameWon
{
}

state GameRestart
{
  OnPlayersDeath();
}

state GameAirplane
{
  function BeginState ()
  {
    Plane.StartTransPath();
  }
  
  function MovePoints ()
  {
    local Vector pos1;
    local Vector pos2;
    local Vector vCarDirection;
    local Vector vUp;
    local Vector vRight;
    local Vector p1Ahead;
    local Vector p1Side;
    local Vector p2Ahead;
    local Vector p2Side;
  
    vCarDirection = PlayerHarry.Rotation;
    vUp = Vec(0.0,0.0,1.0);
    vRight = vCarDirection Cross vUp;
    p1Ahead = PlayerHarry.Location + vCarDirection * byte(300);
    p1Side = PlayerHarry.Location + vRight * byte(200);
    p2Ahead = PlayerHarry.Location + vCarDirection * byte(200);
    p2Side = PlayerHarry.Location + vCarDirection * byte(0);
    Points[0].SetLocation(p1Ahead + p1Side);
    Points[1].SetLocation(p2Ahead + p2Side);
  }
  
  function SetPlaneOnPath ()
  {
    Plane.StartOnPath();
  }
  
}

state GameWind
{
  function BeginState ()
  {
    fTurbulence = 0.0;
    PlayerHarry.LoopAnim('flyingeratic');
    PlayerHarry.ClientMessage("IN the beginning  :  " $ string(PlayerHarry.vCurrentTetherDistance));
  }
  
  function EndState ()
  {
    PlayerHarry.LoopAnim('Flying');
    PlayerHarry.ClientMessage("IN the end  :  " $ string(PlayerHarry.vCurrentTetherDistance));
  }
  
  function float windDirectionConst ()
  {
    local Vector vRight;
    local Vector vGuideDirection;
    local Vector vUp;
  
    vGuideDirection = guide.Rotation;
    vUp = Vec(0.0,0.0,1.0);
    vRight = vGuideDirection Cross vUp;
    if ( vDirection Dot vRight > byte(0) )
    {
      return -1.0;
    } else {
      return 1.0;
    }
  }
  
  function Vector windDirectionVector ()
  {
    local Vector vRight;
    local Vector vGuideDirection;
    local Vector vUp;
    local Vector vLeft;
  
    vGuideDirection = guide.Rotation;
    vUp = Vec(0.0,0.0,1.0);
    vRight = vGuideDirection Cross vUp;
    vLeft =  -vRight;
    if ( vDirection Dot vRight > byte(0) )
    {
      vRight.Z = vDirection.Z;
      return vRight;
    } else {
      vLeft.Z = vDirection.Z;
      return vLeft;
    }
  }
  
  function Tick (float DeltaTime)
  {
    Super.Tick(DeltaTime);
    if ( fTurbulence < VSize(fWindViolence * vDirection) )
    {
      fTurbulence += VSize(fWindViolence * vDirection) * DeltaTime;
      PlayerHarry.vTurbulence += fWindViolence * windDirectionVector() * DeltaTime;
    } else {
      distanceMinusZ = windDirectionVector();
      distanceMinusZ.Z = 0.0;
      PlayerHarry.sideDistance += VSize(fWindViolence * distanceMinusZ) * windDirectionConst();
      PlayerHarry.upDistance += PlayerHarry.vTurbulence.Z;
      PlayerHarry.vTurbulence = Vec(0.0,0.0,0.0);
      GotoState('GamePlay');
    }
  }
  
}

state GameLightning
{
  function BeginState ()
  {
    StartLightning();
  }
  
  function Tick (float DeltaTime)
  {
    Super.Tick(DeltaTime);
    if ( lightning.bLightningActive == True )
    {
      GotoState('StruckByLightning');
    }
  }
  
}

state StruckByLightning
{
  function Tick (float DeltaTime)
  {
    Super.Tick(DeltaTime);
    tempDistance = strikeDirection;
    tempDistance.Z = 0.0;
    PlayerHarry.sideDistance += VSize(fLightningViolence * tempDistance) * sideDirectionConst();
    tempDistance = strikeDirection;
    tempDistance.X = 0.0;
    tempDistance.Y = 0.0;
    PlayerHarry.upDistance += VSize(fLightningViolence * tempDistance) * upDirectionConst();
    PlayerHarry.vTurbulence = Vec(0.0,0.0,0.0);
  }
  
  function float sideDirectionConst ()
  {
    local Vector vRight;
    local Vector vGuideDirection;
    local Vector vUp;
  
    vGuideDirection = guide.Rotation;
    vUp = Vec(0.0,0.0,1.0);
    vRight = vGuideDirection Cross vUp;
    if ( strikeDirection Dot vRight > byte(0) )
    {
      return -1.0;
    } else {
      return 1.0;
    }
  }
  
  function float upDirectionConst ()
  {
    local Vector vGuideDirection;
  
    vGuideDirection = guide.Rotation;
    if ( vGuideDirection Dot strikeDirection > byte(0) )
    {
      return -1.0;
    } else {
      return 1.0;
    }
  }
  
  function Vector OutofControl ()
  {
    local Vector newSideDirection;
    local Vector newUpDirection;
    local Vector vRight;
    local Vector vGuideDirection;
    local Vector vUp;
    local float fRandPercentSide;
    local Vector newVector;
    local float newYaw;
    local float newPitch;
  
    vGuideDirection = guide.Rotation;
    vUp = Vec(0.0,0.0,1.0);
    vRight = vGuideDirection Cross vUp;
    fRandPercentSide = FRand();
    if ( Rand(2) == 0 )
    {
      newSideDirection = vRight * fLightningViolence * fRandPercentSide;
      newYaw = fLightningViolence * fRandPercentSide * byte(500);
    } else {
      newSideDirection =  -vRight * fLightningViolence * fRandPercentSide;
      newYaw =  -fLightningViolence * fRandPercentSide * byte(500);
    }
    if ( Rand(2) == 0 )
    {
      newUpDirection = Vec(0.0,0.0,1.0) * fLightningViolence * (byte(1) - fRandPercentSide);
      if ( fLightningViolence * (byte(1) - fRandPercentSide) * byte(500) < byte(PlayerHarry.PitchLimitUp) )
      {
        newPitch = fLightningViolence * (byte(1) - fRandPercentSide) * byte(500);
      } else {
        newPitch = byte(PlayerHarry.PitchLimitUp);
      }
    } else {
      newUpDirection = Vec(0.0,0.0,-1.0) * fLightningViolence * (byte(1) - fRandPercentSide);
      if ( fLightningViolence * (byte(1) - fRandPercentSide) * byte(500) < byte(PlayerHarry.PitchLimitDown) )
      {
        newPitch =  -fLightningViolence * (byte(1) - fRandPercentSide) * byte(500);
      } else {
        newPitch = byte(PlayerHarry.PitchLimitDown);
      }
    }
    PlayerHarry.fLightningYaw = newYaw;
    PlayerHarry.fLightningPitch = newPitch;
    newVector = newSideDirection + newUpDirection;
    return newVector;
  }
  
  if ( iLightningLoops > 0 )
  {
    strikeDirection = OutofControl();
    Sleep(fTimeBetweenchanges);
    iLightningLoops--;
    goto JL0000;
  }
  PlayerHarry.fLightningYaw = 0.0;
  PlayerHarry.fLightningPitch = 0.0;
  GotoState('GamePlay');
}

defaultproperties
{
    fDefaultRandomDialog=5.00

    fOverTownMeter=5.00

    fOverSheepMeter=2.00

    fOverPlaneMeter=5.00

    fResetMeter=10.00

    HedwigMaxDistance=400.00

    HedwigPrepivotDistanceFront=200.00

    HedwigPrepivotDistanceUp=100.00

    Tag='

}

Det här skickar helt enkelt ett meddelande till debugkonsolen om man vidrör aktören (och för resten av programskriptorna på den här delen av sidan).

FlyingFordHedwig

//================================================================================
// FlyingFordHedwig.
//================================================================================

class FlyingFordHedwig extends HiddenHPawn;

const BOOL_DEBUG_AI= false;
var bool bTouch;
var Director Director;

function PostBeginPlay ()
{
JL0014:
  foreach AllActors(Class'Director',Director)
  {
    goto JL0014;
  }
}

function Touch (Actor Other)
{
  if ( bTouch == False )
  {
    bTouch = True;
    Director.OnTouchEvent(self,Other);
  }
}

function UnTouch (Actor Other)
{
  bTouch = False;
  Director.OnUnTouchEvent(self,Other);
}

function Bump (Actor Other)
{
  if ( False )
  {
    PlayerHarry.ClientMessage("I have been bumped ");
  }
  Touch(Other);
}

defaultproperties
{
    bHidden=False

    bTrailerSameRotation=True

    bTrailerPrePivot=True

    Tag='

    DrawType=2

    Mesh=SkeletalMesh'HPModels.skowlbarnMesh'

    DrawScale=1.20

    CollisionRadius=35.00

    CollisionHeight=32.00

}

FlyingFordLightning

//================================================================================
// FlyingFordLightning.
//================================================================================

class FlyingFordLightning extends HiddenHPawn;

const BOOL_DEBUG_AI= false;
var bool bTouch;
var FlyingFordDirector Director;
var() name stormName;
var() float fLightningViolence;
var() int iLightningLoops;
var() float fTimeBetweenchanges;

function PostBeginPlay ()
{
JL0014:
  foreach AllActors(Class'FlyingFordDirector',Director)
  {
    goto JL0014;
  }
}

function Touch (Actor Other)
{
  if ( Other.IsA('harry') )
  {
    if ( bTouch == False )
    {
      bTouch = True;
      Director.OnTouchEvent(self,Other);
    }
  }
}

function UnTouch (Actor Other)
{
  Super.UnTouch(Other);
  if ( Other.IsA('harry') )
  {
    Director.OnUnTouchEvent(self,Other);
  }
}

function Bump (Actor Other)
{
  if ( False )
  {
    PlayerHarry.ClientMessage("I have been bumped ");
  }
  Touch(Other);
}

defaultproperties
{
    fLightningViolence=5.00

    iLightningLoops=15

    fTimeBetweenchanges=0.20

    Tag='

    CollisionRadius=35.00

    CollisionHeight=32.00

    bCollideActors=True

    bCollideWorld=True

}

FlyingFordPathGuide

Det konstiga är att den här dålda pawnen har en eldkrabbas maska.

//================================================================================
// FlyingFordPathGuide.
//================================================================================

class FlyingFordPathGuide extends HiddenHPawn;

const BOOL_DEBUG_AI= false;
var Director Director;
var name PathName;
var float AirSpeedNormal;

function PostBeginPlay ()
{
JL0014:
  foreach AllActors(Class'Director',Director)
  {
    goto JL0014;
  }
  SetCollision(False,False,False);
}

function Touch (Actor Other)
{
  Super.Touch(Other);
}

function UnTouch (Actor Other)
{
  Super.UnTouch(Other);
}

function Bump (Actor Other)
{
  if ( False )
  {
    PlayerHarry.ClientMessage("I have been bumped ");
  }
  Touch(Other);
}

auto state startFlying
{
  FollowSplinePath(PathName,AirSpeedNormal,0.0,);
}

defaultproperties
{
    Tag='

    DrawType=2

    Mesh=SkeletalMesh'HPModels.skfirecrabMesh'

    CollisionRadius=200.00

    CollisionHeight=50.00

}

FlyingFordSafe

//================================================================================
// FlyingFordSafe.
//================================================================================

class FlyingFordSafe extends HiddenHPawn;

const BOOL_DEBUG_AI= false;
var bool bTouch;
var Director Director;

function PostBeginPlay ()
{
JL0014:
  foreach AllActors(Class'Director',Director)
  {
    goto JL0014;
  }
}

function Touch (Actor Other)
{
  if ( bTouch == False )
  {
    bTouch = True;
    Director.OnTouchEvent(self,Other);
  }
}

function UnTouch (Actor Other)
{
  bTouch = False;
  Director.OnUnTouchEvent(self,Other);
}

function Bump (Actor Other)
{
  if ( False )
  {
    PlayerHarry.ClientMessage("I have been bumped ");
  }
  Touch(Other);
}

defaultproperties
{
    Tag='

    bCollideWhenPlacing=True

    CollisionRadius=35.00

    CollisionHeight=32.00

    bCollideActors=True

    bCollideWorld=True

}

FlyingFordTown

//================================================================================
// FlyingFordTown.
//================================================================================

class FlyingFordTown extends HiddenHPawn;

const BOOL_DEBUG_AI= false;
var bool bTouch;
var Director Director;

function PostBeginPlay ()
{
JL0014:
  foreach AllActors(Class'Director',Director)
  {
    goto JL0014;
  }
}

function Touch (Actor Other)
{
  if ( bTouch == False )
  {
    bTouch = True;
    Director.OnTouchEvent(self,Other);
  }
}

function UnTouch (Actor Other)
{
  bTouch = False;
  Director.OnUnTouchEvent(self,Other);
}

function Bump (Actor Other)
{
  if ( False )
  {
    PlayerHarry.ClientMessage("I have been bumped ");
  }
  Touch(Other);
}

defaultproperties
{
    Tag='

    bCollideWhenPlacing=True

    CollisionRadius=500.00

    CollisionHeight=32.00

    bCollideActors=True

    bCollideWorld=True

}

FlyingFordWind

//================================================================================
// FlyingFordWind.
//================================================================================

class FlyingFordWind extends HiddenHPawn;

const BOOL_DEBUG_AI= false;
var bool bTouch;
var() float violence;
var() float triggerRadius;
var() float triggerHeight;
var FlyingFordDirector Director;
var FlyingFordWindTrigger windTrigger;
var(VisualFX) ParticleFX fxWindParticleEffect;
var(VisualFX) Class<ParticleFX> fxWindParticleEffectClass;

function PostBeginPlay ()
{
  Super.PostBeginPlay();
  foreach AllActors(Class'FlyingFordDirector',Director)
  {
    goto JL001A;
  }
  windTrigger = Spawn(Class'FlyingFordWindTrigger',self,,Location + Vec(0.0,0.0,10.0),Rotation);
  windTrigger.SetCollisionSize(triggerRadius,triggerHeight);
}

function Tick (float DeltaTime)
{
  Super.Tick(DeltaTime);
  if ( fxWindParticleEffect != None )
  {
    fxWindParticleEffect.SetLocation(Location);
  }
}

function Touch (Actor Other)
{
  Super.Touch(Other);
  if ( Other.IsA('harry') )
  {
    if ( bTouch == False )
    {
      bTouch = True;
      Director.OnTouchEvent(self,Other);
      Director.StartTurbulence(violence,Rotation);
    }
  }
}

function UnTouch (Actor Other)
{
  Super.UnTouch(Other);
  if ( Other.IsA('harry') )
  {
    Director.OnUnTouchEvent(self,Other);
  }
}

function Bump (Actor Other)
{
  if ( False )
  {
    PlayerHarry.ClientMessage("I have been bumped ");
  }
  Touch(Other);
}

function StartWind ()
{
  fxWindParticleEffect = Spawn(fxWindParticleEffectClass,,,Location);
}

function StopWind ()
{
  if ( fxWindParticleEffect != None )
  {
    fxWindParticleEffect.Shutdown();
    fxWindParticleEffect.Destroy();
    fxWindParticleEffect = None;
  }
}

defaultproperties
{
    violence=100.00

    triggerRadius=800.00

    triggerHeight=300.00

    fxWindParticleEffectClass=Class'HPParticle.CloudWind'

    Tag='

    CollisionRadius=200.00

    CollisionWidth=55.00

    CollisionHeight=150.00

    bCollideActors=True

    bCollideWorld=True

}

FlyingFordWindTrigger

//================================================================================
// FlyingFordWindTrigger.
//================================================================================

class FlyingFordWindTrigger extends HiddenHPawn;

const BOOL_DEBUG_AI= false;
var bool bTouch;
var FlyingFordDirector Director;

function PostBeginPlay ()
{
  Super.PostBeginPlay();
  foreach AllActors(Class'FlyingFordDirector',Director)
  {
    goto JL001A;
  }
}

function Touch (Actor Other)
{
  local FlyingFordWind Wind;

  Super.Touch(Other);
  if ( Other.IsA('harry') )
  {
    if ( bTouch == False )
    {
      bTouch = True;
      Director.OnTouchEvent(self,Other);
      Wind = FlyingFordWind(Owner);
      if ( Wind != None )
      {
        Wind.StartWind();
      }
    }
  }
}

function UnTouch (Actor Other)
{
  local FlyingFordWind Wind;

  Super.UnTouch(Other);
  if ( Other.IsA('harry') )
  {
    bTouch = False;
    Director.OnUnTouchEvent(self,Other);
    Wind = FlyingFordWind(Owner);
    if ( Wind != None )
    {
      Wind.StopWind();
    }
  }
}

function Bump (Actor Other)
{
  if ( False )
  {
    PlayerHarry.ClientMessage("I have been bumped ");
  }
  Touch(Other);
}

auto state triggerBegin
{
}

defaultproperties
{
    bHidden=False

    Tag='

    CollisionRadius=0.00

    CollisionHeight=400.00

    bCollideActors=True

    bCollideWorld=True

}

Managers

MagicStrengthManager

Precis som i duellerna kunde Harry bygga upp kraften i hans besvärjelser och en mätare skulle visas på skärmen.

//================================================================================
// MagicStrengthManager.
//================================================================================

class MagicStrengthManager extends HudItemManager;

var float fRemainingStrength;
var Texture textureSlider;
var Texture textureBarEmpty;
var Texture textureBarFull;
var bool bHarryAvailable;
var float fTimeSinceLastRecover;
var harry PlayerHarry;
var() bool bDisplayAtLevelLoad;
const fRECOVER_RATE= 0.1;
const fTOTAL_STRENGTH= 120;
const fSLIDER_POINTER_YOFFSET= 66;
const fSLIDER_W= 128;
const fBAR_Y= 25.0;
const fBAR_X= 25.0;
const fBAR_H= 128.0;
const fBAR_W= 36.0;
const strBAR_FULL= "HP_Menu.Hud.MagicStrengthFull";
const strBAR_EMPTY= "HP_Menu.Hud.MagicStrengthEmpty";
const strSLIDER= "HP_Menu.Hud.MagicStrengthSlider";

event Tick (float fDelta)
{
  if (  !bHarryAvailable )
  {
    if ( Level.PlayerHarryActor != None )
    {
      PlayerHarry = harry(Level.PlayerHarryActor);
      bHarryAvailable = True;
      if ( bDisplayAtLevelLoad )
      {
        StartMagicStrength();
      }
    }
  }
}

event PostBeginPlay ()
{
  Super.PostBeginPlay();
  textureSlider = Texture(DynamicLoadObject("HP_Menu.Hud.MagicStrengthSlider",Class'Texture'));
  textureBarEmpty = Texture(DynamicLoadObject("HP_Menu.Hud.MagicStrengthEmpty",Class'Texture'));
  textureBarFull = Texture(DynamicLoadObject("HP_Menu.Hud.MagicStrengthFull",Class'Texture'));
}

function StartMagicStrength ()
{
  HPHud(PlayerHarry.myHUD).RegisterMagicStrength(self);
  GotoState('DisplayStrength');
}

function EndMagicStrength ()
{
  HPHud(PlayerHarry.myHUD).RegisterMagicStrength(None);
  GotoState('Idle');
}

function UseUpStrength (int nPercent)
{
  fRemainingStrength -= byte(120) * byte(nPercent) / 100.0;
  PlayerHarry.ClientMessage("remaining strength " $ string(fRemainingStrength));
  if ( fRemainingStrength < byte(0) )
  {
    fRemainingStrength = 0.0;
  }
}

auto state Idle
{
}

state DisplayStrength
{
  function Tick (float fDelta)
  {
    local float fPercentFull;
  
    if ( baseHUD(PlayerHarry.myHUD).bCutSceneMode == True )
    {
      return;
    }
    if ( fRemainingStrength <= byte(0) )
    {
      TriggerEvent(Event,None,None);
      EndMagicStrength();
    }
    fTimeSinceLastRecover += fDelta;
    if ( fTimeSinceLastRecover >= 0.1 )
    {
      fTimeSinceLastRecover = 0.0;
      fRemainingStrength += byte(1) + fTimeSinceLastRecover - 0.1;
      if ( fRemainingStrength > byte(120) )
      {
        fRemainingStrength = 120.0;
      }
    }
  }
  
  function RenderHudItemManager (Canvas Canvas, bool bMenuMode, bool bFullCutMode, bool bHalfCutMode)
  {
    local float fScaleFactor;
    local float fBarScaledX;
    local float fBarScaledY;
    local float fSliderX;
    local float fSliderY;
    local float fBarEmptyH;
  
    fScaleFactor = GetScaleFactor(Canvas);
    fBarScaledX = 25.0 * fScaleFactor;
    fBarScaledY = 25.0 * fScaleFactor;
    Canvas.SetPos(fBarScaledX,fBarScaledY);
    Canvas.DrawIcon(textureBarFull,fScaleFactor);
    fBarEmptyH = 120.0 - fRemainingStrength;
    Canvas.SetPos(fBarScaledX,fBarScaledY);
    Canvas.DrawTile(textureBarEmpty,byte(textureBarEmpty.USize) * fScaleFactor,fBarEmptyH * fScaleFactor,0.0,0.0,byte(textureBarEmpty.USize),fBarEmptyH);
    fSliderX = fBarScaledX - (byte(128) - 36.0) / byte(2) * fScaleFactor;
    fSliderY = (25.0 + fBarEmptyH - byte(66)) * fScaleFactor;
    Canvas.SetPos(fSliderX,fSliderY);
    Canvas.DrawIcon(textureSlider,fScaleFactor);
  }
  
  event BeginState ()
  {
    fRemainingStrength = 120.0;
  }
  
}

defaultproperties
{
    bHidden=True

    DrawType=1

}