Jump to content

gmJamez

Member
  • Content Count

    18
  • Joined

  • Last visited

  • Medals

Everything posted by gmJamez

  1. Hi, I've created a little addon that allows for windage and elevation adjustments. [*] Just 'install' the addon and it's active within every game. [*] Adjust windage by using the left and right cursor keys, elevation by using the up and down cursor keys (= default configuration). The key assignments can be configured by editing a file - explanation below. [*] Current windage and elevation settings are stored by unit and by weapon, ie. if you switch to another unit, different settings can be used for each weapon ever used by this unit within a mission. [*] Adjustments can be stored as range cards to files within the mod's directory and viewed ingame. [*] Only works for primary weapons and only for a weapons first muzzle (both by design), ie. when using e.g. M4GL the mod will only affect the 5.56 rounds, not the grenades. [*] The following parameters can be configured for each weapon by changing the weapon classes: - Use mils or MOA as adjustment unit. - Adjustment steps. - Adjustment limits. - Disable any adjustments. This allows other modders to create weapons that behave differently than others when used with the SightAdjustment mod (see config.cpp). caveats: [*] The mil-dot size of the ArmA weapons does not match those used by this addon. [*] It overrides defined actions for the cursor key, ie. whatever command you assigned to those keys won't get executed - you can configure the mod to use different keys though. [*] I wanted to enable the windage and elevation configuration mode only when in optics-mode, but unfortunately I found no way of detecting when it is enabled. A brief explanation on how to use mils can be found at the end of this post. Feedback and help with the current issues is quite welcome regards, Oliver. download here (v0.3). 0.4beta M107, range 700m, elevation +12.25 MOA: Create your own range card: Sample range card for an M4SPR: key configuration The key assignments can be configured by editing the file "GMJ_SightAdjustment\scripts\SightAdjustmentConfig.h". To do that, you have to unpbo the mod, edit the file and pbo it once again. Two setups are already included - using the cursor keys and using WASD. If you want a different set up use the key values found here: http://community.bistudio.com/wiki/displaySetEventHandler Simply comment lines by adding // at the beginning. Commented lines will be ignored by the game. e.g. #define GMJ_SA_KEY_Einc 200 // increase elevation adjustment #define GMJ_SA_KEY_Edec 208 // decrease elevation adjustment #define GMJ_SA_KEY_Winc 205 // increase windage adjustment #define GMJ_SA_KEY_Wdec 203 // decrease windage adjustment range card configuration The range cards are stored within the mod's directory. Unfortunately I can't determine the mod's directory or read the files by using relative paths, so the mod assumes that the range card files are found here "your ArmA directory\@GMJ_SightAdjustment\Addons". If you want to store them somewhere else, change the following line within SightAdjustmentConfig.h: #define GMJ_SA_RANGECARDPATH "@GMJ_SightAdjustment\Addons" To create your custom range card: 1) Aim at a target and adjust the elevation until the rounds hit exactly where you aim at. 2) Select the "New" link within the range card. 3) Enter the distance into the edit control next to the "enter distance:" line. 4) Select the "New" link within the range card and push the "add" button. Your current configuration will be added to the range card. 5) Repeat steps 1-4 for all distances you wish to show on the range card. 6) Select the entire text within the text control below the "copy range card data here:" line and copy the text to your clipboard. 7) Create a new text file within the directory where the range cards are stored (default "your ArmA directory\@GMJ_SightAdjustment\Addons"). 8) Paste the text and save the file as "rangecard_XXX.txt" where XXX can be anything you choose (for example indicate the gun, ammo, ...). e.g. for an M24 range card you could save it as: rangecard_M24.txt 9) Open the file "rangecard_list.txt" within the directory where the range cards are stored (default "your ArmA directory\@GMJ_SightAdjustment\Addons") and add... , "XXX" ... at the end without adding new lines. XXX is of course whatever you chose when saving the file just before. 10) Within the range card push the "reload" button - the new range card can be selected (no need to restart the game). weapon configuration The weapons can be configured by changing a few parameters within the weapon's class by editing the file "config.cpp" of this mod ("GMJ_SightAdjustment\config.cpp") or any other mod. To do that, you have to unpbo the mod, edit the file and pbo it once again. Two setups are included - using mil mode (= mil dots) and MOA mode (= minute of angle). [*] Enable/disable adjustments by changing the GMJ_SA_enabled parameter. Adjustments will be enabled if it equals 1 and disabled for any other values or if the parameter is missing. e.g. GMJ_SA_enabled = 1; [*] Switch between mil and MOA mode by changing the GMJ_SA_mode parameter. Supported values are "MIL" and "MOA". e.g. GMJ_SA_mode = "MOA"; [*] Set minimum and maximum value of windage/elevation adjustments by changing the GMJ_SA_adjrange array. Values are in degrees. Due to rounding errors you need to set them a tiny bit beyond the desired limit. GMJ_SA_adjrange[] = { 2.33335, 1.66667 }; -> sight will adjust from elevation -1.166675° to 1.166675° and windage -0.833335° to 0.833335° [*] Set the adjustment steps by changing the GMJ_SA_adj array. Values are in degrees. e.g. GMJ_SA_adj[] = { 0.00416667, 0.00833333 }; -> sight will be adjusted by 0.001° for elevation and 0.00833333° for windage whish list [*] Enable adjustments only when using optics/sights. [*] Demo mission. things to check/fix [*] XAM incompatibility version history 0.4beta - 05.08.2007 - Added range card (to samples are included - M24 and M4SPR). 0.3 - 29.07.2007 - Fixed elevation/windage calculation (thank you NonWonderDog). - Fixed clicking sound even when adjustment limit has been reached. - Weapon configuration is read from weapon class (mode, adjustment range, adjustment steps and enabled flag). - Removed mode and adjustment range definition from SightAdjustmentConfig.h. - Added muzzle class to weapon config to enable check for e.g. grenade launcher usage. - Added enabled flag which allows for disabling the mod for certain weapons. - Added debug mode by defining GMJ_SA_DEBUG as true which disables dispersion effects. 0.2 - 18.07.2007 - Added MOA mode. - Adjustments are as of now stored by unit and by weapon, ie. each unit can have different settings for each weapon ever used within a mission. - Since setDir is apparently not mp compatible -> added setPos to fired event handler, which should sync the adjustments during mp games. - Moved the definition for the keys used when adjusting windage/elevation to config file. - Added upper and lower limit of windage/elevation adjustments. - Reduced number of global variables to one (GMJ_SA). - Added registered tag GMJ to addon, variables, etc. - Cleaned up config.cpp. 0.1 - 14.07.2007 - Original release. thanks NonWonderDog, sickboy, Maximus-Sniper And everyone who posted this addon on his site! <span style='font-size:9pt;line-height:100%'>How to use mil-dot reticles</span>. Either read this article on snipercountry.com or use these approximations (best do both though): 1 mil = 1m@1000m or for our imperial friends... 1 mil = 3.6in@100yd When using mil-dots it really helps to think in metric units. Examples: - So let's say you know that your shots hit about half a meter low at a distance of 500m. Easiest way to get the mil-adjustment is to think "0.5m / 0.5km" -> set elevation to 1mil. - Your shots hit 0.3m low at 600m? Think "0.3m / 0.6km" -> set elevation to 0.5mil. - On to a more complicated example: Let's say you wish to adjust windage for a vehicle moving in a perpendicular direction to you at about 50km/h and the distance is 300m. First of all keep in mind that 100km/h = 27.7˙m/s, so 50km/h equals roughly 14m/s. We're shooting a 7.62 NATO round so v0 ought to be about 840m/s with an m24 -> it will take the round about 0.35s to reach the target. During those 0.35s the vehicle will have moved about 5m (0.35s * 14m/s). To get the mil adjustment think "5m / 0.3km" -> set windage to about +/-17mil (+ or - depending on whether the vehicle moves from left to right or vice versa). This approximation should be good enough to get a good second hit probability. Want a first hit? Bring a calculator or a range card
  2. Hi again, just a few comments/tips: - First of all thanks for the offer to get me a graphics card - much appreciated It's not a money issue though... - Don't put the pbo into ArmA's Addon directory but instead either always keep the directory structure as it is within the zip file or put the files wherever you like and adjust the paths within SightAdjustmentConfig.h and possibly also within config.cpp (if you don't you'll get errors like sound file not found, file too short,...). Best just keep it as it is within the zip - If the supplied keycodes don't work for you or you wish to use different ones -> see page 12 of this thread for an explanation on how to get this mod to report the codes for every key pressed. - Regarding the "mind of it's own" feature Are you sure you got only one copy of the mod installed? It sure sounds like there's two instances running... eg. don't install the standalone version of the SighAdjustment mod if it's already included within another one. regards, Oliver.
  3. Hi all, in case you were wondering why there haven't been any updates anymore: I fried my graphics card - a 8800 GTS - and used the current situation of not having a decent graphics card to quit gaming altogether. To all modders, you may use this code in any way you want - go crazy Also, many thanks to Solus for the extended init handler! greets, Oliver.
  4. I've added the version 0.4beta to the first post - now featuring an ingame range card Two sample range cards (M24, M4SPR) are included, however keep in mind that the setup will vary depending on the kind of mods you've loaded. An explanation on how to create your own range card can be found within the first post as well (no modding skills required - all you need is notepad). Also, since 0.3beta seems to work well, it's linked as latest stable version. Enjoy! PS: Unfortunately I've had no luck with the XAM incompatibility yet - it seems the init function just isn't being called
  5. Preview of the range card: The data is loaded dynamically, ie. it's loaded from files outside of the pbo, so the data can be edited easily (all you need is notepad) and will be reloaded even without restarting the game.
  6. First of all - you're using an outdated version of this mod. Secondly - it seems you're trying to switch to a WASD layout. If so, get the latest version and change the key-configuration within "SightAdjustmentConfig.h". If the provided keycodes don't work, just uncomment the line... //player sideChat (format ["%1, %2, %3, %4", _v0, _key, _v2, _v3]); ... within "SightAdjustmentOnKeyDown.sqf", build the pbo, run the game and you'll see a message for every key pressed, including the number assigned to it (second parameter). Once you got your keycodes, you can comment the line above once again and change the lines within "SightAdjustmentConfig.h" according to the keycodes you got using your keyboard.
  7. The next version will include a range card that'll show you the proper adjustments for certain ranges. However I won't add the necessary code to load these settings automatically. As I've said before - I'll provide the tools to set up good shots but it needs to be a challenge still. That challenge will be, that you'll at least need to look up the values on your range card and dial them in manually. Regarding the incompatibility with XAM - I'm already looking into that. Seems odd that it doesn't work though...
  8. I've added a link to a new version to the first post - 0.3beta. It's considered beta mainly because the ingame-range card feature is about halfway done and I'd like to include that into 0.3 later on. enjoy
  9. Right, seems to be initSpeed... Btw. since reading the config.cpp values is possible, modders could also add parameters like sightadjustment[] = { 140, 100 }; where min windage would be -140/2, max windage 140/2, min elevation -100/2 and max elevation 100/2 into the config.cpp. Or add a sightadjustmentMode = "MOA" to override the mode for a certain weapon or add sightadjustmentAdj[] = { 0.5, 0.25 }; where the adjustment applied by the script would be 1/2 MOA/mil for windage and 0.25 MOA/mil for elevation. Think this is goin' to the wishlist
  10. I just remembered a function I found a while ago while reading the COMREF, tried it out just now and it's a promising one. It's possible to read class values from within scripts, so e.g. I can get the players weapon and then query the config.cpp to answer to "is it scoped" question: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">getNumber (configFile >> "cfgWeapons" >> (primaryWeapon player) >> "optics") returns 1 for guns with optics, 0 for those without. I can also get the scope used... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">getText (configFile >> "cfgWeapons" >> (primaryWeapon player) >> "modelOptics") ... which returns e.g. "\ca\weapons\optika_sniperw" for an M24. It's also possible to get the speed of the ammo used... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">getNumber (configFile >> "cfgAmmo" >> "B_762x54_Ball" >> "typicalSpeed") returns 900. All of this should for example allow for selection of MOA/mil settings based on some very general assumption and lot's of other stuff
  11. next release should fix the windage adjustment and then there's mp and vehicle behavior to check. Once that's done, it's functionally complete in the sense that it does what's promised. Of course, after that's done, there's the wishlist to implement of which I really want the range card to work so that sniper missions can be prepared for properly Alright, off to work...
  12. primaryWeapon returns the vehicles primary weapon, regardless of whether that weapon is currently in use or not. So even while you run around with your handgun, primaryWeapon will always return your main gun. Oh ffs! How could this go unnoticed so far? I restarted some of the missions I used for testing an lo and behold, they start with the player facing north... unbelievable... Fix will be included in next release - thanks NonWonderDog! This was a good one to find The problem is that, if i switch to the enemy side, i still got the Sight Adjustment. So i have to remake something that "_This Call or exec ...\SightAdjustmentInit.sqf" The script "SightAdjustmentInit.sqf" only initializes the mod, the functions that control the adjustments are attached to the player by the script "SightAdjustmentLoop.sqf" which checks every 0.25s whether the player or weapons have changed. So all changes must be made within the loop and not the config.cpp. If you want to the script to become active only for one side, you could do something like this: 1) Within the loop, catch the first time a unit is added to the unitlist and store it's side somewhere. 2) Whenever the script detects a unit-change, determine the side of the current player and allow the script to attach only when the side of the current player matches the side of the original player. Hmm. This means that a) we really need a range card feature soon and b) it can only be shared amongst users of the same gun with the same zoom... Can't image how this mod should correct that behavior... That number "100" it's mean 100 yards, correct? Well...ArmA don't operate in yards, so that should be around 91.44 meters.(or 109.36 yards for 100 meters) Nope, this is done just for rounding purposes Mulitply with a number 100 too big, round and finally divide by 100 to scale it back to the correct value. Could be that this also alerts the guys since it probably activates the "someone's shootin at me" trigger... LOL, I've been trying the same method yesterday It's a troubled approach though, since the values all vary during animations. The assumptions regarding the static values for weapons-on-back hold true only while the unit isn't moving. It might be possible though to fix it still though... I'm guessing the unit movement is added to the weapon's direction and it might be possible to subtract it to get the weapons relative direction to the unit. I also tried the animDone event handler - looks promising although I bet just watching for the switch-weapon anim won't suffice and there will be countless exceptions to take care of... Next release with a couple of bugfixes (including the big one ) will happen later today or tomorrow...
  13. Correct, this is exactly what the script uses - a "fired" event handler where I can get the weapon and ammo used. However I'd like to know whether the player is actually using the scope, so that the e.g. cursor keys would only work if I'm actually looking through the scope or down the sights. Bloody hell - that's what happens when you test a script with the sound turned off Fixed in next version (had to code it differently though, since otherwise the event handler would pass the key back to the game once the adjustment limits have been reached and the player would suddenly start moving... now we don't want to move once we've set up or shot, right? ) Regarding the adjustment limits: The idea was, that a max elevation would set the max e. to e.g. 70mil when in mil-mode and to 70MOA when in MOA-mode, not to 70°. And regarding mil/MOA and conversion to deg: Yup, the code isn't quite right... will work on that after work. PS: This is turning into some nice teamwork
  14. I've just uploaded a new version with quite a few improvements. See the first post for a list of what changed. @Maximus-Sniper: The max/min values are now set to 70 and can be changed without editing the scripts but by simply changing the values in the config file
  15. Unfortunately no. All that's contained within _this passed by the init event handler is the unit itself and no weapons. Furthermore the primaryWeapon command always returns the primary weapon, regardless of whether the unit has selected it or not. Same goes for the weapons command which contains all weapons attached to the unit but no indicator of which one it's currently using. Heck, even the fired event handler passes only a string with the weapon name and no reference to the actual weapon object. Pretty unbelievable that this isn't possible and unfortunately not the only shortcoming of the ofp/arma engine... By the way, I've rewritten quite a large portion of the code to enable the detection of primary-weapon switches so that the adjustments set for a rifle won't be used once the player switches to e.g. a SAW. Unfortunately it's a bit buggy yet and I have to leave for a couple of days, so the next release will probably happen late next week or more likely (work's crazy right now) next weekend.
  16. Not sure I understand... When you adjust for bullet rise/drop you need to aim lower/higher. Depending on the distance to your target, that'll translate into a certain amount of meters/yards/whatever above or below the point you actually wish to hit. Suppose the script adjusted for "+1m elevation" - at a distance of 100m, that's 0.57° above your target, but at 1000m it's only 0.057°. Since the script can't possibly know what your trying to hit it can't possibly know the distance either and wouldn't know where to send those bullets... Both mil and MOA are angular measurements, not distance.
  17. <span style='font-size:8pt;line-height:100%'>Hi, thank you all for your feedback! I'll probably release a new version later today with most of the suggested improvements. @sickboy Excellent comments and tips - thanks! Done. I remember to have gotten an error message at some point (... class not defined...) and being a c++ guy I immediately thought, well that makes sense and added the Land class as well Good idea and done. Finding a units weapons is not a problem - it's finding out which weapon the unit is currently using that seems impossible! At least until it starts firing, but by then it's too late... I'd need to know the selected weapon to store the adjustment accordingly. Imagine holding a rifle and adjusting (configuration should be stored for that weapon) and then switching to your LAW launcher and adjusting again, but for a different situation. Unless I know the selected weapon, this can't be done, since the script has no way of knowing for which weapon the configuration should be stored. However I'm hopeful still: Since switching weapons is done via animations, it might be possible that an AnimDone event handler could catch those weapon switches... Also originally I wanted to save the adjustments for each weapon within the game so that I could pick up an M24, zero it, pick up another M24 which ought to result in this particulars M24 settings to be loaded, adjust this one and finally pick up the original M24 and again have this particular M24's settings loaded. Would have been really fun for multiplayer games... Oh, didn't know about that one. I did of course plan on combining those global variables into one global array that holds all mod-relevant data, but only once the scripts are beyond beta status, since the code get a good bit less readable. Due to the savegame bug -> working on it. Will probably be done today. @NonWonderDog: Great research, really well done! Hmm, that's odd - I had tested it using Kronzky's target range and got a reading of about 10mil for one of those red targets at 100m. Since I estimated it to be rougly one meter high the 10mil reading seemed to fit. I'll rerun some tests and try and sort it out... Regarding the use of MOA instead of mils. To be honest, I can't recall ever having seen MOA used for adjusting for windage or elevation. Usually MOA seems to be used to describe the expected accuracy of a certaing gun/ammo type (in the sense that a grouping is expected to stay within 1 MOA at x meters, etc.). However, I'll try and use #define's to include both units within the same code and release two version - one using mils, the other MOA. I'm no fan of hardcoding any assumptions such as, that e.g. only the PSO is of russian type and should therefore use different settings. I'd love to be able to use the isKindOf function to get to the base classes of the weapons (but alas, weapons are not supported - sometimes this engine really drives me mad) or even better, imagine we could get the optics used by a weapon and determine it's base class... but suppose I'm dreaming, eh? A few asked how to use mil-dots -> I updated the first post. Regarding the wish to change the adjustments to meters instead of mils. Well, there's a reason why precision shooting ain't easy and in my opinion it shouldn't be either. Dialing in a certain range and have a mod automatically cancel out the games ballistics, would be way too easy and allow for perfect hits without effort. I want to give players the tools to become better sharpshooter, not make everyone a perfect sharpshooter Besides, the ballistics for the different weapons/ammo are different, so the script would have to know exactly how much the bullets rise/fall for each given distance and each ammo type used. And as soon as this mod is combined with another mod, that changes ammo settings, the values wouldn't work anymore. What I would like to do though, is to add a range card feature, ie. I'd like to be able to start a dummy mission, create a range card for a certain gun at distances of my choosing by observing where the rounds hit and adjusting accordingly. Later I'd like to retrieve this range card from within other missions - problem is, I don't yet know how/where to save that data to persist across missions...). First I'll try and sort out the bugs of the current version though before attempting to get a range card working. If the range card proves feasible though, this game just might become heaven for us sharphooters </span>
  18. I'm struggling with the same task. Did you ever figure is out?
×