I need little help with Third person view!


(D- Eagle) #1

I need some help with making thing for my mod:
When i press enter view will change to ThirdParty…
I can c++ some, so can someone tell me code for this?


(No1_sonuk) #2

The funcion is already there as cg_thirdperson, cg_thirdpersonangle, and cg_thirdpersonrange. You just need to bind them to the enter key and enable the cheats (or devmap).


(D- Eagle) #3

I need this to my mod and i want it to be useable without cheats enabled. Players can change the view in my mod. I want it to be like the players wont havve to bind anything, it just is when they start game…


(No1_sonuk) #4

All the functions are bound in the .cfg file in each person’s profile on the game. They’ll only need to add it once, and it’ll be remembered.
That said, you should add it to the default .cfg that the game/mod generates, but players will often copy an old cfg that they’re used to, so you need to make sure you document the fact that the cg_thirdperson commands are outside the cheat-protected zone.

As for actually doing it, you’ll need to find instances of “cg_thirdperson” and work from there.
BTW, if you’re going to do it, you should limit cg_thirdpersonrange, as this can be used as a form of cheat by setting a large range. This allows the player to see the other side of walls, etc. I think this is the reason the 3rd person view is cheat protected.


(D- Eagle) #5

“you need to make sure you document the fact that the cg_thirdperson commands are outside the cheat-protected zone.”
How i make this? =/


(No1_sonuk) #6

In the desription of what your mod does, add that the third person view is available with cheat protection enabled.


(D- Eagle) #7

what if i want this thing be like this: With thopson view will be third person, range 100, with pistol range 60 and with knife default view?


(D- Eagle) #8

Isn’t there way to make those things with c++? :frowning:


(No1_sonuk) #9

I suppose you could, but I’m not a coder…


(D- Eagle) #10

Okay… Now i just have to wait for answer…


(SCDS_reyalP) #11

Well, I would start by searching the code (using something like grep) for cg_thridperson…


(D- Eagle) #12

I cant find cg_thridperson anywhere…


(No1_sonuk) #13

He misspelled cg_thirdperson.


(SCDS_reyalP) #14

grep -i cg_thirdperson src/cgame/*


src/cgame/cg_flamethrower.c:	if( cent->currentState.number != cg.snap->ps.clientNum || cg_thirdPerson.integer ) {
src/cgame/cg_flamethrower.c:														f->size * (f->ignitionOnly /*&& (cg.snap->ps.clientNum != f->ownerCent || cg_thirdPerson.integer)*/ ? 2.0 : 1.0),
src/cgame/cg_info.c:				trap_Cvar_Set("cg_thirdperson", ((cg_thirdPerson.integer == 0) ? "1" : "0"));
src/cgame/cg_info.c:				float range = cg_thirdPersonRange.value;
src/cgame/cg_info.c:				trap_Cvar_Set("cg_thirdPersonRange", va("%f", range));
src/cgame/cg_info.c:				float range = cg_thirdPersonRange.value;
src/cgame/cg_info.c:				trap_Cvar_Set("cg_thirdPersonRange", va("%f", range));
src/cgame/cg_info.c:				float angle = cg_thirdPersonAngle.value - DEMO_ANGLEDELTA;
src/cgame/cg_info.c:				trap_Cvar_Set("cg_thirdPersonAngle", va("%f", angle));
src/cgame/cg_info.c:				float angle = cg_thirdPersonAngle.value + DEMO_ANGLEDELTA;
src/cgame/cg_info.c:				trap_Cvar_Set("cg_thirdPersonAngle", va("%f", angle));
src/cgame/cg_local.h:extern	vmCvar_t		cg_thirdPersonRange;
src/cgame/cg_local.h:extern	vmCvar_t		cg_thirdPersonAngle;
src/cgame/cg_local.h:extern	vmCvar_t		cg_thirdPerson;
src/cgame/cg_main.c:vmCvar_t	cg_thirdPerson;
src/cgame/cg_main.c:vmCvar_t	cg_thirdPersonRange;
src/cgame/cg_main.c:vmCvar_t	cg_thirdPersonAngle;
src/cgame/cg_main.c:	{ &cg_thirdPersonRange, "cg_thirdPersonRange", "80", CVAR_CHEAT }, // JPW NERVE per atvi req
src/cgame/cg_main.c:	{ &cg_thirdPersonAngle, "cg_thirdPersonAngle", "0", CVAR_CHEAT },
src/cgame/cg_main.c:	{ &cg_thirdPerson, "cg_thirdPerson", "0", CVAR_CHEAT }, // JPW NERVE per atvi req
src/cgame/cg_servercmds.c:	trap_Cvar_Set("cg_thirdPerson", "0");
src/cgame/cg_view.c:	if( cg_thirdPerson.integer == 2 )
src/cgame/cg_view.c:	forwardScale = cos( cg_thirdPersonAngle.value / 180 * M_PI );
src/cgame/cg_view.c:	sideScale = sin( cg_thirdPersonAngle.value / 180 * M_PI );
src/cgame/cg_view.c:	VectorMA( view, -cg_thirdPersonRange.value * forwardScale, forward, view );
src/cgame/cg_view.c:	VectorMA( view, -cg_thirdPersonRange.value * sideScale, right, view );
src/cgame/cg_view.c:	cg.refdefViewAngles[YAW] -= cg_thirdPersonAngle.value;
src/cgame/cg_view.c:		cg.renderingThirdPerson = cg_thirdPerson.integer || (cg.snap->ps.stats[STAT_HEALTH] <= 0) || cg.showGameView;

:moo:


(D- Eagle) #15

How i make cg_thirdperson dont need cheats enabled?


(SCDS_reyalP) #16
src/cgame/cg_main.c:   { &cg_thirdPerson, "cg_thirdPerson", "0", CVAR_CHEAT }, // JPW NERVE per atvi req

But there is a slight problem, punkbuster has hard coded checks for cg_thirdperson. So really, you’d have to make your own cvar that did the same thing or something like that.


(D- Eagle) #17

So… Help is to how do that is welcome!


(fretn) #18

rename the cvar or something