Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New feature: Scope modes
| New feature: Scope modes[message #303024]
|
Sun, 08 April 2012 17:55
|
|
| Flugente |
 |
Messages:3503
Registered:April 2009 Location: Germany |
|
|
Scope modes
I implemented another minor feature. Basically it allows the player to manually switch between the different scopes and sights on a weapon. This option can be toggled in the .ini (USE_SCOPE_MODES)
The idea is that a gun can have multiple optical sights (iron sights, reflex sights, scopes). Atm, boni of all those are added at the same time, and the actual magnification used is determined by range and some other stuff.
I changed that. Now you can toggle between your different scopes by pressing '.' in tactical mode (I moved the cheat option that formerly occupied that key to CTRL-'y'). For all necessary calculations (including sight range, aim levels, AP cost and of course cth) only the currently used scope/sight is used.
For testing reasosn, I gave Lynx an M14 with an Acog and a reflex sight. He now has a 4.0x scope, a 2.0x reflex sight (I tweaked that for testing purposes) and 1.0x iron sights (the basic M14).
If you allow a graphical display, it looks like this:
Acog (notice the increased sight range compared to the other two pictures):

Reflex Sight (notice the lower APs needed compared to the other pictures):

Iron Sights:

If you enlarge the pics, you can actually see stuff.... how do you do that in a post?
This atm only works for your mercs, the enemy and militia are not affected.
While the overall use of this might be small, those who struggle with scopes with a magnification factor too high on NCTH might benefit from this.
Edited stuff:
As I found out, different mods made new attachment classes, while still using the -tag. For this reason, I can't use that to determine wether an attachment is of a specific class.
I have therefore (after previously doing otherwise, and having a lenghty discussion with JMich and depressives Brot on IRC) decided to leave the -tag alone. I have, however, created a new UINT32-tag in items.xml, which is called .
This tag now specifies the behaviour of an attachemnt, wether it is a scope, a laser, a grenade, a detonator etc. It is in principle the AC_#### bitmask in Item Types.h. This is a bitmask, so it is now also possible to create an attachment that is both scope and laser (or whatever weird stuff you can think off). The flags are:
// redesigned by Flugente on 12-04-10
// Chrisl: Define attachment classes
#define AC_BIPOD 0x00000001 //1
#define AC_SUPPRESSOR 0x00000002 //2
#define AC_LASER 0x00000004 //4
#define AC_SIGHT 0x00000008 //8
#define AC_SCOPE 0x00000010 //16
#define AC_STOCK 0x00000020 //32
#define AC_MAGWELL 0x00000040 //64
#define AC_INTERNAL 0x00000080 //128
#define AC_EXTERNAL 0x00000100 //256
#define AC_UNDERBARREL 0x00000200 //512
#define AC_GRENADE 0x00000400 //1024
#define AC_ROCKET 0x00000800 //2048
#define AC_FOREGRIP 0x00001000 //4096
#define AC_HELMET 0x00002000 //8192
#define AC_VEST 0x00004000 //16384
#define AC_PANTS 0x00008000 //32768
#define AC_DETONATOR 0x00010000 //65536
#define AC_BATTERY 0x00020000 //131072
#define AC_EXTENDER 0x00040000 //262144
#define AC_SLING 0x00080000 //524288
#define AC_REMOTEDET 0x00100000 //1048576
#define AC_DEFUSE 0x00200000 //2097152
#define AC_IRONSIGHT 0x00400000 //4194304
#define AC_FEEDER 0x00800000 //8388608
#define AC_MODPOUCH 0x01000000 //16777216
#define AC_RIFLEGRENADE 0x02000000 //33554432
#define AC_BAYONET 0x04000000 //67108864
#define AC_MISC16 0x08000000 //134217728
#define AC_MISC17 0x10000000 //268435456
#define AC_MISC18 0x20000000 //536870912
#define AC_MISC19 0x40000000 //1073741824
#define AC_MISC20 0x80000000 //2147483648
So, for example, the grippod will have 4097, because it is both bipod and grippod.
This will also allow us to remove some of the existing flags, like . However, take note that this is stuff is currently not used anywhere in the code, except for
1) grenades and rockets
2) scopes and sights (by this very feature)
Hopefully, this will get used more extensively in the future.
I already added the necessary tags to all attachments in Items.xml. :sign: ANY MODDER USING THIS CODE WILL HAVE TO DO THE SAME TO (ATLEAST) ALL HIS SCOPES, SIGHTS, GRENADES and ROCKETS, or those won't work a intended.
I also made a little addition to overheating weapons, severe overheating now temporarily lowers a gun's accuracy.
I also made another new feature, which I will describe in another thread.
If nobody has any objections (or brilliant ideas that I should include), I will submit this to RoWa this evening.
Edit2: As of r6084, when using scope modes, the magnification factor adjusts just like without this feature. While I find it odd, not doing so is highly incompatible to NCTH.
Also, the enemy now properly uses this.
[Updated on: Fri, 17 May 2013 22:11] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: New feature: Scope modes[message #303035]
|
Sun, 08 April 2012 19:56 
|
|
| Wil473 |
  |
Messages:2813
Registered:September 2004 Location: Canada |
|
|
I'd suggest neither, and simply not have the feature consider the "iron sight" unless it is present as an attachment. We have a dozen default attachments available now, so for the few specific instances of guns that can be sighted via its in-built iron sights while a scope is attached, the iron sight can be handled by a default attachment.
Now for a scope that comes with its own back-up iron, again the same thing: default attachment (but on the scope itself).
A concern would be how robust NAS is handling a scope that has an inseparable default attachment. The Scope must be able to be removed, with the default attachment reliably sticking to the scope instead of instead of trying to stay with the gun. This seems to work fine with grenades, but I wouldn't be so sure about saying the same thing with non-grenade attachments, let alone inseparable ones.
My other concern is that you've made this optional for the player to toggle/exploit. In the brief few hours that I've known about this feature, I've already thought about using this as a way to do a variable power scope: player mounts one scope, but the scope has as its default attachments a bunch of other scopes representing each increment. ie. 9x VP = 9x scope with 6x and 3x scopes mounted on it. With this feature on, the player could only use each scope one at a time, with it off I'm afraid the player ends up with an 18x scope (which under NCTH is actually a bad thing as the penalty would be in effect for all standard map sizes).
EDIT: Oh sorry, forgot - Thank you Depressives Brot, Tais and JMich for bringing up the XML modders and the strange things we've done with NAS (well Smeagol and myself I know have done strange, but wonderful, things with NAS)
EDIT2: first part edited for clarity and grammar
[Updated on: Sun, 08 April 2012 20:01] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
| Re: New feature: Scope modes[message #303082]
|
Mon, 09 April 2012 12:34 
|
|
usrbid |
  |
Messages:1502
Registered:December 2008 |
|
|
Some scopes will allow the use of iron sights, this is called co-witness. You can't use both simultaneously, as you can only look down one sight path, but you can choose which one you want to use.
On another note, holo or red dot sights are not necessarily more accurate than iron sights, they just provide (something called) more eye relief, meaning that the position of the eye does not have to be perfectly aligned with the sight path.
In real life there are some things to consider with holo or red dot sights. Holding the gun fixed and moving the eye will eventually move the dot, meaning the bullet won't hit where the dot is.
Holding the gun higher to target at extreme distances, 300 yards plus, does not obstruct the sight picture as there is plenty of room below the dot. With iron sights the bottom of the front post will eventually be in the way of the target area, possibly obstructing the target altogether. Unless you adjust the iron sight to the larger distance. Some iron sights cannot be adjusted.
Depending on the type of iron sight, aiming with them may be more accurate than with a holo or red dot sight. For example a hooded front post to reduce glare and fiberoptic dots (or just glow in the dark white dots) make a difference in how well you shoot.
Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: New feature: Scope modes[message #303894]
|
Wed, 25 April 2012 10:45 
|
|
| Wil473 |
  |
Messages:2813
Registered:September 2004 Location: Canada |
|
|
TClaymoreWait, would this update allow for a scope to cycle through different magnifications?
Sure, if you stacked a bunch of scopes as inseparable attachments on a "base scope." Attach the base scope, and it brings along its friends. The problem is I'm not sure if NAS is robust enough for a removable attachment bringing along a bunch of attachments that are inseparable to it.
Also, variable power scopes have been implemented via HAM 5 item transformations (see my Alrulco Folding Stock v3.65).
Madd MugsyThere are now two xmls for attachment classes, and yes it is a bit confusing:p
NasAttachmentClass.XML = the old AttachmentClass.XML. It is used only by the editor and the values in it link to the nasAttachmentClass tag; known as Custom Attachment Class in the editor. It is fully editable in the editor.
Lookup\AttachmentClass.XML is the new one. It is known as Built in Attachment Class in the editor. It is not fully editable, and the file itself is only used by the editor. Its values correlate to specific code functionality, whereas the nasAttachmentClass values are purely for attachment placement.
You will need to set values for both fields in order for scope modes and future features to work correctly.
When was this implemented? My v3.65 mods were built around the old (NAS 0.7) XML's, meaning its nasAttachmentClass tags are trying to use values in a Lookup\AttachmentClass.XML rebuilt for my own purposes (I'm up to 8388608 now). My NAS system seemed to be working the last time I was testing it.
That said, I suppose I could just copy the XML and rename it nasAttachmentClass.XML, leaving the other one in the original NAS 0.7 location for legacy support. Means no XML Support by the general public until I drop Stable 4870 support. Not as bad as the NAS 0.6 to 0.7 conversion, but still, couldn't we have just left the NAS XML's alone, and name the XML Editor lookup file for Scope Modes something else? Many angry words were exchanged over the shape of NAS 0.7...
[Updated on: Wed, 25 April 2012 11:07] by Moderator Report message to a moderator
|
|
|
|
|
|
|
| Re: New feature: Scope modes[message #303903]
|
Wed, 25 April 2012 18:11 
|
|
| Madd_Mugsy |
  |
Messages:626
Registered:July 2005 Location: Canada |
|
|
Quote:
When was this implemented? My v3.65 mods were built around the old (NAS 0.7) XML's, meaning its nasAttachmentClass tags are trying to use values in a Lookup\AttachmentClass.XML rebuilt for my own purposes (I'm up to 8388608 now). My NAS system seemed to be working the last time I was testing it.
That said, I suppose I could just copy the XML and rename it nasAttachmentClass.XML, leaving the other one in the original NAS 0.7 location for legacy support.
Not too long ago - a couple weeks maybe?
Copying and renaming is a good quick way to migrate to the new file. Just remember to change the tags inside the file to prefix them with "Nas" as well. Again, this file is just for the editor; the game will work fine regardless.
Feel free to have no file at all in the lookup folder - it will create one for you. Just make sure you clear out the XmlWorkingData folder for the editor to pick up the change (if you have the working data feature turned on).
Quote:
Means no XML Support by the general public until I drop Stable 4870 support. Not as bad as the NAS 0.6 to 0.7 conversion, but still, couldn't we have just left the NAS XML's alone, and name the XML Editor lookup file for Scope Modes something else? Many angry words were exchanged over the shape of NAS 0.7...
It is a necessary breaking change; we need to keep things somewhat organized to facilitate code maintenance and the addition of features in the future. Things have changed so much since 4870, and will continue to change -- for one example, see NAS Receivers topic -- I'm not sure it will be possible to support both 4870 and the latest SVN code for much longer. The small bit of good news is that going forward the NasAttachmentClass file is actually editable so you can add new classes, and ones to represent combinations, in the editor.
While we're on this topic of moving files, please note that Silhouettes.xml moved out of the Lookup folder as well, and it is also fully editable now.
Quote:
Sure, if you stacked a bunch of scopes as inseparable attachments on a "base scope." Attach the base scope, and it brings along its friends. The problem is I'm not sure if NAS is robust enough for a removable attachment bringing along a bunch of attachments that are inseparable to it.
It is! I managed to pull off this approach the other day, so now my sniper scope has 10x, 6x and 3x magnification using scope modes.
Report message to a moderator
|
|
|
|
|
| Re: New feature: Scope modes[message #303904]
|
Wed, 25 April 2012 18:35 
|
|
| Wil473 |
  |
Messages:2813
Registered:September 2004 Location: Canada |
|
|
Ah right, no need to panic, as far as the game is concerned the nasAttachmentClass tag is just bitmap, the names used in the XMLEditor do not matter in-game.
Madd Mugsy
Quote:
Sure, if you stacked a bunch of scopes as inseparable attachments on a "base scope." Attach the base scope, and it brings along its friends. The problem is I'm not sure if NAS is robust enough for a removable attachment bringing along a bunch of attachments that are inseparable to it.
It is! I managed to pull off this approach the other day, so now my sniper scope has 10x, 6x and 3x magnification using scope modes.
Now the question is, can you remove the scope without the game getting confused about the inseparable attachments leaving the base gun, but still being attached to the base scope attachment.
Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: New feature: Scope modes[message #307377]
|
Sat, 14 July 2012 09:50 
|
|
Strohmann |
  |
Messages:287
Registered:August 2011 Location: Division Thought Crimes |
|
|
Flugente [...] The idea is that a gun can have multiple optical sights (iron sights, reflex sights, scopes). Atm, boni of all those are added at the same time, and the actual magnification used is determined by range and some other stuff.
I changed that. Now you can toggle between your different scopes by pressing '.' in tactical mode (I moved the cheat option that formerly occupied that key to CTRL-'y'). For all necessary calculations (including sight range, aim levels, AP cost and of course cth) only the currently used scope/sight is used. [...]
may is ask which tags from Items.xml are recognized in the latest version?
in the version i am currently using , all sight range relevant ones like and action points related are recognized for each individual "scope". but i observed and aren't, so assume the whole other aren't counted individually. for example i want to create something like this:
iron sights with 15
sniper scope with zoomfactor 7x: 7.0 , +1, no bonus to
same scope with default inseperable attachment as zoomfactor 10x: 10.0 , +2, no bonus to
present i can do that perfectly with itemtransformations, but the frequent clicking gets a bit tedious. any chance this can be realized or already is?
Report message to a moderator
|
Master Sergeant
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: New feature: Scope modes[message #320985]
|
Mon, 27 May 2013 15:22 
|
|
krux |
 |
Messages:62
Registered:June 2011 |
|
|
It means it now adjusts automatically to the best mode for the range to target?
Btw, does laser sights work when firing from the hip?
[Updated on: Mon, 27 May 2013 15:22] by Moderator Report message to a moderator
|
Corporal
|
|
|
|
Goto Forum:
Current Time: Wed Dec 17 14:20:24 GMT+2 2025
Total time taken to generate the page: 0.00996 seconds
|