Announcement

Collapse
No announcement yet.

Add rangefinder to weapons?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add rangefinder to weapons?

    ive been trying to do this for a while, and its probly somthing really simple,but how would i add a rangefinder to a gun like the m24 or m95?
    also, if this helps, i have version 1.00 and i dont care about playing online.

  • #2
    hello just add:

    ObjectTemplate.weaponHud.hasRangeFinder 1

    to the WeaponHud section of the tweak file

    Comment


    • #3
      i tried that, but it didnt work, the game didnt crash, but nothing happened

      Comment


      • #4
        Ok, first things first. Before you make any changes to any file listed here PLEASE MAKE A BACKUP IN CASE SOMETHING GOES WRONG. All credit for this tweak goes to "SatNav" over at http://battlefieldsingleplayer.plane...spy.com/forums

        Follow these instructions step by step to add a rangefinder to your sniper rifle.

        Goto Program Files\EA GAMES\Battlefield 2\mods\BF2 and look for Menu_server.zip then open it up. Next, open up HUD\HudSetup\Weapons and find HudElementsGenericWeapon.con (drag HudElementsGenericWeapon.con to desktop and then open with notepad) and copy and paste this to the bottom of the file.

        rem -------- range to target ------
        hudBuilder.createPictureNode GenericWeaponHud RangeText 130 465 128 16
        hudBuilder.setPictureNodeTexture Ingame\Vehicles\Icons\Hud\Land\M6Linebacker\range_ toTarget_text.tga
        hudBuilder.setNodeColor 0 0.8 0 1

        hudBuilder.createTextNode GenericWeaponHud RangeLabel 255 467 101 10
        hudBuilder.setTextNodeStyle Fonts/vehicleHudFont_6.dif 2
        hudBuilder.setTextNodeStringVariable TargetDistanceString
        hudBuilder.setNodeColor 0 0.8 0 1

        Then open the sniper rifle tweak file. example, the usrif_m24.tweak in Objects_server_patch.zip\Weapons\Handheld\usrif_m2 4\ and paste this under the 'ObjectTemplate.createComponent WeaponHud' template.

        ObjectTemplate.weaponHud.hasRangeFinder 1

        so the template should now look like this.

        rem ---BeginComp:WeaponHud ---
        ObjectTemplate.createComponent WeaponHud
        ObjectTemplate.weaponHud.weaponIcon Ingame\Weapons\Icons\Hud\USRIF_M24.tga
        ObjectTemplate.weaponHud.altWeaponIcon Ingame\Weapons\Icons\Hud\USRIF_M24_mini.tga
        ObjectTemplate.weaponHud.selectIcon Ingame\Weapons\Icons\Hud\Selection\USRIF_M24.tga
        ObjectTemplate.weaponHud.hudName "KILLMESSAGE_WEAPON_m24"
        ObjectTemplate.weaponHud.guiIndex 0
        ObjectTemplate.weaponHud.altGuiIndex 52
        ObjectTemplate.weaponHud.hasRangeFinder 1
        rem ---EndComp ---

        You should now get a working range finder when you zoom in on the sniper rifle.

        As a side note and side effect of doing this is every weapon will have a rangefinder but, not the distance displayed. Only the sniper rifle will have the range displayed. To fix this you would need to make a custom hud with a custom hud number if you only want it for 1 weapon. Copy the GenericWeapon hud code and rename it and give it a new number.

        I did not do a custom hud myself so if you need help with this or have questions about it go here and ask in the original post. Thanks. http://battlefieldsingleplayer.plane...showtopic=5506

        Comment


        • #5
          Thanks for the question and replies, but i want to show my edit.

          There is no need for the PictureNode. I changed the color to yellow, and placed it at the bottom of the screen centered. I havent looked into putting it on only one or two weapons for i dont care about the numbers with other weapons, cause they dont get in the way. Anyway, in the HudElementsGenericWeapon.con paste this at the bottom of the file:

          rem -------- range to target ------
          hudBuilder.createTextNode GenericWeaponHud RangeLabel 390 570 100 20
          hudBuilder.setTextNodeStyle Fonts/vehicleHudFont_6.dif 2
          hudBuilder.setTextNodeStringVariable TargetDistanceString
          hudBuilder.setNodeColor 255 255 0 1

          Also!!! Paste this in the HudElementsM16m203.con:

          rem -------- range to target ------
          hudBuilder.createTextNode M203Hud M203RangeLabel 389.5 365 100 20
          hudBuilder.setTextNodeStyle Fonts/vehicleHudFont_6.dif 2
          hudBuilder.setTextNodeStringVariable TargetDistanceString
          hudBuilder.setNodeColor 255 255 0 1

          I put it underneath the crosshairs.

          (ENJOY)

          Comment


          • #6
            Thanks, im gonna go try that now

            cool, it works!! Thanks guys.

            Comment

            Working...
            X