Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Vaulting (Using a placeable class)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Vaulting (Using a placeable class)

    Hello, I thought it would be cool to show off some of the vaulting code I did in my game Zombies : http://forums.epicgames.com/showthread.php?t=772977

    This is part of my source code and is subject to change. Remember, I am not a hardened programmer so if some of the things look pointless to a better programmer or there may be a better way then. There prolly is.

    Video : http://www.youtube.com/watch?v=p3hGYA-Ev24


    This is my first official tutorial so if you spot errors or mistakes please let me know.

    I just hope someone appreciates this

    So lets get started.

    This requires the character to have a proper AnimTree and AnimSet(Containing FullBodyAnimSlot & TopHalfAnimSlot), if you hope to have the animations to work. Also prevent my script from giving errors.

    Assuming you have a TrueFPS style pawn.

    Make sure the pawn has a socket near the head called "Eyes"

    Even if you dont have a true FPS style game, this will activate the camera in the world and make it look true FPS, if you have the proper 3rd person animations.


    Enginebuild = March


    Pawn.uc

    Code:
    class MainPawn extends UTPawn;
    In Your PlayerController.uc

    Code:
    var int ClimbHeight;
    
    var name VaultStartSocketName;
    var name VaultEndSocketName;
    var MainPawn P;
    var bool bVaulted;
    
    exec function Use()
    {
        local Actor TraceHit;
        local Vector StartLoc, EndLoc;
    
        local Vector HitNormal, HitLocation;
    
    	if( Role < Role_Authority )
    	{
    		PerformedUseAction();
    	}
    	ServerUse();
    
     // Trace from socket locations
       Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultStartSocketName, StartLoc);
       Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultEndSocketName, EndLoc);
    
    	TraceHit = Trace(HitLocation, HitNormal, StartLoc, EndLoc,true,,,
    				TRACEFLAG_Bullet | TRACEFLAG_PhysicsVolumes |
    				TRACEFLAG_SkipMovers | TRACEFLAG_Blocking);
            
            DrawDebugLine(StartLoc, EndLoc, 255, 250, 100, true);
    
          if(TraceHit.IsA('VaultActor'))
          {
            GotoState('Vaulting');
          }
    }
    
    
    
    ///*********** Vault STATE********************************************
    //Contains stop functions and special case vaults.
    //handles animations and movement
    
    state Vaulting
    {
    
     function Check()
     {
       local VaultActor VA;
       local Actor TraceHit;
       local Vector StartLoc, EndLoc;
    
       local Vector HitNormal, HitLocation;
    
    
    
       foreach VisibleCollidingActors (class'VaultActor', VA,40,Pawn.Location)
       {
    
       // Trace from pawn sockets.
            Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultStartSocketName, StartLoc);
    	Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultEndSocketName, EndLoc);
    
    	TraceHit = Trace(HitLocation, HitNormal, StartLoc, EndLoc, true,,,
    				TRACEFLAG_Bullet | TRACEFLAG_PhysicsVolumes |
    				TRACEFLAG_SkipMovers | TRACEFLAG_Blocking);
            DrawDebugLine(StartLoc, EndLoc, 255, 250, 0, true);
    
    
    
          if(TraceHit.IsA('VaultActor'))
          {
               VA.Activate();
    
               if(VA.Type == Tall)
                {
                  bVaulted = true;
                  Pawn.DoJump(bUpdating);
                  Pawn.Velocity.Z = 700;
                  P = MainPawn(Pawn);
                  P.FullBodyAnimSlot.PlayCustomAnim('VaultTop', 1.0, 0.2, 0.2, FALSE, TRUE);
                  SetTimer(0.4, false, 'Grounded');
                }
               else if(VA.Type == Medium )
                {
                  bVaulted = true;
                  Pawn.DoJump(bUpdating);
                  Pawn.Velocity.Z = VA.Height;
                  P = MainPawn(Pawn);
                  P.FullBodyAnimSlot.PlayCustomAnim('VaultMediumSmall', 1.0, 0.2, 0.2, FALSE, TRUE);
                  SetTimer(0.3, false, 'Grounded');
                }
    
                else if(VA.Type == Small)
                {
                  bVaulted = true;
                  Pawn.DoJump(bUpdating);
                  Pawn.Velocity.Z = VA.Height;
                  P = MainPawn(Pawn);
                  P.FullBodyAnimSlot.PlayCustomAnim('VaultSmall', 1.0, 0.2, 0.2, FALSE, TRUE);
                  SetTimer(0.3, false, 'Grounded');
                }
    
          }
          else
          {
            PushState('PlayerWalking');
          }
    
       }
    
     }
    
     function Grounded()
     {
        local VaultActor VA;
    
        //Set forward 'push' velocity depending on the direction of the wall. determined by level designer.
       foreach VisibleCollidingActors (class'VaultActor', VA, 90, Pawn.Location)
       {
         if(VA.Direction == Left)
         {
           Pawn.Velocity.Y = VA.PushDistance;
         }
         else if(VA.Direction == Right)
         {
           Pawn.Velocity.Y = - VA.PushDistance;
         }
         else if(VA.Direction == Forward)
         {
           Pawn.Velocity.X = VA.PushDistance;
         }
         else if(VA.Direction == Back)
         {
           Pawn.Velocity.X = - VA.PushDistance;
         }
         PushState('PlayerWalking');
       }
    
       bVaulted = false;
     }
    
    
      Begin:
      
      Check();
    
    }
    
    defaultproperties
    {
           ClimbHeight = 0
           bVaulted = false
    
           VaultStartSocketName = VaultStart
           VaultEndSocketName =   VaultEnd
    }
    You will need to create a socket in you character pawn named

    Start = VaultStart
    End = VaultEnd

    Animations :
    VaultTop
    VaultMediumSmall
    VaultSmall

    [shot]http://i1188.photobucket.com/albums/z411/TheAgent007/Sockets.jpg[/shot]


    VaultActor.uc

    Code:
    class VaultActor extends Actor placeable;
    
    var() const editconst DynamicLightEnvironmentComponent LightEnvironment;
    
    var() int Height;
    var() int PushDistance;
    var() bool bAttachCamera;
    
    var() name CameraEvent;
    //Vault type
    var() enum EType
    {
            Tall,
            Medium,
            Small
    }Type;
    
    //Vault direction
    var() enum EDirection
    {
    	Left,
    	Right,
    	Forward,
    	Back
    
    }Direction;
    
    simulated function Activate()
    {
      if(bAttachCamera == true)
      {
         TriggerRemoteKismetEvent(CameraEvent);
      }   // Activate Specified Remote event within the level. For Level Designers.
    }
    
    
    
    //Query all remote events in level.
    function TriggerRemoteKismetEvent( name EventName )
    {
        local array<SequenceObject> AllSeqEvents;
        local Sequence GameSeq;
        local int i;
    
        GameSeq = WorldInfo.GetGameSequence();
        if (GameSeq != None)
        {
            // find any Level Reset events that exist
            GameSeq.FindSeqObjectsByClass(class'SeqEvent_RemoteEvent', true, AllSeqEvents);
    
            // activate them
            for (i = 0; i < AllSeqEvents.Length; i++)
            {
    	    if(SeqEvent_RemoteEvent(AllSeqEvents[i]).EventName == EventName)
    	    SeqEvent_RemoteEvent(AllSeqEvents[i]).CheckActivate(WorldInfo, None);
    	}
        }
    }
    
    defaultproperties
    {
      Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
            bEnabled=TRUE
        End Object
    
        LightEnvironment=MyLightEnvironment
        Components.Add(MyLightEnvironment)
    
    
        Begin Object class=StaticMeshComponent Name=BaseMesh
            StaticMesh=StaticMesh'LT_Buildings2.SM.Mesh.S_LT_Buildings_SM_BunkerWallA_STR'
            LightEnvironment=MyLightEnvironment
            CollideActors=true
    
        End Object
        Components.Add(BaseMesh)
    
        Begin Object Class=SpriteComponent Name=Sprite
    		Sprite=Texture2D'EditorResources.S_Actor'
    		HiddenGame=True
    		AlwaysLoadOnClient=False
    		AlwaysLoadOnServer=False
    	End Object
    	Components.Add(Sprite)
    	CollisionComponent=BaseMesh
    	bCollideActors=true
            bBlockActors=true
    	
    	Height = 750
            PushDistance = 100
    }
    VaultActorSmall.uc

    Code:
    class VaultActorSmall extends VaultActor placeable;
    
    //Vault direction
    var() enum SDirection
    {
    	Left,
    	Right,
    	Forward,
    	Back
    
    }DirectionSmall;
    
    defaultproperties
    {
    
    }
    Place the actors in the level :

    [shot]http://i1188.photobucket.com/albums/z411/TheAgent007/actorsplaced.jpg[/shot]


    To have the camera activate in game create a kismet sequence like the image below. Make sure you added a camera actor anywhere in the level and add that object as the image below;

    [shot]http://i1188.photobucket.com/albums/z411/TheAgent007/Kismet-1.jpg[/shot]

    Make sure you set the Kismet event name to something, and that it corresponds with the name given in the RemoteEvent name field in Kismet :



    These are the values that must be set in the VaultActor Properties : (Note these are what works for me)

    You can set it to Left, Right, Front, Back, so that you can have the player vault in any direction you want.

    Note : You can only vault the actor in the direction you set it. So if you set FRONT. You can only vault it properly when in front of the actor. If you are behind you will appear to vault backwards. I will have it so it doesn't matter. However, for now this is how I have it.

    [shot]http://i1188.photobucket.com/albums/z411/TheAgent007/Properties.jpg[/shot]

  • #2
    sexy stuff man

    Comment


    • #3
      Thanks Dn2, hopefully someone else can also find this useful : )

      Comment


      • #4
        someone else just did

        thanks for this.

        Comment


        • #5
          Nice code.Tnx for sharing it.

          Comment


          • #6
            That is damn cool.

            Comment


            • #7
              Really neat!

              Comment


              • #8
                This doesn't work because you define the Use() function when it is already defined elsewhere. I tried using your version and commenting the other one out, but this just showers me in more errors. How do I go about fixing this?

                Comment


                • #9
                  Can i see your code?

                  the Use function is being overridden. I'm simply adding some extra calls so i wouldn't have to create a new use function. I'm using what is there for convenience.

                  Comment


                  • #10
                    Hi TheAgent.

                    I have some errors, please help.

                    Errors:

                    Code:
                    Code:
                    class SPawn extends UTPawn;
                    	
                    var int KillStreak;
                    var SoundCue LevelStart;
                    var int ClimbHeight;
                    
                    var name VaultStartSocketName;
                    var name VaultEndSocketName;
                    
                    var bool bVaulted;
                    
                    exec function Use()
                    {
                        local Actor TraceHit;
                        local Vector StartLoc, EndLoc;
                    
                        local Vector HitNormal, HitLocation;
                    
                    	if( Role < Role_Authority )
                    	{
                    		PerformedUseAction();
                    	}
                    	ServerUse();
                    
                     // Trace from socket locations
                       Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultStartSocketName, StartLoc);
                       Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultEndSocketName, EndLoc);
                    
                    	TraceHit = Trace(HitLocation, HitNormal, StartLoc, EndLoc,true,,,
                    				TRACEFLAG_Bullet | TRACEFLAG_PhysicsVolumes |
                    				TRACEFLAG_SkipMovers | TRACEFLAG_Blocking);
                            
                            DrawDebugLine(StartLoc, EndLoc, 255, 250, 100, true);
                    
                          if(TraceHit.IsA('VaultActor'))
                          {
                            GotoState('Vaulting');
                          }
                    }
                    
                    
                    
                    ///*********** Vault STATE********************************************
                    //Contains stop functions and special case vaults.
                    //handles animations and movement
                    
                    state Vaulting
                    {
                    
                     function Check()
                     {
                       local VaultActor VA;
                       local Actor TraceHit;
                       local Vector StartLoc, EndLoc;
                    
                       local Vector HitNormal, HitLocation;
                    
                    
                    
                       foreach VisibleCollidingActors (class'VaultActor', VA,40,Pawn.Location)
                       {
                    
                       // Trace from pawn sockets.
                            Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultStartSocketName, StartLoc);
                    	Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultEndSocketName, EndLoc);
                    
                    	TraceHit = Trace(HitLocation, HitNormal, StartLoc, EndLoc, true,,,
                    				TRACEFLAG_Bullet | TRACEFLAG_PhysicsVolumes |
                    				TRACEFLAG_SkipMovers | TRACEFLAG_Blocking);
                            DrawDebugLine(StartLoc, EndLoc, 255, 250, 0, true);
                    
                    
                    
                          if(TraceHit.IsA('VaultActor'))
                          {
                               VA.Activate();
                    
                               if(VA.Type == Tall)
                                {
                                  bVaulted = true;
                                  Pawn.DoJump(bUpdating);
                                  Pawn.Velocity.Z = 700;
                                  P = MainPawn(Pawn);
                                  P.FullBodyAnimSlot.PlayCustomAnim('VaultTop', 1.0, 0.2, 0.2, FALSE, TRUE);
                                  SetTimer(0.4, false, 'Grounded');
                                }
                               else if(VA.Type == Medium )
                                {
                                  bVaulted = true;
                                  Pawn.DoJump(bUpdating);
                                  Pawn.Velocity.Z = VA.Height;
                                  P = MainPawn(Pawn);
                                  P.FullBodyAnimSlot.PlayCustomAnim('VaultMediumSmall', 1.0, 0.2, 0.2, FALSE, TRUE);
                                  SetTimer(0.3, false, 'Grounded');
                                }
                    
                                else if(VA.Type == Small)
                                {
                                  bVaulted = true;
                                  Pawn.DoJump(bUpdating);
                                  Pawn.Velocity.Z = VA.Height;
                                  P = MainPawn(Pawn);
                                  P.FullBodyAnimSlot.PlayCustomAnim('VaultSmall', 1.0, 0.2, 0.2, FALSE, TRUE);
                                  SetTimer(0.3, false, 'Grounded');
                                }
                    
                          }
                          else
                          {
                            PushState('PlayerWalking');
                          }
                    
                       }
                    
                     }
                    
                     function Grounded()
                     {
                        local VaultActor VA;
                    
                        //Set forward 'push' velocity depending on the direction of the wall. determined by level designer.
                       foreach VisibleCollidingActors (class'VaultActor', VA, 90, Pawn.Location)
                       {
                         if(VA.Direction == Left)
                         {
                           Pawn.Velocity.Y = VA.PushDistance;
                         }
                         else if(VA.Direction == Right)
                         {
                           Pawn.Velocity.Y = - VA.PushDistance;
                         }
                         else if(VA.Direction == Forward)
                         {
                           Pawn.Velocity.X = VA.PushDistance;
                         }
                         else if(VA.Direction == Back)
                         {
                           Pawn.Velocity.X = - VA.PushDistance;
                         }
                         PushState('PlayerWalking');
                       }
                    
                       bVaulted = false;
                     }
                    
                    
                      Begin:
                      
                      Check();
                    
                    }
                    
                    function SetWalking(bool walking)
                    {
                        super(Pawn).SetWalking(walking);
                    }
                    
                    function PostBeginPlay()
                    {
                    	PlaySound(LevelStart);
                    	super.PostBeginPlay();
                    }
                    
                    function bool Died(Controller Killer, class<DamageType> damageType, vector HitLocation)
                    {
                    	if (Super.Died(Killer, DamageType, HitLocation))
                    	{
                    		StartFallImpactTime = WorldInfo.TimeSeconds;
                    		bCanPlayFallingImpacts=true;
                    		if(ArmsMesh[0] != none)
                    		{
                    			ArmsMesh[0].SetHidden(true);
                    		}
                    		if(ArmsMesh[1] != none)
                    		{
                    			ArmsMesh[1].SetHidden(true);
                    		}
                    		SetPawnAmbientSound(None);
                    		SetWeaponAmbientSound(None);
                    		KillStreak = 0; //Set Our killstreak to 0!
                    		SPawn(Playercontroller(Killer).Pawn).GetKill();
                    		return true;
                    	}
                    	return false;
                    }
                    
                    function GetKill()
                    {
                    	 KillStreak++;
                    	 if (KillStreak == 3)
                    	 {
                    		WorldInfo.Game.Broadcast(self,"Radar available!");
                    		//Then some other stuff...
                    	 }
                    }
                    
                    defaultproperties
                    {
                    	 ClimbHeight = 0
                         bVaulted = false
                    
                         VaultStartSocketName = VaultStart
                         VaultEndSocketName =   VaultEnd
                    
                    	KillStreak = 0;
                    	LevelStart = "A_interface.menu.UT3MenuStartGameCue"
                    	
                    	Begin Object Name=WPawnSkeletalMeshComponent
                    		bOwnerNoSee=false
                    	End Object
                    	Name="Default__SPawn"
                    
                    	WeaponAmbientSound=AmbientSoundComponent2
                    	Components.Add(AmbientSoundComponent2)
                    
                    	ViewPitchMin=-18000
                    	ViewPitchMax=18000
                    
                    	WalkingPct=+0.4
                    	CrouchedPct=+0.4
                    	BaseEyeHeight=38.0
                    	EyeHeight=38.0
                    	GroundSpeed=200.0
                    	AirSpeed=200.0
                    	WaterSpeed=220.0
                    	DodgeSpeed=600.0
                    	DodgeSpeedZ=295.0
                    	AccelRate=2048.0
                    	JumpZ=322.0
                    	CrouchHeight=29.0
                    	CrouchRadius=21.0
                    	WalkableFloorZ=0.78
                    
                    	AlwaysRelevantDistanceSquared=+1960000.0
                    	InventoryManagerClass=class'UTInventoryManager'
                    
                    	MeleeRange=+20.0
                    	bMuffledHearing=true
                    
                    	Buoyancy=+000.99000000
                    	UnderWaterTime=+00020.000000
                    	bCanStrafe=False
                    	bCanSwim=true
                    	RotationRate=(Pitch=20000,Yaw=20000,Roll=20000)
                    	MaxLeanRoll=2048
                    	AirControl=+0
                    	DefaultAirControl=+0
                    	bCanCrouch=true
                    	bCanClimbLadders=True
                    	bCanPickupInventory=True
                    	bCanDoubleJump=false
                    	SightRadius=+12000.0
                    
                    	MaxMultiJump=0
                    	MultiJumpRemaining=1
                    	MultiJumpBoost=-45.0
                    
                    	SoundGroupClass=class'UTGame.UTPawnSoundGroup'
                    
                    	TransInEffects(0)=class'UTEmit_TransLocateOutRed'
                    	TransInEffects(1)=class'UTEmit_TransLocateOut'
                    
                    	MaxStepHeight=26.0
                    	MaxJumpHeight=26.0
                    	MaxDoubleJumpHeight=87.0
                    	DoubleJumpEyeHeight=43.0
                    
                    	HeadRadius=+9.0
                    	HeadHeight=5.0
                    	HeadScale=+1.0
                    	HeadOffset=32
                    
                    	SpawnProtectionColor=(R=40,G=40)
                    	TranslocateColor[0]=(R=20)
                    	TranslocateColor[1]=(B=20)
                    	DamageParameterName=DamageOverlay
                    	SaturationParameterName=Char_DistSatRangeMultiplier
                    
                    	TeamBeaconMaxDist=3000.f
                    	TeamBeaconPlayerInfoMaxDist=3000.f
                    	RagdollLifespan=18.0
                    
                    	bPhysRigidBodyOutOfWorldCheck=TRUE
                    	bRunPhysicsWithNoController=true
                    
                    	CurrentCameraScale=1.0
                    	CameraScale=9.0
                    	CameraScaleMin=3.0
                    	CameraScaleMax=40.0
                    
                    	LeftFootControlName=LeftFootControl
                    	RightFootControlName=RightFootControl
                    	bEnableFootPlacement=true
                    	MaxFootPlacementDistSquared=56250000.0 // 7500 squared
                    
                    	SlopeBoostFriction=0.2
                    	bStopOnDoubleLanding=true
                    	DoubleJumpThreshold=160.0
                    	FireRateMultiplier=1.0
                    
                    	ArmorHitSound=SoundCue'A_Gameplay.Gameplay.A_Gameplay_ArmorHitCue'
                    	SpawnSound=SoundCue'A_Gameplay.A_Gameplay_PlayerSpawn01Cue'
                    	TeleportSound=SoundCue'A_Weapon_Translocator.Translocator.A_Weapon_Translocator_Teleport_Cue'
                    
                    	MaxFallSpeed=+1250.0
                    	AIMaxFallSpeedFactor=1.1 // so bots will accept a little falling damage for shorter routes
                    	LastPainSound=-1000.0
                    
                    	FeignDeathBodyAtRestSpeed=12.0
                    	bReplicateRigidBodyLocation=true
                    
                    	MinHoverboardInterval=0.7
                    	HoverboardClass=class'UTVehicle_Hoverboard'
                    
                    	FeignDeathPhysicsBlendOutSpeed=2.0
                    	TakeHitPhysicsBlendOutSpeed=0.5
                    
                    	TorsoBoneName=b_Spine2
                    	FallImpactSound=SoundCue'A_Character_BodyImpacts.BodyImpacts.A_Character_BodyImpact_BodyFall_Cue'
                    	FallSpeedThreshold=125.0
                    
                    	SuperHealthMax=100
                    
                    	// moving here for now until we can fix up the code to have it pass in the armor object
                    	ShieldBeltMaterialInstance=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Overlay'
                    	ShieldBeltTeamMaterialInstances(0)=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Red'
                    	ShieldBeltTeamMaterialInstances(1)=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Blue'
                    	ShieldBeltTeamMaterialInstances(2)=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Red'
                    	ShieldBeltTeamMaterialInstances(3)=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Blue'
                    
                    	HeroCameraPitch=6000
                    	HeroCameraScale=6.0
                    
                    	//@TEXTURECHANGEFIXME - Needs actual UV's for the Player Icon
                    	IconCoords=(U=657,V=129,UL=68,VL=58)
                    	MapSize=1.0
                    
                    	// default bone names
                    	WeaponSocket=WeaponPoint
                    	WeaponSocket2=DualWeaponPoint
                    	HeadBone=b_Head
                    	PawnEffectSockets[0]=L_JB
                    	PawnEffectSockets[1]=R_JB
                    
                    
                    	MinTimeBetweenEmotes=1.0
                    
                    	DeathHipLinSpring=10000.0
                    	DeathHipLinDamp=500.0
                    	DeathHipAngSpring=10000.0
                    	DeathHipAngDamp=500.0
                    
                    	bWeaponAttachmentVisible=true
                    
                    	TransCameraAnim[0]=CameraAnim'Envy_Effects.Camera_Shakes.C_Res_IN_Red'
                    	TransCameraAnim[1]=CameraAnim'Envy_Effects.Camera_Shakes.C_Res_IN_Blue'
                    	TransCameraAnim[2]=CameraAnim'Envy_Effects.Camera_Shakes.C_Res_IN'
                    
                    	MaxFootstepDistSq=100000.0 //Org. 9000000.0
                    	MaxJumpSoundDistSq=16000000.0
                    
                    	SwimmingZOffset=-30.0
                    	SwimmingZOffsetSpeed=45.0
                    
                    	TauntNames(0)=TauntA
                    	TauntNames(1)=TauntB
                    	TauntNames(2)=TauntC
                    	TauntNames(3)=TauntD
                    	TauntNames(4)=TauntE
                    	TauntNames(5)=TauntF
                    
                    	Begin Object Class=ForceFeedbackWaveform Name=ForceFeedbackWaveformFall
                    		Samples(0)=(LeftAmplitude=50,RightAmplitude=40,LeftFunction=WF_Sin90to180,RightFunction=WF_Sin90to180,Duration=0.200)
                    	End Object
                    	FallingDamageWaveForm=ForceFeedbackWaveformFall
                    
                    	CamOffset=(X=4.0,Y=16.0,Z=-13.0)
                    }

                    Comment


                    • #11
                      people?

                      is this a solo project and if so how long have you been working on it? Also, i really love this thing you set up with the vaulting although i have been looking at the other videos you have uploaded and they are sweet!

                      Comment


                      • #12
                        this tutorial is cool,
                        Im kinda confused/stuck, does these lines of code go in its own classes etc or does it get added to C:\UDK\UDK-2010-12\Development\Src\Engine, and it gets intergreated with the pawn/playercontroller.uc files and add the vault ones in as well???

                        HELP

                        Comment


                        • #13
                          Originally posted by Miguel Petersen View Post
                          Hi TheAgent.

                          I have some errors, please help.

                          Errors:

                          Code:
                          Code:
                          class SPawn extends UTPawn;
                          	
                          var int KillStreak;
                          var SoundCue LevelStart;
                          var int ClimbHeight;
                          
                          var name VaultStartSocketName;
                          var name VaultEndSocketName;
                          
                          var bool bVaulted;
                          
                          exec function Use()
                          {
                              local Actor TraceHit;
                              local Vector StartLoc, EndLoc;
                          
                              local Vector HitNormal, HitLocation;
                          
                          	if( Role < Role_Authority )
                          	{
                          		PerformedUseAction();
                          	}
                          	ServerUse();
                          
                           // Trace from socket locations
                             Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultStartSocketName, StartLoc);
                             Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultEndSocketName, EndLoc);
                          
                          	TraceHit = Trace(HitLocation, HitNormal, StartLoc, EndLoc,true,,,
                          				TRACEFLAG_Bullet | TRACEFLAG_PhysicsVolumes |
                          				TRACEFLAG_SkipMovers | TRACEFLAG_Blocking);
                                  
                                  DrawDebugLine(StartLoc, EndLoc, 255, 250, 100, true);
                          
                                if(TraceHit.IsA('VaultActor'))
                                {
                                  GotoState('Vaulting');
                                }
                          }
                          
                          
                          
                          ///*********** Vault STATE********************************************
                          //Contains stop functions and special case vaults.
                          //handles animations and movement
                          
                          state Vaulting
                          {
                          
                           function Check()
                           {
                             local VaultActor VA;
                             local Actor TraceHit;
                             local Vector StartLoc, EndLoc;
                          
                             local Vector HitNormal, HitLocation;
                          
                          
                          
                             foreach VisibleCollidingActors (class'VaultActor', VA,40,Pawn.Location)
                             {
                          
                             // Trace from pawn sockets.
                                  Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultStartSocketName, StartLoc);
                          	Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultEndSocketName, EndLoc);
                          
                          	TraceHit = Trace(HitLocation, HitNormal, StartLoc, EndLoc, true,,,
                          				TRACEFLAG_Bullet | TRACEFLAG_PhysicsVolumes |
                          				TRACEFLAG_SkipMovers | TRACEFLAG_Blocking);
                                  DrawDebugLine(StartLoc, EndLoc, 255, 250, 0, true);
                          
                          
                          
                                if(TraceHit.IsA('VaultActor'))
                                {
                                     VA.Activate();
                          
                                     if(VA.Type == Tall)
                                      {
                                        bVaulted = true;
                                        Pawn.DoJump(bUpdating);
                                        Pawn.Velocity.Z = 700;
                                        P = MainPawn(Pawn);
                                        P.FullBodyAnimSlot.PlayCustomAnim('VaultTop', 1.0, 0.2, 0.2, FALSE, TRUE);
                                        SetTimer(0.4, false, 'Grounded');
                                      }
                                     else if(VA.Type == Medium )
                                      {
                                        bVaulted = true;
                                        Pawn.DoJump(bUpdating);
                                        Pawn.Velocity.Z = VA.Height;
                                        P = MainPawn(Pawn);
                                        P.FullBodyAnimSlot.PlayCustomAnim('VaultMediumSmall', 1.0, 0.2, 0.2, FALSE, TRUE);
                                        SetTimer(0.3, false, 'Grounded');
                                      }
                          
                                      else if(VA.Type == Small)
                                      {
                                        bVaulted = true;
                                        Pawn.DoJump(bUpdating);
                                        Pawn.Velocity.Z = VA.Height;
                                        P = MainPawn(Pawn);
                                        P.FullBodyAnimSlot.PlayCustomAnim('VaultSmall', 1.0, 0.2, 0.2, FALSE, TRUE);
                                        SetTimer(0.3, false, 'Grounded');
                                      }
                          
                                }
                                else
                                {
                                  PushState('PlayerWalking');
                                }
                          
                             }
                          
                           }
                          
                           function Grounded()
                           {
                              local VaultActor VA;
                          
                              //Set forward 'push' velocity depending on the direction of the wall. determined by level designer.
                             foreach VisibleCollidingActors (class'VaultActor', VA, 90, Pawn.Location)
                             {
                               if(VA.Direction == Left)
                               {
                                 Pawn.Velocity.Y = VA.PushDistance;
                               }
                               else if(VA.Direction == Right)
                               {
                                 Pawn.Velocity.Y = - VA.PushDistance;
                               }
                               else if(VA.Direction == Forward)
                               {
                                 Pawn.Velocity.X = VA.PushDistance;
                               }
                               else if(VA.Direction == Back)
                               {
                                 Pawn.Velocity.X = - VA.PushDistance;
                               }
                               PushState('PlayerWalking');
                             }
                          
                             bVaulted = false;
                           }
                          
                          
                            Begin:
                            
                            Check();
                          
                          }
                          
                          function SetWalking(bool walking)
                          {
                              super(Pawn).SetWalking(walking);
                          }
                          
                          function PostBeginPlay()
                          {
                          	PlaySound(LevelStart);
                          	super.PostBeginPlay();
                          }
                          
                          function bool Died(Controller Killer, class<DamageType> damageType, vector HitLocation)
                          {
                          	if (Super.Died(Killer, DamageType, HitLocation))
                          	{
                          		StartFallImpactTime = WorldInfo.TimeSeconds;
                          		bCanPlayFallingImpacts=true;
                          		if(ArmsMesh[0] != none)
                          		{
                          			ArmsMesh[0].SetHidden(true);
                          		}
                          		if(ArmsMesh[1] != none)
                          		{
                          			ArmsMesh[1].SetHidden(true);
                          		}
                          		SetPawnAmbientSound(None);
                          		SetWeaponAmbientSound(None);
                          		KillStreak = 0; //Set Our killstreak to 0!
                          		SPawn(Playercontroller(Killer).Pawn).GetKill();
                          		return true;
                          	}
                          	return false;
                          }
                          
                          function GetKill()
                          {
                          	 KillStreak++;
                          	 if (KillStreak == 3)
                          	 {
                          		WorldInfo.Game.Broadcast(self,"Radar available!");
                          		//Then some other stuff...
                          	 }
                          }
                          
                          defaultproperties
                          {
                          	 ClimbHeight = 0
                               bVaulted = false
                          
                               VaultStartSocketName = VaultStart
                               VaultEndSocketName =   VaultEnd
                          
                          	KillStreak = 0;
                          	LevelStart = "A_interface.menu.UT3MenuStartGameCue"
                          	
                          	Begin Object Name=WPawnSkeletalMeshComponent
                          		bOwnerNoSee=false
                          	End Object
                          	Name="Default__SPawn"
                          
                          	WeaponAmbientSound=AmbientSoundComponent2
                          	Components.Add(AmbientSoundComponent2)
                          
                          	ViewPitchMin=-18000
                          	ViewPitchMax=18000
                          
                          	WalkingPct=+0.4
                          	CrouchedPct=+0.4
                          	BaseEyeHeight=38.0
                          	EyeHeight=38.0
                          	GroundSpeed=200.0
                          	AirSpeed=200.0
                          	WaterSpeed=220.0
                          	DodgeSpeed=600.0
                          	DodgeSpeedZ=295.0
                          	AccelRate=2048.0
                          	JumpZ=322.0
                          	CrouchHeight=29.0
                          	CrouchRadius=21.0
                          	WalkableFloorZ=0.78
                          
                          	AlwaysRelevantDistanceSquared=+1960000.0
                          	InventoryManagerClass=class'UTInventoryManager'
                          
                          	MeleeRange=+20.0
                          	bMuffledHearing=true
                          
                          	Buoyancy=+000.99000000
                          	UnderWaterTime=+00020.000000
                          	bCanStrafe=False
                          	bCanSwim=true
                          	RotationRate=(Pitch=20000,Yaw=20000,Roll=20000)
                          	MaxLeanRoll=2048
                          	AirControl=+0
                          	DefaultAirControl=+0
                          	bCanCrouch=true
                          	bCanClimbLadders=True
                          	bCanPickupInventory=True
                          	bCanDoubleJump=false
                          	SightRadius=+12000.0
                          
                          	MaxMultiJump=0
                          	MultiJumpRemaining=1
                          	MultiJumpBoost=-45.0
                          
                          	SoundGroupClass=class'UTGame.UTPawnSoundGroup'
                          
                          	TransInEffects(0)=class'UTEmit_TransLocateOutRed'
                          	TransInEffects(1)=class'UTEmit_TransLocateOut'
                          
                          	MaxStepHeight=26.0
                          	MaxJumpHeight=26.0
                          	MaxDoubleJumpHeight=87.0
                          	DoubleJumpEyeHeight=43.0
                          
                          	HeadRadius=+9.0
                          	HeadHeight=5.0
                          	HeadScale=+1.0
                          	HeadOffset=32
                          
                          	SpawnProtectionColor=(R=40,G=40)
                          	TranslocateColor[0]=(R=20)
                          	TranslocateColor[1]=(B=20)
                          	DamageParameterName=DamageOverlay
                          	SaturationParameterName=Char_DistSatRangeMultiplier
                          
                          	TeamBeaconMaxDist=3000.f
                          	TeamBeaconPlayerInfoMaxDist=3000.f
                          	RagdollLifespan=18.0
                          
                          	bPhysRigidBodyOutOfWorldCheck=TRUE
                          	bRunPhysicsWithNoController=true
                          
                          	CurrentCameraScale=1.0
                          	CameraScale=9.0
                          	CameraScaleMin=3.0
                          	CameraScaleMax=40.0
                          
                          	LeftFootControlName=LeftFootControl
                          	RightFootControlName=RightFootControl
                          	bEnableFootPlacement=true
                          	MaxFootPlacementDistSquared=56250000.0 // 7500 squared
                          
                          	SlopeBoostFriction=0.2
                          	bStopOnDoubleLanding=true
                          	DoubleJumpThreshold=160.0
                          	FireRateMultiplier=1.0
                          
                          	ArmorHitSound=SoundCue'A_Gameplay.Gameplay.A_Gameplay_ArmorHitCue'
                          	SpawnSound=SoundCue'A_Gameplay.A_Gameplay_PlayerSpawn01Cue'
                          	TeleportSound=SoundCue'A_Weapon_Translocator.Translocator.A_Weapon_Translocator_Teleport_Cue'
                          
                          	MaxFallSpeed=+1250.0
                          	AIMaxFallSpeedFactor=1.1 // so bots will accept a little falling damage for shorter routes
                          	LastPainSound=-1000.0
                          
                          	FeignDeathBodyAtRestSpeed=12.0
                          	bReplicateRigidBodyLocation=true
                          
                          	MinHoverboardInterval=0.7
                          	HoverboardClass=class'UTVehicle_Hoverboard'
                          
                          	FeignDeathPhysicsBlendOutSpeed=2.0
                          	TakeHitPhysicsBlendOutSpeed=0.5
                          
                          	TorsoBoneName=b_Spine2
                          	FallImpactSound=SoundCue'A_Character_BodyImpacts.BodyImpacts.A_Character_BodyImpact_BodyFall_Cue'
                          	FallSpeedThreshold=125.0
                          
                          	SuperHealthMax=100
                          
                          	// moving here for now until we can fix up the code to have it pass in the armor object
                          	ShieldBeltMaterialInstance=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Overlay'
                          	ShieldBeltTeamMaterialInstances(0)=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Red'
                          	ShieldBeltTeamMaterialInstances(1)=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Blue'
                          	ShieldBeltTeamMaterialInstances(2)=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Red'
                          	ShieldBeltTeamMaterialInstances(3)=Material'Pickups.Armor_ShieldBelt.M_ShieldBelt_Blue'
                          
                          	HeroCameraPitch=6000
                          	HeroCameraScale=6.0
                          
                          	//@TEXTURECHANGEFIXME - Needs actual UV's for the Player Icon
                          	IconCoords=(U=657,V=129,UL=68,VL=58)
                          	MapSize=1.0
                          
                          	// default bone names
                          	WeaponSocket=WeaponPoint
                          	WeaponSocket2=DualWeaponPoint
                          	HeadBone=b_Head
                          	PawnEffectSockets[0]=L_JB
                          	PawnEffectSockets[1]=R_JB
                          
                          
                          	MinTimeBetweenEmotes=1.0
                          
                          	DeathHipLinSpring=10000.0
                          	DeathHipLinDamp=500.0
                          	DeathHipAngSpring=10000.0
                          	DeathHipAngDamp=500.0
                          
                          	bWeaponAttachmentVisible=true
                          
                          	TransCameraAnim[0]=CameraAnim'Envy_Effects.Camera_Shakes.C_Res_IN_Red'
                          	TransCameraAnim[1]=CameraAnim'Envy_Effects.Camera_Shakes.C_Res_IN_Blue'
                          	TransCameraAnim[2]=CameraAnim'Envy_Effects.Camera_Shakes.C_Res_IN'
                          
                          	MaxFootstepDistSq=100000.0 //Org. 9000000.0
                          	MaxJumpSoundDistSq=16000000.0
                          
                          	SwimmingZOffset=-30.0
                          	SwimmingZOffsetSpeed=45.0
                          
                          	TauntNames(0)=TauntA
                          	TauntNames(1)=TauntB
                          	TauntNames(2)=TauntC
                          	TauntNames(3)=TauntD
                          	TauntNames(4)=TauntE
                          	TauntNames(5)=TauntF
                          
                          	Begin Object Class=ForceFeedbackWaveform Name=ForceFeedbackWaveformFall
                          		Samples(0)=(LeftAmplitude=50,RightAmplitude=40,LeftFunction=WF_Sin90to180,RightFunction=WF_Sin90to180,Duration=0.200)
                          	End Object
                          	FallingDamageWaveForm=ForceFeedbackWaveformFall
                          
                          	CamOffset=(X=4.0,Y=16.0,Z=-13.0)
                          }

                          I think that code is meant to go into your PlayerController class man, not your Pawn class.

                          For some reason UDK is giving me this error:
                          "Error, 'P' : Bad command or expression"

                          No idea why :/

                          Comment


                          • #14
                            On exec function use add

                            Local P UTPawn;

                            Comment


                            • #15
                              Yup i gotta update that with the missing var, thanks alvarofer0021!


                              just need to add

                              var MainPawn(or ur pawn) P;

                              to the top of the class.

                              Comment

                              Working...
                              X