Announcement

Collapse
No announcement yet.

[Solved]Loot Dead Pawn

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

    [Solved]Loot Dead Pawn

    hi everybody,
    (excuse me for my bad english im french)
    i have a problem with my ragdolls loot system, when i bump it no inventory popup in my screen.
    Have you got any idea to fix it?

    it's my codei have used a Starter pack from Elium

    PHP Code:
    class myPawn extends UTPawn
        ClassGroup
    (myGame)
        
    placeable;
      
    //==========================//
     //     Variables                            //
    //==========================//
    var() array<archetype ObjectInventoryItems;//liste des objet dans l'inventaire
    var() int Gold;//Or stocker dans le container
    var Actor LootedPawn;
    var 
    float LootDistance;
    var() 
    int energie// l'energie actuelle que le HUD viendra chercher.
    var() int energieMax
    var 
    int athletisme
    var 
    int discreteSpeed;
    var 
    int walkSpeed;
    var 
    int runSpeed;
    var 
    int sprintSpeed;
    var 
    int speedMode//la vitesse actuelle (hors sprint) prend pour valeur 1 pour discrete/2 pour walk/3 pour run
      //==========================//
     // Function                               //
    //==========================//
    simulated function PostBeginPlay()
    {
        
    super.PostBeginPlay();
        
    AddInventoryItems();
    }

    function 
    PossessedBy(Controller Cbool bVehicleTransition)
    {
        
    local myPlayerController myPC;
        
    super.PossessedBy(CbVehicleTransition);

        if (
    myPlayerController(C) != None)
        {
            
    //initialisation de l'inventaire pour prevoir de futur erreur
            
    myHUD(PlayerController(Controller).myHUD).InitInventory();
        }
        if (
    C.IsA('myPlayerController'))//selection du joueur
        
    {
        
    myPC=myPlayerController(C);//parametre myPlayerController
        
    myPC.energieCourante=energie;// valeur de l'energie
        
    myPC.energieMax=energieMax;//on fournit l'energie Max(Stamina)
        
    }
    }

    function 
    Tick(float DeltaTime)
    {
        
    super.Tick(DeltaTime);

        if (
    LootedPawn != None)
        {
            
    //si tu est trop loin retire la possibilit� de loot
            
    if (VSize2D(Location LootedPawn.Location) > LootDistance)
            {
                
    LootedPawn None;
                
    myHUD(PlayerController(Controller).myHUD).InventoryMovie.LootScreen(falsetrue);
                
    myHUD(PlayerController(Controller).myHUD).InventoryMovie.LootScreen(falsefalse);
            }
        }
    }

    function 
    AddInventoryItems()
    {
        
    local Actor ArchetypeTemplateNewItem;
        
    local int isaveSlot;
        
    local myInventoryManager myInvM;
        
    local string checkSlot;
        
    local bool bEquippedbFreeSlot;
        
    local myWeapon myWeap;
        
    local myInventory myInv;

        
    // verification de l inventory manager
        
    if (InvManager == None)
        {
            
    SetTimer(0.25ffalse'AddInventoryItems');
            return;
        }

        
    // charge l'inventaire (NPC)]
        
    myInvM myInventoryManager(InvManager);
        for (
    i=0i<InventoryItems.Lengthi++)
        {
            if (
    InventoryItems[i] == none)
                continue;

            
    ArchetypeTemplate Actor(DynamicLoadObject(PathName(InventoryItems[i]), class'Actor'true));
            
    NewItem Spawn(ArchetypeTemplate.Class, self, , , , ArchetypeTemplate);
            
    myInvM.AddInventory(Inventory(NewItem), true);

            
    // essaye d'equiper en premier
            
    bEquipped false;
            if (
    myWeapon(NewItem) != None)
            {
                
    bFreeSlot true;
                ForEach 
    myInvM.InventoryActors(class'myWeapon'myWeap)
                {
                    if (
    myWeap.ItemSlot == "slotWeapon")
                    {
                        
    bFreeSlot false;
                        break;
                    }
                }

                if (
    bFreeSlot)
                {
                    
    myWeapon(NewItem).ItemSlot "slotWeapon";
                    
    myInvM.ClientWeaponSet(myWeapon(NewItem), true);
                    
    bEquipped true;
                }
            }

            
    // if it wasn't successfully equipped, find out the first free inventory slot to store this in
            
    if (!bEquipped)
            {
                for (
    saveSlot 0saveSlot myInvM.MaxSpacessaveSlot++)
                {
                    
    bFreeSlot true;
                    
    checkSlot "slot"$saveSlot;
                    ForEach 
    myInvM.InventoryActors(class'myWeapon'myWeap)
                    {
                        if (
    myWeap.ItemSlot == checkSlot)
                        {
                            
    bFreeSlot false;
                        }
                    }
                    ForEach 
    myInvM.InventoryActors(class'myInventory'myInv)
                    {
                        if (
    myInv.ItemSlot == checkSlot)
                        {
                            
    bFreeSlot false;
                        }
                    }

                    if (
    bFreeSlot)
                    {
                        break;
                    }
                }

                if (
    myWeapon(NewItem) != None)
                {
                    
    myWeapon(NewItem).ItemSlot checkSlot;
                }
                else if (
    myInventory(NewItem) != None)
                {
                    
    myInventory(NewItem).ItemSlot checkSlot;
                    
    myInventory(NewItem).Quantity 1;
                }
            }
        }

        
    myInvM.Gold Gold;
    }

    event BumpActor OtherPrimitiveComponent OtherCompVector HitNormal )
    {
        
    // if we bump into a container start looting (but only if we're not already looting it)
        
    if (LootedPawn != Other && myInventoryContainer(Other) != None && Controller != None && PlayerController(Controller) != None)
        {
            if (
    VSize2D(Location Other.Location) <= LootDistance)
            {
                
    LootedPawn myInventoryContainer(Other);
                
    myHUD(PlayerController(Controller).myHUD).ToggleInventory(true);
                
    myHUD(PlayerController(Controller).myHUD).InventoryMovie.SetUpLoot();
            }
        }
        
    // if we bump into another character start looting (but only if we're not already looting him)
        // commented out: handled through RigidBodyCollision. re-enable if you want to loot living Pawns
        /*else if (LootedPawn != Other && myPawn(Other) != None && Controller != None && PlayerController(Controller) != None)
        {
            if (VSize2D(Location - Other.Location) <= LootDistance)
            {
                LootedPawn = myPawn(Other);
                myHUD(PlayerController(Controller).myHUD).ToggleInventory(true);
                myHUD(PlayerController(Controller).myHUD).InventoryMovie.SetUpLoot();
            }
        }*/

        
    super.Bump(OtherOtherCompHitNormal);
    }
    //loot corpse
    simulated event RigidBodyCollisionPrimitiveComponent HitComponentPrimitiveComponent OtherComponent,
                        const 
    out CollisionImpactData RigidCollisionDataint ContactIndex )
    {
        if (
    HitComponent.Owner != OtherComponent.Owner)
            
    super.RigidBodyCollision(HitComponentOtherComponentRigidCollisionDataContactIndex);

        if (
    LootedPawn != OtherComponent.Owner && myPawn(OtherComponent.Owner) != None && Health 0)
        {
            
    LootedPawn myPawn(OtherComponent.Owner);
            
    myHUD(PlayerController(Controller).myHUD).ToggleInventory(true);
            
    myHUD(PlayerController(Controller).myHUD).InventoryMovie.SetUpLoot();
        }
    }

    simulated function SetCharacterClassFromInfo(class<UTFamilyInfoInfo)
    {
        
    // leave this empty so we can use a custom character mesh without worrying about the family info stuffs
    }

    simulated function SetPawnRBChannels(bool bRagdollMode)
    {
        if(
    bRagdollMode)
        {
            
    // enable pawn-to-ragdoll collisions so we can loot him
            
    Mesh.SetRBChannel(RBCC_Pawn);
            
    Mesh.SetRBCollidesWithChannel(RBCC_Default,TRUE);
            
    Mesh.SetRBCollidesWithChannel(RBCC_Pawn,FALSE);
            
    Mesh.SetRBCollidesWithChannel(RBCC_Vehicle,FALSE);
            
    Mesh.SetRBCollidesWithChannel(RBCC_Untitled3,TRUE);
            
    Mesh.SetRBCollidesWithChannel(RBCC_BlockingVolume,TRUE);
            
    Mesh.SetActorCollision(falsefalse);
        }
        else
        {
            
    Mesh.SetRBChannel(RBCC_Untitled3);
            
    Mesh.SetRBCollidesWithChannel(RBCC_Default,FALSE);
            
    Mesh.SetRBCollidesWithChannel(RBCC_Pawn,FALSE);
            
    Mesh.SetRBCollidesWithChannel(RBCC_Vehicle,FALSE);
            
    Mesh.SetRBCollidesWithChannel(RBCC_Untitled3,TRUE);
            
    Mesh.SetRBCollidesWithChannel(RBCC_BlockingVolume,FALSE);
            
    Mesh.SetActorCollision(truetrue);
        }
    }

    simulated function bool ShouldGib(class<UTDamageTypeUTDamageType)
    {
        
    // with this we disable gibbing corpses
        
    return false;
    }

    simulated State Dying
    {
    ignores OnAnimEndBumpHitWallHeadVolumeChangePhysicsVolumeChangeFallingBreathTimerStartFeignDeathRecoveryAnimForceRagdollFellOutOfWorld;
        
    event Timer()
        {
            
    // with this we leave the corpses permanently
        
    }

        
    simulated event TakeDamage(int DamageController InstigatedByvector HitLocationvector Momentum, class<DamageTypeDamageTypeoptional TraceHitInfo HitInfooptional Actor DamageCauser)
        {
            
    // with this we disable gibbing corpses
        
    }
    }

    DefaultProperties
    {
        
    //sprint
        
    energie=100//valeur d energie donn�e au spawn
        
    energieMax=100//valeur maximal
        
    athletisme=0//pour plus tard(Endurance)
        
        
    discreteSpeed=120//fvitesse de deplacement en Sneak
        
    walkSpeed=160//vitesse de deplacement en marchant
        
    runSpeed=320//vitesse quaznd tu cour
        
    sprintSpeed=640//vitesse quand tu sprint
        
    speedMode=3//pour le switch
        
        
    InventoryManagerClass=class'myInventoryManager'
        
    ControllerClass=class'AIController'

        
    // set the ironguard as the mesh
        
    Begin Object Name=WPawnSkeletalMeshComponent
            SkeletalMesh
    =SkeletalMesh'CH_IronGuard_Male.Mesh.SK_CH_IronGuard_MaleA'
            
    AnimSets[0]=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
            
    AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
            
    PhysicsAsset=PhysicsAsset'InvDemo.Meshes.SK_CH_IronGuard_MaleA_Physics'
            
    RBCollideWithChannels=(Cloth=true)
            
    bHasPhysicsAssetInstance=true
            ScriptRigidBodyCollisionThreshold
    =0.01
            bNotifyRigidBodyCollision
    =true
        End Object
        Mesh
    =WPawnSkeletalMeshComponent

        Begin Object Name
    =CollisionCylinder
            ScriptRigidBodyCollisionThreshold
    =0.1
            bNotifyRigidBodyCollision
    =true
        End Object
        CylinderComponent
    =CollisionCylinder

        LootDistance 
    80.0f
        RagdollLifespan
    =0.0

    thank you in advance.

    #2
    How about you make yours from scratch and maybe you know wich is the problem ? sorry , that's the way i can better help you

    Comment


      #3
      i have made Three version of this class but for a container it's barrel in game he properly work in game but the guard not work i dont understand why it's doesn't work anymore.

      in waiting for an answer i trying to make this to work

      Comment


        #4
        I just checked it again on my end, using the latest UDK (2014-05) and looting dead pawns works fine.

        after a quick review of your code I only noticed one difference, you made the value of ScriptRigidBodyCollisionThreshold bigger for both the mesh and the collision cylinder. try setting them back to 0.001, or else it's likely that the colision threshold is not enough to trigger the RigidBodyCollision, which is what triggers the looting

        Comment


          #5
          I have turn back RigidBodyCollision to 0.001 but doesn't work anymore i have UDK release 2013/07 i update it.
          the script have no difference because i have turn back all of my modification beacause it doesn't work

          Comment


            #6
            Originally posted by InfinityHell View Post
            I have turn back RigidBodyCollision to 0.001 but doesn't work anymore i have UDK release 2013/07 i update it.
            the script have no difference because i have turn back all of my modification beacause it doesn't work
            after update no change it not work i continue my investigation

            Comment


              #7
              just in case, try increasing the value of LootDistance
              also I would expect it not to work if the character doesn't have a proper PhysicsAsset, but I see you didn't change that.

              also, you're using the included test level?

              Comment


                #8
                Originally posted by Chosker View Post
                just in case, try increasing the value of LootDistance
                also I would expect it not to work if the character doesn't have a proper PhysicsAsset, but I see you didn't change that.

                also, you're using the included test level?
                i have made a video if this can help you:https://www.youtube.com/watch?v=W1Kt...ature=youtu.be
                i have try to increase LootDistance

                i have made modification in playerController for sprint system this can broke your code?

                Comment


                  #9
                  well your ragdolls are weird, like slow. start the game and use the console command 'show collision' and see if it's properly in place.
                  other than that maybe you're killing the Pawn without his health really going to zero?

                  Comment


                    #10
                    Originally posted by Chosker View Post
                    well your ragdolls are weird, like slow. start the game and use the console command 'show collision' and see if it's properly in place.
                    other than that maybe you're killing the Pawn without his health really going to zero?
                    it's strange it work for a split second i have made an other video
                    https://www.youtube.com/watch?v=yGZ1...ature=youtu.be

                    Comment


                      #11
                      it's clear in that video. after a few seconds (00:08 in the video) the physics part of the Pawn completely disappears, which prevents you from colliding with it (and thus, looting).
                      either the code you pasted here is incomplete (i.e. your Pawn is doing something more) or something in some other class is causing this.

                      Comment


                        #12
                        Originally posted by Chosker View Post
                        it's clear in that video. after a few seconds (00:08 in the video) the physics part of the Pawn completely disappears, which prevents you from colliding with it (and thus, looting).
                        either the code you pasted here is incomplete (i.e. your Pawn is doing something more) or something in some other class is causing this.
                        my player controller:
                        PHP Code:
                        class myPlayerController extends UTPlayerController;
                          
                        //==========================//
                         //     Variables                            //
                        //==========================//
                        var bool bIsSprinting//sprintons nous?
                        var bool bAllEnergieConsomated;//jauge vide?
                        var bool bIsRegenerating;// est ce que ca regen?

                        var float energieCourante;//on la deja vu dans le pawn
                        var float energieMax;//fournit ans le pawn

                        var float tempsDeRepos;//temps necessaire pour regenerer l'energie
                        var float coefTemps;//convertir energie==>temps en inversement
                          //==========================//
                         // Function                               //
                        //==========================//

                        //
                        simulated event PostBeginPlay()
                        {
                            
                        super.PostBeginPlay();
                        }
                          
                        //==========================//
                         // Inventory                          //
                        //==========================//
                        exec function PrevWeapon()
                        {
                            
                        //enleve la possibilit� de chager d arme
                        }

                        exec function NextWeapon()
                        {
                            
                        //enleve la possibilit� de chager d arme
                        }

                        exec function ToggleInventory()
                        {
                            
                        myHUD(myHUD).ToggleInventory(!myHUD(myHUD).InventoryMovie.bMovieIsOpen);
                        }

                          
                        //==========================//
                         // Sprint                                 //
                        //==========================//
                        //En gros si on sprint regen off+ calcul de la consomation de energie
                        exec function Sprint()
                        {
                            if(
                        myPawn(Pawn) != none && energieCourante 0)//si nous avon encore de l energie
                            
                        {
                            
                        coefTemps=(26.0/(1.0+float((myPawn(pawn).athletisme))/100.0));
                            
                        bIsSprinting true;
                            }
                            if(
                        bIsRegenerating)//si on regenere
                            
                        {
                            
                        bIsRegenerating false;
                            }
                        }
                        exec function StopSprint()//arrete le sprint
                        {
                            if(
                        bIsSprinting && !bAllEnergieConsomated)//si jauge pas vide regen de suite
                            
                        {
                                    
                        bIsRegenerating=true;
                                    
                        tempsDeRepos=0.0;
                            }
                                
                        SetPreviousSpeed();
                                
                        bIsSprinting false;
                        }
                        function 
                        SetSprintSpeed()
                        {
                            if(
                        myPawn(Pawn) != none && energieCourante >0)
                            {
                                
                        myPawn(Pawn).GroundSpeed myPawn(Pawn).sprintSpeed;
                                
                        //possible de remplacer cette ligne par "myPawn(Pawn).GroundSpeed=640"
                            
                        }
                        }
                        function 
                        SetPreviousSpeed()
                        {
                        `
                        log("=================== SetPreviousSpeed");
                            if(myPawn(Pawn) != none)
                            {
                                switch(myPawn(Pawn).speedMode)
                                {
                                case 1:
                                    myPawn(Pawn).GroundSpeed = myPawn(Pawn).discreteSpeed;
                                break;
                                case 2:
                                    myPawn(Pawn).GroundSpeed = myPawn(Pawn).walkSpeed;
                                break;
                                case 3:
                                    myPawn(Pawn).GroundSpeed = myPawn(Pawn).runSpeed;
                                break;
                                default:
                                    myPawn(Pawn).GroundSpeed = myPawn(Pawn).default.GroundSpeed;
                                }
                            }
                        }
                        event PlayerTick( float DeltaTime )
                        {
                            Super.PlayerTick(DeltaTime);
                         
                            if(bIsSprinting && PlayerInput.aForward<=0)
                            {
                                bIsRegenerating=true;
                                        SetPreviousSpeed();//vitesse pr�c�dente ou actuelle selon si on a sprint� ou non
                            }
                            if( PlayerInput.aForward>0)//si on avace
                            {
                                if(bIsSprinting)//si on sprinte
                                {
                                    SetSprintSpeed();//on sprint donc vitesse de sprint
                                    bIsRegenerating=false;
                                    energieCourante=energieCourante - (DeltaTime * coefTemps);
                                    //tempsDeRepos=tempsDeRepos+DeltaTime;
                                    if(myPawn(Pawn) != none)  // verification de routine pour ne pas avoir de probleme d' "access none"
                                    {
                                        myPawn(Pawn).energie=energieCourante; //informe le pion pour MaJ le HUD
                                    }
                                }
                            }
                            if(bAllEnergieConsomated)//si toute l'energie a ete consomme
                            {
                                //ici ca correspond plutot au temps de "reprendre son soufle"
                                tempsDeRepos=tempsDeRepos-((DeltaTime*coefTemps)/2); //Delta*coefTemps sur 2 pour attendre la moitie du temps de sprint max avant de regenerer
                                if(tempsDeRepos<=0)//on a fini de reprendre son soufle donc on peut regenerer
                                {
                                    bIsRegenerating=true;
                                }
                            }
                            if(bIsRegenerating)// est on en mode de regeneration ?
                            {
                                tempsDeRepos=0.0;
                                //on recupere moins vite qu'on depense, donc on divise le coef par 2
                                energieCourante=energieCourante + ((DeltaTime * coefTemps)/2);
                                if(myPawn(Pawn) != none){myPawn(Pawn).energie=energieCourante;}
                                //il y a des points maintenant...
                                bAllEnergieConsomated=false;
                            }
                            if(energieCourante > energieMax)//on a atteint le max
                            {
                                energieCourante=energieMax;
                                if(bIsRegenerating)//nous �tions tr�s probablement en train de nous r�g�n�rer, donc on arr�te cette derni�re qui ne sert plus a rien
                                {
                                    bIsRegenerating=false;
                                }
                                if(myPawn(Pawn) != none){myPawn(Pawn).energie=energieCourante;}
                            }
                            if(energieCourante <= 0 && !bAllEnergieConsomated)//on a atteint la limite min du pion
                            {
                                        SetPreviousSpeed();
                                bAllEnergieConsomated=true;
                                //on calcule le temps de sprint max que le pion peut realiser, cela permetra de calculer le temps de reprendre son soufle
                                tempsDeRepos=energieMax;
                                if(myPawn(Pawn) != none){ myPawn(Pawn).energie=0; } //ici on met 0 pasque de toute facon on va pas dans les negatifs
                                StopSprint();     // faut bien s'arreter un jour...
                            }
                        }
                        defaultproperties
                        {
                        //sprint
                            coefTemps=26.0//80=3seconte 26=80/3
                            tempsDeRepos=0.0;//etat de base
                            bIsRegenerating=false//etat de base
                            bIsSprinting=false//etat de base
                            bAllEnergieConsomated=false//etat de base

                        myWeapon:
                        PHP Code:
                        class myWeapon extends crossbow_weapon
                            ClassGroup
                        (myGame)
                            
                        placeable;

                        /** The slot inside the inventory, aka. where in the grid/character it's located */
                        var string ItemSlot;

                        /** The name of the Item */
                        var() string ObjectName;

                        /** The current durability of this item */
                        var() float Durability;
                        /** The max durability of this item */
                        var() float MaxDurability;

                        /** The money value of this item */
                        var() float Value;

                        /** Texture to display as icon in the inventory */
                        var() Texture2D InventoryTexture;


                        enum WeaponTypes
                        {
                            
                        Weapon_Gun<DisplayName=Gun>,
                            
                        Weapon_Sword<DisplayName=Sword>
                        };
                        var() 
                        WeaponTypes WeaponType;

                        reliable client function ClientGivenTo(Pawn NewOwnerbool bDoNotActivate)
                        {
                            
                        // here we disable autoswitch for this weapon
                        }

                        function 
                        DropFrom(vector StartLocationvector StartVelocity)
                        {
                            
                        local DroppedPickup Pickup;

                            if( 
                        Instigator != None && Instigator.InvManager != None )
                            {
                                
                        Instigator.InvManager.RemoveFromInventory(Self);
                            }

                            
                        // if cannot spawn a pickup, then destroy and quit
                            
                        if( DroppedPickupClass == None || (DroppedPickupMesh == None && Mesh == None))
                            {
                                
                        Destroy();
                                return;
                            }

                            
                        Pickup Spawn(DroppedPickupClass,,, StartLocation);
                            if( 
                        Pickup == None )
                            {
                                
                        Destroy();
                                return;
                            }

                            
                        // here we set ourself to be the drop's Inventory var
                            
                        Pickup.Inventory self;
                            
                        Pickup.InventoryClass = class;
                            
                        Pickup.Velocity StartVelocity;
                            if (
                        Mesh != None)
                                
                        Pickup.SetPickupMesh(DroppedPickupMesh);
                            
                        Pickup.SetPhysics(PHYS_Falling);

                            
                        Instigator None;
                            
                        GotoState('');
                        }

                        DefaultProperties
                        {
                            
                        DroppedPickupClass=class'myItemPickup'

                        ATEWeapon(aimable weapon)
                        PHP Code:
                        class ATEWeapon extends UTWeapon
                            HideDropDown
                            
                        abstract;

                        var 
                        enum EWeapAnimType  
                        {
                            
                        EWAT_Default,
                            
                        EWAT_Pistol,
                            
                        EWAT_DualPistols,
                            
                        EWAT_ShoulderRocket,
                            
                        EWAT_Stinger
                        WeapAnimType;
                        var(
                        Animations) array<nameWeaponFireAnimZoom;
                        var(
                        Animations) array<nameWeaponIdleAnimsZoom;
                        var(
                        Animations) array<nameArmFireAnimZoom;
                        var(
                        Animations) array<nameArmIdleAnimsZoom;
                        var 
                        float BaseGroundSpeed;
                        var 
                        float BaseAirSpeed;
                        var 
                        float BaseWaterSpeed;
                        var 
                        float BaseJumpZ;
                        var 
                        float ZoomGroundSpeed;
                        var 
                        float ZoomAirSpeed;
                        var 
                        float ZoomWaterSpeed;
                        var 
                        float ZoomJumpZ;
                        var 
                        float SpreadScoped;
                        var 
                        float SpreadNoScoped;
                        var 
                        bool AmIZoomed;
                        var 
                        bool bDisplayCrosshair;
                        var 
                        float ZoomedFOVSub;
                        var 
                        bool bAbortZoom;
                        var 
                        int ZoomCount;

                        replication
                        {
                          if ( 
                        Role == ROLE_Authority )
                            
                        AmIZoomed;
                        }


                        server reliable function CheckMyZoom()
                        {
                                
                        Local Pawn P;
                                
                        Pawn(Owner);
                            if (
                        AmIZoomed == true)
                            {
                                    
                        P.GroundSpeed = Default.ZoomGroundSpeed;
                                    
                        P.AirSpeed = Default.ZoomAirSpeed;
                                    
                        P.WaterSpeed = Default.ZoomWaterSpeed;
                                    
                        P.JumpZ = Default.ZoomJumpZ;
                                
                        Spread[CurrentFireMode] = Default.SpreadScoped;
                                
                        FireInterval[CurrentFireMode] = Default.FireInterval[CurrentFireMode]/1.25;

                            }
                            else
                            {
                                    
                        P.GroundSpeed = Default.BaseGroundSpeed;
                                    
                        P.AirSpeed = Default.BaseAirSpeed;
                                    
                        P.WaterSpeed = Default.BaseWaterSpeed;
                                    
                        P.JumpZ = Default.BaseJumpZ;
                                
                        Spread[CurrentFireMode] = Default.SpreadNoScoped;
                                
                        FireInterval[CurrentFireMode] = Default.FireInterval[CurrentFireMode];
                            }
                        }
                        simulated function Activate()
                        {
                            
                        CheckMyZoom();
                            
                        GetSetFOV();
                            
                        super.Activate();
                        }


                        simulated function DrawWeaponCrosshairHud HUD )
                        {
                            
                        local UTPlayerController PC;

                            if( 
                        bDisplayCrosshair )
                            {
                                
                        PC UTPlayerController(Instigator.Controller);
                                if ( (
                        PC == None) || PC.bNoCrosshair)
                                {
                                    return;
                                }
                                
                        super.DrawWeaponCrosshair(HUD);
                            }
                        }


                        simulated function GetSetFOV()
                        {
                            
                        local UTPlayerController PC;
                            
                        PC UTPlayerController(Instigator.Controller);
                            
                        ZoomedTargetFOV PC.FOVAngle ZoomedFOVSub;
                        }


                        simulated function StartZoom(UTPlayerController PC)
                        {
                            
                        ZoomCount++;
                            if (
                        ZoomCount == && !IsTimerActive('Gotozoom')&& HasAmmo(0) && Instigator.IsFirstPerson())
                            {
                                
                        bAbortZoom false;
                                
                        bDisplayCrosshair false;
                                
                        PlayWeaponAnimation('WeaponZoomIn',0.2);
                                
                        PlayArmAnimation('WeaponZoomIn',0.2);
                                
                        SetTimer(0.2false'Gotozoom');
                                
                        SetTimer(0.2,false,'PlayMyZoomIdle');
                                if( 
                        Role Role_Authority )
                                {
                                    
                        // if we're a client, synchronize server
                                    
                        SetTimer(0.2false'ServerGotozoom');
                                }
                            }
                        }


                        simulated function Gotozoom()
                        {
                            
                        local UTPlayerController PC;

                            
                        PC UTPlayerController(Instigator.Controller);
                            if (
                        GetZoomedState() == ZST_NotZoomed)
                            {
                                if (
                        bAbortZoom// stop the zoom after 1 tick
                                
                        {
                                    
                        SetTimer(0.0001false'StopZoom');
                                }
                                
                        PC.FOVAngle ZoomedTargetFOV;
                                
                        PC.StartZoom(ZoomedTargetFOVZoomedRate);
                            }
                            
                        AmIZoomed true;
                            
                        CheckMyZoom();
                        }


                        reliable server function ServerGotoZoom()
                        {
                            
                        AmIZoomed true;
                            
                        CheckMyZoom();
                        }


                        simulated function EndZoom(UTPlayerController PC)
                        {
                            
                        bAbortZoom false;
                            if (
                        IsTimerActive('Gotozoom'))
                            {
                                
                        ClearTimer('Gotozoom');
                            }
                            
                        SetTimer(0.001,false,'LeaveZoom');
                            if( 
                        Role Role_Authority )
                            {
                                
                        // if we're a client, synchronize server
                                
                        SetTimer(0.001,false,'ServerLeaveZoom');
                            }
                        }


                        simulated function LeaveZoom()
                        {

                            
                        local UTPlayerController PC;
                            
                        PC UTPlayerController(Instigator.Controller);
                            if (
                        PC != none)
                            {
                                
                        PC.EndZoom();
                            }
                            
                        ZoomCount 0;
                            
                        PlayWeaponAnimation('WeaponZoomOut',0.3);
                            
                        PlayArmAnimation('WeaponZoomOut',0.3);
                            
                        SetTimer(0.3,false,'RestartCrosshair');
                            
                        AmIZoomed false;
                            
                        bAbortZoom false;
                            
                        CheckMyZoom();
                        }


                        reliable server function ServerLeaveZoom()
                        {
                            
                        AmIZoomed false;
                            
                        CheckMyZoom();

                        }


                        simulated function StopZoom()
                        {
                            
                        local UTPlayerController PC;

                            if (
                        WorldInfo.NetMode != NM_DedicatedServer)
                            {
                                
                        PC UTPlayerController(Instigator.Controller);
                                if (
                        PC != None && LocalPlayer(PC.Player) != none)
                                {
                                    
                        PC.StopZoom();
                                }
                            }
                        }


                        simulated function RestartCrosshair()
                        {
                            
                        bDisplayCrosshair true;
                        }


                        simulated function PutDownWeapon()
                        {
                            
                        LeaveZoom();
                            
                        Super.PutDownWeapon();
                        }


                        simulated function bool DenyClientWeaponSet()
                        {
                            
                        // don't autoswitch while zoomed
                            
                        return (GetZoomedState() != ZST_NotZoomed);
                        }


                        simulated function HolderEnteredVehicle()
                        {
                            
                        local UTPawn UTP;

                            
                        PlayWeaponAnimation('WeaponZoomOut'0.3);

                            if (
                        WorldInfo.NetMode != NM_DedicatedServer)
                            {
                                
                        UTP UTPawn(Instigator);
                                if (
                        UTP != None)
                                {
                                    
                        // Check we have access to mesh and animations
                                    
                        if (UTP.ArmsMesh[0] != None && ArmsAnimSet != None && GetArmAnimNodeSeq() != None)
                                    {
                                        
                        UTP.ArmsMesh[0].PlayAnim('WeaponZoomOut'0.3false);
                                    }
                                }
                            }
                        }


                        simulated function PlayWeaponPutDown()
                        {
                            
                        ClearTimer('GotoZoom');
                            
                        ClearTimer('StopZoom');
                            if(
                        UTPlayerController(Instigator.Controller) != none)
                            {
                                
                        UTPlayerController(Instigator.Controller).EndZoom();
                            }
                            
                        super.PlayWeaponPutDown();
                        }


                        simulated function PlayFireEffectsbyte FireModeNumoptional vector HitLocation )
                        {
                            if (
                        AmIZoomed == true)
                            {
                            if ( 
                        FireModeNum WeaponFireAnim.Length && WeaponFireAnim[FireModeNum] != '' )
                                
                        PlayWeaponAnimationWeaponFireAnimZoom[FireModeNum], GetFireInterval(FireModeNum) );
                            if ( 
                        FireModeNum ArmFireAnim.Length && ArmFireAnim[FireModeNum] != '' && ArmsAnimSet != none)
                                
                        PlayArmAnimationArmFireAnimZoom[FireModeNum], GetFireInterval(FireModeNum) );
                            }
                            else
                            {
                            if ( 
                        FireModeNum WeaponFireAnim.Length && WeaponFireAnim[FireModeNum] != '' )
                                
                        PlayWeaponAnimationWeaponFireAnim[FireModeNum], GetFireInterval(FireModeNum) );
                            if ( 
                        FireModeNum ArmFireAnim.Length && ArmFireAnim[FireModeNum] != '' && ArmsAnimSet != none)
                                
                        PlayArmAnimationArmFireAnim[FireModeNum], GetFireInterval(FireModeNum) );
                            }
                            
                        // Start muzzle flash effect
                            
                        CauseMuzzleFlash();

                            
                        ShakeView();
                        }


                        simulated state Active
                        {
                            
                        simulated event OnAnimEnd(AnimNodeSequence SeqNodefloat PlayedTimefloat ExcessTime)
                            {
                                
                        local int IdleIndex;

                                if ( 
                        WorldInfo.NetMode != NM_DedicatedServer && WeaponIdleAnims.Length )
                                {
                            if (
                        AmIZoomed == true)
                            {
                                    
                        IdleIndex Rand(WeaponIdleAnimsZoom.Length);
                                    
                        PlayWeaponAnimation(WeaponIdleAnimsZoom[IdleIndex], 0.0true);
                                    if(
                        ArmIdleAnims.Length IdleIndex && ArmsAnimSet != none)
                                    {
                                        
                        PlayArmAnimation(ArmIdleAnimsZoom[IdleIndex], 0.0,, true);
                                    }
                            }
                            else
                            {
                                    
                        IdleIndex Rand(WeaponIdleAnims.Length);
                                    
                        PlayWeaponAnimation(WeaponIdleAnims[IdleIndex], 0.0true);
                                    if(
                        ArmIdleAnims.Length IdleIndex && ArmsAnimSet != none)
                                    {
                                        
                        PlayArmAnimation(ArmIdleAnims[IdleIndex], 0.0,, true);
                                    }
                            }
                                }
                            }
                        }


                        simulated function PlayMyZoomIdle()
                        {
                                
                        local int IdleIndex;
                                
                        IdleIndex Rand(WeaponIdleAnims.Length);
                                
                        PlayWeaponAnimation(WeaponIdleAnimsZoom[IdleIndex], 0.0true);
                                if(
                        ArmIdleAnims.Length IdleIndex && ArmsAnimSet != none)
                                {
                                    
                        PlayArmAnimation(ArmIdleAnimsZoom[IdleIndex], 0.0,, true);
                                }
                        }
                        simulated event ReplicatedEvent(name VarName)
                        {
                         if ( 
                        VarName == 'AmmoCount' )
                         {
                         if ( !
                        HasAnyAmmo() )
                         {
                         
                        WeaponEmpty();
                         }
                         }
                         else
                         {
                         
                        Super.ReplicatedEvent(VarName);
                         }
                        }
                        simulated function int GetAmmoCount()
                        {
                         return 
                        AmmoCount;
                        }
                        function 
                        ConsumeAmmobyte FireModeNum )
                        {
                         
                        AddAmmo(-ShotCost[FireModeNum]);
                        }
                        function 
                        int AddAmmoint Amount )
                        {
                         
                        AmmoCount Clamp(AmmoCount Amount,0,MaxAmmoCount);
                         return 
                        AmmoCount;
                        }
                        simulated function bool AmmoMaxed(int mode)
                        {
                         return (
                        AmmoCount >= MaxAmmoCount);
                        }
                        simulated function bool HasAmmobyte FireModeNumoptional int Amount )
                        {
                         if (
                        Amount==0)
                         return (
                        AmmoCount >= ShotCost[FireModeNum]);
                         else
                         return ( 
                        AmmoCount >= Amount );
                        }

                        simulated function bool HasAnyAmmo()
                        {
                         return ( ( 
                        AmmoCount ) || (ShotCost[0]==&& ShotCost[1]==0) );
                        }
                        simulated function float DesireAmmo(bool bDetour)
                        {
                         return (
                        1.f float(AmmoCount)/MaxAmmoCount);
                        }
                        simulated function bool NeedAmmo()
                        {
                         return ( 
                        AmmoCount < Default.AmmoCount );
                        }
                        simulated function WeaponEmpty()
                        {
                         if ( 
                        IsFiring() )
                         {
                         
                        GotoState('Active');
                         }
                         
                         if ( 
                        Instigator != none && Instigator.IsLocallyControlled() )
                         {
                         
                        Instigator.InvManager.SwitchToBestWeapontrue );
                         }
                        }
                        function 
                        PrintScreenDebug(string debugText)
                        {
                         
                        local PlayerController PC;
                         
                        PC PlayerController(Pawn(Owner).Controller);
                         if (
                        PC != None)
                         
                        PC.ClientMessage("ATEWeapon: " debugText);
                        }
                        defaultproperties
                        {

                            
                        InstantHitDamageTypes(1)=None
                            FiringStatesArray
                        (1)=Active
                            FireInterval
                        (1)=+0.00001
                            WeaponFireAnimZoom
                        (0)=WeaponZoomFire
                            WeaponIdleAnimsZoom
                        (0)=WeaponZoomIdle
                            ArmFireAnimZoom
                        (0)=WeaponZoomFire
                            ArmIdleAnimsZoom
                        (0)=WeaponZoomIdle
                            bZoomedFireMode
                        (0)=0
                            bZoomedFireMode
                        (1)=1
                            bDisplaycrosshair 
                        true;
                            
                        JumpDamping=0.1
                            MaxPitchLag
                        =40
                            MaxYawLag
                        =50
                            BaseGroundSpeed
                        =440.0
                            BaseAirSpeed
                        =440.0
                            BaseWaterSpeed
                        =220.0
                            BaseJumpZ
                        =322.0
                            AmIZoomed
                        =false
                            ZoomedRate
                        =300000.0
                            ZoomedFOVSub
                        =60.0
                            SpreadScoped
                        =0.0025
                            SpreadNoScoped
                        =0.045
                            ZoomGroundSpeed
                        =210.0
                            ZoomAirSpeed
                        =340.0
                            ZoomWaterSpeed
                        =110.0
                            ZoomJumpZ
                        =256.0

                        if it can help you i continue my research
                        thanks for all

                        Comment


                          #13
                          hard to know, I don't see anything relevant in there.

                          also curious, if you do the same thing from the video above (show collision) but in wireframe, do you see the collision of the ragdoll disappear, or just going through the ground?

                          I'll be on holidays so I won't be able to answer in the next two weeks.
                          if all else fails, try installing the starter kit into a new fresh UDK installation, test it there (should work, worked for me) and then add your custom code piece by piece and see when it breaks

                          Comment


                            #14
                            Originally posted by Chosker View Post
                            hard to know, I don't see anything relevant in there.

                            also curious, if you do the same thing from the video above (show collision) but in wireframe, do you see the collision of the ragdoll disappear, or just going through the ground?

                            I'll be on holidays so I won't be able to answer in the next two weeks.
                            if all else fails, try installing the starter kit into a new fresh UDK installation, test it there (should work, worked for me) and then add your custom code piece by piece and see when it breaks
                            in wireframe mode it's the same things but if i delete the sprint system it work

                            now i need to make another sprint system
                            have you got a tutorial for a good sprint system?

                            thanks for all

                            Comment

                            Working...
                            X