It's pretty simple, as long as you know how to create a custom ingame.lvl which is outlined HERE.
The added entry in data_MODID\Common\ingame.req is like this:
Code: Select all
REQN
{
"config"
"1playerhud"
}
Code: Select all
ucft
{
REQN
{
"config"
"1playerhud"
}
}
I made the ironsights by adding a second weapon icon, like the ones in the lower left corner, or "floating" if they are new weapons, but the positioning has to be in the right spot for ironsights, and it has to display them at pretty much the opposite times that the actual weapon icons are shown.
The file 1playerhud.hud is located in data_MODID\Common\hud\PC. This is the file usually edited for making custom huds. I think you could rename it to something else if you want to keep separate hud files, just list the names of the hud files you need in the ingame.req under config.
Here is my 1playerhud.hud:
The first part, "FileInfo", I don't really know what it does, but I don't think it hurts...
The rest is a modification of part of the original hud which I deleted.
The first and outermost "Group" has EventEnable and EventDisable codes that turn this HUD element off when you die or enter a CP. Otherwise ironsights will appear when either of those happen.
I dont know if the inner group is needed, it was like this in the original, so I left it.
The "Model3D" section has 2 more events, these are simply reversed from the original, which hides the weapon icons when zooming in with a scope, so now the new set of icons will appear when zooming as long as the weapon uses a scope.
To add a weapon to the Model3d, copy one of the "MeshInfo" Blocks and change the name to the name of the weapon's .msh. Then test it ingame, if it needs to be moved down, try adding 0.05 to the middle Position number, or subtracting if it is too low. If a weapon is exceptionally long or tall, the first rotation parameter can be changed to rotate the weapon. Use a negative angle to aim down.
If you don't add a meshinfo block for a weapon, an icon will 'float' in the upper left corner of the screen, so add a meshinfo to move it offscreen. Moving the weapon to the left should work:
Code: Select all
Position(-0.500000, 0.000000, 0.000000, "Viewport")
Munge with only Common checked.
After munging, the ingame.lvl will have to be copied from data_MODID\_LVL_PC to your mod's addon folder: gamedata\addon\MODID\data\_LVL_PC\