Need help with zooming and thirdperson.


(D- Eagle) #1

Hi.
I need help with Zooming and Thirdperson.
When player is in Thirdpeson mode, and tries to zoom with bicolaurs or sniper, it wont help player like in Firstperson mode.
So i need to do something like this:
If player is in Thirdpeson mode and starts to snipe, mode will change to Firstperson mode and when player stops sniping, mode will change back to thirdperson.
How is this done? If there is other way, you can tell me.


(D- Eagle) #2

som1? =/


(D- Eagle) #3

Is this possible? =/


(djmels) #4

Should be, I figure you’d get the point where the player starts the zoom action (holds B for bino’s by default) in the source code, then add a bit to change the 3rdperson CVAR from 3rd to 1st BEFORE the rest of the code is exec’ed, and add a bit of code AFTER all the code of the function for stopping the zoom that’ll put it back to 3rd. Do keep in mind, when the player starts to zoom, do an If statement to find out if he actually IS in 3rd person mode. Not important for the “start zoom” func, but you need to write a boolean var so you can determine the player’s OLD status (BEFORE zoom) was 3rd or 1st person mode.


(Jaquboss) #5


find in cg_view.c " cg.renderingThirdPerson = …"
replace with

cg.renderingThirdPerson = (cg_thirdPerson.integer && !(cg.predictedPlayerState.eFlags & EF_ZOOMING) || (cg.snap->ps.stats[STAT_HEALTH] <= 0) || cg.showGameView;}

and now dont say that it is hard or impossible…


(D- Eagle) #6

Hmm… Something is wrong…
I’ll give you compile log:
--------------------Configuration: cgame - Win32 Release--------------------
Compiling…
cg_view.c
C:\WET_Source\src\cgame\cg_view.c(1784) : error C2143: syntax error : missing ‘)’ before ‘;’
C:\WET_Source\src\cgame\cg_view.c(1913) : error C2059: syntax error : ‘if’
C:\WET_Source\src\cgame\cg_view.c(1920) : error C2143: syntax error : missing ‘)’ before ‘.’
C:\WET_Source\src\cgame\cg_view.c(1920) : error C2143: syntax error : missing ‘{’ before ‘.’
C:\WET_Source\src\cgame\cg_view.c(1920) : error C2059: syntax error : ‘.’
C:\WET_Source\src\cgame\cg_view.c(1920) : error C2059: syntax error : ‘)’
C:\WET_Source\src\cgame\cg_view.c(1921) : error C2059: syntax error : ‘}’
Error executing cl.exe.

cgame_mp_x86.dll - 7 error(s), 0 warning(s)

If some1 can tell me what i have to do, post plz :slight_smile:


(Jaquboss) #7

because i messed it , you should learn at least bases of C…

cg.renderingThirdPerson = (cg_thirdPerson.integer && !(cg.predictedPlayerState.eFlags & EF_ZOOMING) ) || (cg.snap->ps.stats[STAT_HEALTH] <= 0) || cg.showGameView;

this should be ok , but be serious , you should be able to find what’s wrong…


(D- Eagle) #8

Hmm… Still wont work… :S


(Jaquboss) #9

I wonder what’s wrong…


(Shanks) #10
cg.renderingThirdPerson = (cg_thirdPerson.integer && !(cg.predictedPlayerState.eFlags & EF_ZOOMING) || (cg.snap->ps.stats[STAT_HEALTH] <= 0) ) || cg.showGameView;

@jaquboss: you forgot to close a bracket set…


(D- Eagle) #11

still not… strange…


(fretn) #12

reading and understanding this first will help you a lot: http://freebooks.by.ru/view/CProgrammingLanguage/kandr.html


(D- Eagle) #13

Hmm… This works only with bicolaurs… How i make it work with sniper zoom??


(Jaquboss) #14

something same , i think that you have to add’ && cg.predictedPlayerState.weapon != WP_K43_SCOPE && cg.predictedPlayerState.weapon != WP_GARAND_SCOPE ’
I wonder if there is ‘weapon’ in predictedplayerstate , you may also try cg.snap->ps.weapon if i remmember correctly