I haven't seen a tutorial in writing form (don't worry Counter Life, i haven't forgotten your video tutorial) for how to set up ironsights correctly, so i'll give it a try.
Note: For this tutorial you will need the "ironsight_cfg" wich should come with SMOD, just saying this in case you already know you don't have that.
What you will find here:1. General knowledge and how to start
2. "ironsight_cfg" and you
3. Changing viewmodel (with "ironsight_cfg")
4. Setting up ironsights and fine tuning1. General knowledge and how to start.
Okay, so first off, choose a gun you want to set up the viewmodel and ironsights for.
I'll go with the SMOD: Tacticals default FiveseveN.
Let's say your ironsights and viewmodel are effd up, so now we will reset them to original in the script, that means we go from this:
Pretty easy stuff i know.
Now your gun will use the default CS: S origins.
Alright, here comes the funny part, we NEED to set up the default viewmodel, aka. the hipfire origin FIRST since the ironsight will be based on how this viewmodel is set.
For this we will use the script luckily coming together with SMOD (as far as i know), the "ironsite_cfg".
To use it we just have to open the console and type in "exec ironsite_cfg".
Now your console should show you this:2. "ironsight_cfg" and you.
Okay, so this part is for when you have enabled the script.
As i said, enable "ironsight_cfg" with typing "exec ironsight_cfg" in the console or disable it with "exec ironsight_cfg_off".
Ingame you should be able to move the guns origin with the numpad.
8 for up slightly, 2 for down slightly, 4 for left, 6 for right, 7 for left slightly, 9 for right slightly, 1 to move yaw to the left, 3 to move yaw to the right, - to move the gun away, + to move the gun towards you,* (should look like an x on most keybords) to move the pitch up, "," (under 3) to move the pitch down, also we have the two keys on the left of the num button, picture up for rotation to the right and picture down for rotation to the left. After you are done press 5 to see the coordinates for the position you choose for the viewmodel or ironsight.
What you will notice is that on the upper left and in the console, there are showen what values are changed to what number, nothing you have to care about right now (But it will be very usefull for later).
You might have to try around a bit but you should get the hang of it soon. 3. Changing viewmodel (with "ironsight_cfg")
After you know how to controll the script, have some fun and move the gun around until you have the position that you like.
For example i moved it in the middle and a bit further away from me.
For the viewmodel you shouln't need fine tuning, but it can be used here too, just so you know (more on fine tuning in chapter 4).
Now if you are finished you have to press 5 on the numpad to have the ironsight script show you the coordinates for this viewmodel position.
They should look something like this:
As you can see, there are value names on the left and the values we need on the right (example: Right "viewmodel_r" = "2.710000").
If you look in your script you should see those value names with values too, just that all of them are set to 0.
Now copy the values from the console and use them to replace those in the script under the categorie "Adjust", if a value isn't in the script and has a value of 0 or -0 in the console you can skip these, but if they are in the script but have a value of 0 in the console and you have something else then 0 in the script, replace.
(example: instead of "right" "0", we will have "right" "2.710000" or instead of "right" "0.12345", we will have "right" "0.00000")
After you are finished your script should look like this:
If you are sure you did everything right, test it ingame by saving the weapon script, turning off "ironsight_cfg" by using "ironsight_cfg_off" and reloading the map (try "reload" in the console).
New viewmodel looks good? Okay, lets carry on!4. Setting up ironsights and fine tuning
First things first, reenable your best friend "ironsight_cfg".
Now, do it just the way you did it with the viewmodel, but this time try lining up the ironsights, the hl2 default crosshair should help you a lot.
And do NOT right click to enable ingame ironsights in "ironsights_cfg", use the hip-fire mode.
Don't worry if you don't manage to line em' up perfectly, just try to get the ironsights lined up roughly.
If you think "close enough, but still not right", you need fine tuning!
Now you might ask me what fine tuning is. Well, simple: The "ironsight_cfg" won't be able to do work on small levels, here comes the console in play and what i call "fine tuning".
Let's say your ironsights are too far on the right of the default hl2 crosshair and you need to move them to the left. Move the gun to the left and the console will show you what values are in play and to what number they are changed, for example: currently we have Yaw "viewmodel_y" = 0.00000 *move to the right* "viewmodel_y" = 0.20000, that means "0.20000" will be addet to "viewmodel_y" if we move the gun to the right, this also means that "0.20000" will be taken away from "viewmodel_y" if we move the gun to the left.
Now if you want to fine tune, change the value manualy with the console.
For example, we need to move the yaw just half of what is normal for the "ironsight_cfg" to the left.
Currently yaw is set to "0.20000", and the yaws normal move level should be from "0.00000" to "0.20000" so we type in the console "viewmodel_y 0.30000" (the value we should have if we add the half of what is normal), and the guns origin should already move without you having to close the menu.
Or do you need it even finer?
Instead of adding 0.20000, try adding 0.04000.
Play around with this tactic an set up the ironsights correctly.
If they are set up correctly, press 5 on your numpad to have the console show you the coordinates for this position, now replace the coordinates in your script under "IronSight" (wich should still all be on 0) with the fresh ones you got from the console.
Now your script should look something like this:
After you are done with that, safe the script, disable "ironsight_cfg" with "ironsight_cfg_off" and reload the map (try "reload" in the console).
Now everything should work, Good job!
If you still have questions, have problems with the tutorial or just want to say something on-topic, don't hold back on writing a reply to this post or sending me a privat message.
Also i hope the pictures helped at least a little bit.
Note: Mods, if possible, please correct grammatical mistakes in this tutorial, i tried to keep them to a minimum, but i'm sure there are still a few of them here, after you are done, remove this note. Thank you :3