Page 3 of 15 FirstFirst 1234513 ... LastLast
Results 21 to 30 of 149

Thread: Vaulting (Using a placeable class)

  1. #21
    JmPrsh153
    Guest
    can you post your player controller code please?

  2. #22
    otaku44
    Guest
    sure no problem, but its the same as the one on the tut.

    var int ClimbHeight;

    var name VaultStartSocketName;
    var name VaultEndSocketName;
    var VPawn 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(VaultS tartSocketName, StartLoc);
    Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultE ndSocketName, 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(VaultS tartSocketName, StartLoc);
    Pawn.Mesh.GetSocketWorldLocationAndRotation(VaultE ndSocketName, 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('VaultMediumSmal l', 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
    }

  3. #23
    TheAgent
    Guest
    Seems fine, make sure all the names match up correctly.

    Such as the VaultActor class name matches the file name.

    Also change

    P = MainPawn(Pawn);

    to P = VPawn(Pawn);

  4. #24
    JmPrsh153
    Guest
    and also if you havent remember to place the **** extends **** at the top because it doesnt look like you have in this code unless you didnt add it in to the forums

  5. #25
    JmPrsh153
    Guest
    hey 'theagent' how do you actually use this vaulting action though because i have the actor in the level but when i go up to it nothing happens, do i have to do something or press anything?

  6. #26
    otaku44
    Guest
    cool thanks for the help.
    ive renamed it all now etc, but im still getting the error "bad class definition "VaultActor""

  7. #27
    otaku44
    Guest
    would i use this then foe the extend part

    class VPlayerController extends UTPlayerController;

    ok it was that, sweet it complied now, thanks you guys

  8. #28
    JmPrsh153
    Guest
    also how do you post images straight on the forums instead of uploading them to imageshack etc.?

  9. #29
    otaku44
    Guest
    if this is aimed at me, i uploaded it to photobucket,
    if it wasnt aimed at me, then it doesnt matter

  10. #30
    JmPrsh153
    Guest
    to anyone really lol but btw is this actually working for you in editor? because i dont know how to actually do this

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •