Talk:Adding Ironsights

From Valve Developer Community
Revision as of 08:59, 22 September 2008 by Z33ky (talk | contribs) (since you don't want a new page, remove my message)
Jump to navigation Jump to search

Z33ky, i followed it and it come up with doezen's of errors :( Probably because my lack of C++ expert :( Could you possibly add line numbers to each section of code? Because some parts im unsure of, so i end up adding in the wrong parts and generate a million errors. Please, add line numbers for all parts :) --Craziestdan 08:46, 14 Sep 2008 (PDT)

Could someone please add line numbers for this tutorial please?? --Craziestdan 17:32, 15 Sep 2008 (PDT)
The reason I won't add lines is, that I don't want newbies to just copy&paste that code, but understand what they are doing. Also, the lines will be wrong if there is a code-update or you already modified one of the files. You should be able to do this with knowledge of C++ and basic Source-knowledge --z33ky
Hey z33ky, the tutorial works great and I'd like to thank you so much for putting this up. One problem is the console commands do not work ingame, they have no effect.--JLea 21:27, 19 Sep 2008 (PDT)
You need to set viewmodel_adjust_enabled 1 and for that you need sv_cheats to be 1, too. --z33ky 01:28, 20 Sep 2008 (PDT)

EDIT: And you have to make viewmodel_adjust_fov to a ConCommand, changing the fov if viewmodel_adjust_enables is 1.

I'm not that stupid :P. Even if sv_cheats are 1 and viewmodel_Adjust_Enabled is 1 it doesn't do anything. Acutally if adjust_enabled is set to 1, pressing the ironsights button has no effect even if I type new values in. --JLea 02:15, 21 Sep 2008 (PDT)
I'm not sure what's the problem then - I guess you'll have to debug your way through. --z33ky 05:17, 21 Sep 2008 (PDT)

The other tutorial was harder to follow, but it worked for me... This one just gave me tons and tons of errors. I have some knowledge in programming in C, and I have made a few mods for hl2 before. I'm pretty sure I followed every step correctly.

The errors tell me there are undeclared identifiers for several variables, and when I look through your code, I can't find any part where you declare some of them, such as "m_bIsIronsighted"... Am I supposed to do some of the coding work myself? I thought this was just an easy copy and paste tutorial :(

EDIT: I also noticed there are some spelling errors, such as m_bIsIronsighted is spelled incorrectly as m_bIsIronighted and "position" is sometimes spelled as "positon"... correcting these spelling errors has reduced the amount of errors for me, i'm still looking through the code. I'm just curious, has anyone tested this and got the same results as the other tutorial?

EDIT: after correcting several spelling errors, i finally got it to compile... but in game when i toggle ironsights, it does nothing!.. I modified some of the code and I managed to get it to go in and out of ironsight aiming, but it can never stay! It just makes the gun go into ironsight position for a second and then immediately goes out. --Johnmagicson 22:09, 21 Sep 2008 (PDT)