Log in to reply
 

C# SHVDN3 Follow Ped Cam CTD on load



  • What am I doing wrong with this code? Causes immediate crash to desktop at run time, no compiler errors.

     public static Ped CurrentPed { get; set; }
    
            public Basics()
            {
               
                CurrentPed = World.CreatePed("gwoman", Game.Player.Character.Position + Game.Player.Character.ForwardVector * 3.0f, Game.Player.Character.Heading + 90);
                           
                Tick += Basics_Tick;
                
            }
            
            private void Basics_Tick(object sender, EventArgs e)
            {
                if (CurrentPed.Exists()) //all peds
                {
                  Function.Call(Hash.SET_FOLLOW_PED_CAM_THIS_UPDATE, CurrentPed);
                  Function.Call(Hash.SET_FOLLOW_PED_CAM_VIEW_MODE,0);
    
                }
            }


  • SET_FOLLOW_PED_CAM_THIS_UPDATE doesn't accept a ped argument.

    Also, this may have changed in SHVDN updates, so I'm not sure if it applies anymore, but calling game functions in the constructor (public Basics() { }) is not allowed.



  • @Jitnaught thanks. You're right, i tried so many variations and i think the one i wanted is no longer supported. Surprised intellisense didn't catch that nor the compiler. This is the one I wanted.

    SET_GAMEPLAY_CAM_FOLLOW_PED_THIS_UPDATE(Ped ped)

    As for placement i tried on tick, keypress, calling from ontick, calling from other functions etc. Either nothing happened or CTD.

    Actually i dont understand your comment about game functions not allowed in basics, do you mean natives vs shvdn?

    I was successful in having the camera attached to the ped which is neat because you now experience everything from the peds point of view including fighting, driving, eating, etc but i also want to set the view mode. Im sure the function must have been replaced but ofc documentation is an afterthought with natives.

    So I was hoping to have:
    Function.Call(Hash.SET_GAMEPLAY_CAM_FOLLOW_PED_THIS_UPDATE, CurrentPed);
    Function.Call(Hash.SET_FOLLOW_PED_CAM_VIEW_MODE,0);

    For example, this is the ped's view of Michael after losing a fight with him and getting stomped in agony on the ground. This technique allows you to view the entire fight as if you were the ped, right until your death. This was done by attaching the camera to the ped (figuring out boneid vs boneindex) and then dismissing the ped so they go their own way. Incredibly cool except the point of view is hit or miss.

    alt text


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.