Quantcast

Jump to content

» «
Photo

[IV] C# Camera Chase

14 replies to this topic
stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#1

Posted 28 January 2014 - 09:01 AM Edited by stef538, 28 January 2014 - 09:02 AM.

I want to know how to create a camera chase, the kind of scene you see when pressing CAPSLOCK while driving, is there anyway to activate it ?

 

When i press R, the camera needs to focus on niko, so the model mustn't change, but i need to get control of over a ped, that is warped into a car,  and if i drive away from niko, let's say 80f then the camera needs to be get behind the car.

 

someone any idea ?


JebediahKerman
  • JebediahKerman

    Player Hater

  • Members
  • Joined: 14 Jan 2014

#2

Posted 28 January 2014 - 04:20 PM

Maybe these natives will help you, take a look at:

 

http://www.gtamoddin...PLAYER_CONTROLS

 

and

 

http://www.gtamoddin...H_CAM_TO_OBJECT


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#3

Posted 28 January 2014 - 04:59 PM

if i try the SET_PLAYER_CONTROL, i will get an error :

 

ATTEMPTED TO READ OR WRITE PROTECTED MEMORY


JebediahKerman
  • JebediahKerman

    Player Hater

  • Members
  • Joined: 14 Jan 2014

#4

Posted 28 January 2014 - 05:16 PM

First, why SET_PLAYER_CONTROL? I thought you want to set the camera.

Second, which parameters did you use?

Third there is also a ATTACH_CAM_TO_VEHICLE method


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#5

Posted 28 January 2014 - 05:23 PM

well as i said in my first post, i need to take control over a ped, that is warped into a car, I used

 

Function.Call("SET_PLAYER_CONTROL", player.character, 1);

 

& if i use function.call("SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS", 1);

 

It just doesn't work


LordOfTheBongs
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#6

Posted 28 January 2014 - 05:37 PM Edited by LordOfTheBongs, 28 January 2014 - 05:39 PM.

if i try the SET_PLAYER_CONTROL, i will get an error :

 

ATTEMPTED TO READ OR WRITE PROTECTED MEMORY

if ur using the scripthookdotnet u can just used the wrapped function...

 

Game.LocalPlayer.CanControlCharacter

 

and btw the error u describe means gta's memory is corrupted and u will need to load the game again to correct not just reloadscripts. I guess u r runnning a script that is using a native function worng and putting the wrong value types in memory... anyways to use that native u just need to give it the Player.Index or even just the Player. The scripthookdotnet knows to get the player index for native functions even if u put the player as the argument... btw stef538 u want to pass Player not the Player.Character... probably why gta memory is screwed up and u get access violations

//c++
Scripting::Player GetPlayer();
 
Player CustomFiberThread::GetPlayer()
{
Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId());
return playerIndex;
}
 
SetPlayerControl(GetPlayer(), true);
 
//c#
Game.LocalPlayer.CanControlCharacter = true;

stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#7

Posted 28 January 2014 - 05:51 PM

hmm, but i need to control a ped, not niko himself..


LordOfTheBongs
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#8

Posted 28 January 2014 - 06:01 PM

then u need to find another way. That function is used to set whether or not u can control a player... change your player model to the ped u want to control maybe


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#9

Posted 28 January 2014 - 06:30 PM

yeah but that won't work, because i still need to see the niko model


Something like this : 

 

http://youtu.be/v8h7P6_lSgI?t=1m


LordOfTheBongs
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#10

Posted 28 January 2014 - 06:52 PM Edited by LordOfTheBongs, 28 January 2014 - 06:54 PM.

yeah but that won't work, because i still need to see the niko model


Something like this : 

 

http://youtu.be/v8h7P6_lSgI?t=1m

then u need to spawn a ped and set him to the player model, there is a niko model for peds i believe. Luis and Johnny have ped models so maybe Niko does too. For example... IG_LUIS or IG_JOHNNY can be used to make a ped into one of these players... see if IG_NIKO can be used in gta iv, it says it is part of TLAD on gtamodding.com


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#11

Posted 28 January 2014 - 07:00 PM

Hmm IG_NIKO can't be used in GTA IV, Installing EFLC then, & how about the camera..


LordOfTheBongs
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#12

Posted 28 January 2014 - 08:44 PM Edited by LordOfTheBongs, 28 January 2014 - 08:46 PM.

what about the camera? if u want to control the camera... u make a new camera, then u set this new camera's properties the same as the game's camera and then u enable your camera and then u can do whatever u want with the camera

 

if u set the new camera's position and irection the same as the game camera, then when u enable it, nobody will be able to know u changed the camera, then u move it how u like... then to go back u either disable your camera or u just enable the game camera again i forget


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#13

Posted 29 January 2014 - 01:20 PM

but what are those properties, and how do i suppose to know them,


LordOfTheBongs
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#14

Posted 29 January 2014 - 03:34 PM

//create a camera somewhere named cam and when u want to enable...
cam.Position = Game.CurrentCamera.Position;
cam.Direction = Game.CurrentCamera.Direction;
cam.FOV = Game.CurrentCamera.FOV;
cam.Activate();

//after activating you now have control of the "Game" camera then when u want to go back to normal
cam.Deactivate();

stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#15

Posted 29 January 2014 - 04:57 PM Edited by stef538, 29 January 2014 - 05:41 PM.

Alright that worked (: thanks!!, but if try  

cam.Deactivate();

 it doesn't work.. 

 

#EDIT

Fixed it, by setting it in another sub (:
 

  • LordOfTheBongs likes this




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users