Custom Weapon Crosshairs?

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Wed May 14, 2008 5:56 pm

  • Is there any way to mod nexuiz to support custom weapon crosshairs? Because for some weapons certain crosshairs seem right while others don't. Also possibly allowing for dynamic crosshairs as well.
    Like a ring around the target reticule that changes depending on the amount of ammo.
    jasonbourne
    Newbie
     
    Posts: 8
    Joined: Wed May 14, 2008 5:33 pm

Wed May 14, 2008 8:03 pm

  • Stuff like that is currently not possible.. you can use some fancy scripts to change crosshairs when you change the gun but it will not work if it autoswitches the guns for some reason..
    And you CAN create custom crosshairs. I think there is some large thread with some nice examples here in the forum.. Basicly just create a crosshairXX.tga file in Nexuiz/Data/gfx and use the console to set 'crosshair' to XX..
    User avatar
    esteel
    Site admin and forum addon
     
    Posts: 3924
    Joined: Wed Mar 01, 2006 8:27 am

Thu Aug 14, 2008 7:43 am

  • I fully support adding the ability to set a different crosshair for every weapon, it would indeed help very much. I hope a way to add such a thing can be found in the end, it would be very nice and useful if possible.
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Thu Aug 14, 2008 5:20 pm

  • Honestly i fail to see how this is "very much help".. is the large weapon not enough to see what weapon your character wields? Besides to get most control disable the autoswitch feature so you will only change guns when out of ammo or switching yourself. And then it should be quite easy to remember which gun is current.
    I think different crosshairs is more of a toy not so much a helpful feature.
    User avatar
    esteel
    Site admin and forum addon
     
    Posts: 3924
    Joined: Wed Mar 01, 2006 8:27 am

Thu Aug 14, 2008 8:14 pm

  • i like to play without the weapon model so weapon specific crosshairs sound like a nice idea to me.

    r_drawviewmodel "0"
    (in case someone asks)
    zuriastrad
    Alien
     
    Posts: 169
    Joined: Thu May 15, 2008 4:13 am

Fri Aug 15, 2008 10:14 pm

  • Well i did that too some time ago but i failed to see how this helps (party because a lot of games do not allow to set the crosshairs for single guns) and also personally i think the guns do not block sooo much screen so having them disabled hardly improves anything. But i know that taste. I'm not sure but in the next version the scoreboard is finally handled by CSQC.. if the crosshair is also it will be easier to add such customization options
    User avatar
    esteel
    Site admin and forum addon
     
    Posts: 3924
    Joined: Wed Mar 01, 2006 8:27 am

Sat Aug 23, 2008 8:39 pm

  • Maybe a cvar for each weapon - crosshair_nex, crosshair_rl or crosshair_7, crosshair_9 etc

    Default them to 0. When a new weapon is selected check to see if the crosshair_# is non zero, if it is use that crosshair, otherwise use the default.

    You would also have to consider the crosshair RGB & alpha values.
    Spaceman
    Alien trapper
     
    Posts: 264
    Joined: Tue Aug 28, 2007 10:53 am

Thu Aug 28, 2008 2:05 am

  • I know it's bad to reply to yourself, but this will send an email to all the previous commentators.

    Have you any examples of the crosshairs you want for the different weapons?
    Spaceman
    Alien trapper
     
    Posts: 264
    Joined: Tue Aug 28, 2007 10:53 am

Thu Aug 28, 2008 3:20 am

  • victim [v] wrote:I know it's bad to reply to yourself, but this will send an email to all the previous commentators.

    Have you any examples of the crosshairs you want for the different weapons?


    Well, for the nex you'd want to use a dot, but for the shotgun you may want to use a large circle with a dot in the middle, to indicate how far the projectiles would spread.
    User avatar
    Psychcf
    Forum addon
     
    Posts: 1554
    Joined: Sun Dec 03, 2006 11:38 pm
    Location: NY, USA

Sat Aug 30, 2008 1:09 am

  • I've now created some working code for this. It allows you to have a different crosshair for each weapon and also individual settings for each crosshair.

    There are a total of 6 variables for each crosshair (crosshair number, red, green, blue, alpha, size) and 9 weapons plus a variable to switch it on

    Giving a total of 55 new variables to play with.

    Before I post the changes I need a name for the variable that enables the new crosshair system. Currently I've called it crosshair_toy, obviously it needs a better, sexy name.
    Spaceman
    Alien trapper
     
    Posts: 264
    Joined: Tue Aug 28, 2007 10:53 am

Sat Aug 30, 2008 9:38 am

  • Logically I'd call it crosshair_independent.

    Also, the 55 is made up of ARGB, size, crosshair # variables for the nine weapons, plus your master variable?
    OSJhA2LEWR
    Newbie
     
    Posts: 3
    Joined: Sun Aug 24, 2008 8:53 am

Sat Aug 30, 2008 11:31 am

  • http://217.16.115.15/~blub/nexfiles/?page=file&file=722c6e831db16ac895d45df16ffb7abc

    v 0.1 of my crosshair / weapon script

    Apply the above patch to a current SVN version of the game engine and add the following to your autoexec.cfg file. Modify it to suit.
    //Crosshair Red Green Blue Alpha Size
    //0-n, 0-1, 0 - 1, 0 -1, 0 - 1, 0.2 - n

    crosshair_toy 1

    crosshair1 "51 0 0 1 1 1" // blue, 100% alpha & normal size
    crosshair2 "52 0 1 0 1 2" // green, 100% alpha & double size
    crosshair3 "53 0 1 1 1 3" // cyan, 100% alpha & triple size
    crosshair4 "54 1 0 0 1 4" // red, 100% alpha & quadruple size
    crosshair5 "55 1 0 1 1 3" // pink, 100% alpha & triple size
    crosshair6 "56 1 1 0 1 2" // yellow, 100% alpha & double size
    crosshair7 "57 1 1 1 1 1" // white, 100% alpha & normal size
    crosshair8 "58 0 0 0 1 2" // black, 100% alpha & double size
    crosshair9 "59 1 1 1 1 0.5" // white, 100% alpha & half size


    To do
    1) rename crosshair_toy
    2) more error checking
    3) replace missing info with defaults
    4) crosshair_restart
    5) rewrite it in QC
    Spaceman
    Alien trapper
     
    Posts: 264
    Joined: Tue Aug 28, 2007 10:53 am

Sat Aug 30, 2008 12:07 pm

  • As we have CSQC now, the client knows which crosshair would have to be active, so a failed switch would not change the crosshair the wrong way.

    Now... I could implement that feature into CSQC. But there are two ways.

    1. Support all your cvars in csqc
    2. Make CSQC call an "activeweapon_changed" alias whenever a weapon is switched (and on startup)

    Way 2 may be more flexible, but still requires a .cfg for the feature.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Tue Nov 18, 2008 11:32 pm

  • Are there any news regarding this and possibilities to implement it in the current SVN? Don't know about others but I for one am still very much hoping for this feature to be in sometime. I know from my experience in UT2k4 that custom weapon crosshairs do help a lot, especially with a difference such as a close-range weapons with spread damage vs. long-rage weapons with exact point damage. When using a close-range spread gun like the shotgun you usually want a big round crosshair, while when using something like the nex you'd certainly want a tiny dot or smaller discrete crosshair to hit better. Every weapon fires differently from another, and being able to set your own crosshair depending on how you are best suited with each is something more important then it may seem I believe. Just like equipping your car with different tires when going on an ice covered road then riding on hot summer cement and the other way around... can work without doing it but the car works and handles much better if you do :) Also important when you hide your weapon model as zuriastrad mentioned many posts ago, so you know what weapon you are holding too.

    To div's post above even if the reply may be a bit late. Not that much of a "deep developer" to fully understand the difference between the two myself, but I believe some cvars would certainly do good being implemented here and anything woks as long as you can save all separate crosshair configurations for each weapon. A .cfg change would certainly need being done since you'd need to be able to store multiple crosshair settings instead of a single crosshair. From my understanding of the code, the best way is making it so that whenever you switch to a new weapon this also sends an update to the crosshair and loads a different one from the settings, changing the model, size, color and alpha of the cross you customized for that gun.

    Just as a question though, this does also plan to accompany a new Player Setup crosshair editor in the menus, right? I think the best way would be to make a new section in the Weapon setup window (the one that you open from the "Weapon settings..." button in the Player Setup menu) and move the crosshair customization there from the Player setup menu it's placed in currently (probably to the left of the weapon priority list). Then when selecting a new weapon from that list the crosshair settings would change and indicate / modify the crosshair for that weapon, and you would set the type colors, size and alpha for each individually. Also there should be a checkbox as to whether or not people want weapon-based crosshairs so we don't force it on those who don't want to either. So if that's doable, will it be that way? Posted an ugly modded screenshot below of how I personally believe the menu should be like exactly. Anyway I hope to see more on this in the future if it's still being worked on :D Hope lots it will work now.

    ImageImage
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Sun Dec 07, 2008 7:52 pm

  • I did finish the crosshair / weapon script, but it was a modification of the Darkplaces game engine not Nexuiz CSQC. Nexuiz now has the potential for 23 weapons which means a huge number of variables to work with. I currently don't know how to convert the following from C to QC
    Code: Select all
    while (COM_ParseToken_Simple(&qwer1, true, false))
    +   {
    +      a = atof(com_token);
    +      crosshair_n[j][i] = a;
    +      i++;
    +   }

    Then I need to find some efficient way to store all the crosshair info, probably a big array
    Code: Select all
    float crosshair_n[22][6];

    DivVerent's idea of using aliases seems a better way to do it. I also gave up because the original poster failed to reply.

    Your new menu window is good idea, but I would like to see a weapon window. Featuring a picture and a description of each weapon, plus an option to select a crosshair (and size, colour etc) or use the default. As well as changing the weapon priority.
    Spaceman
    Alien trapper
     
    Posts: 264
    Joined: Tue Aug 28, 2007 10:53 am

Sun Dec 07, 2008 7:55 pm

  • victim wrote:I did finish the crosshair / weapon script, but it was a modification of the Darkplaces game engine not Nexuiz CSQC. Nexuiz now has the potential for 23 weapons which means a huge number of variables to work with. I currently don't know how to convert the following from C to QC
    Code: Select all
    while (COM_ParseToken_Simple(&qwer1, true, false))
    +   {
    +      a = atof(com_token);
    +      crosshair_n[j][i] = a;
    +      i++;
    +   }

    Then I need to find some efficient way to store all the crosshair info, probably a big array
    Code: Select all
    float crosshair_n[22][6];

    DivVerent's idea of using aliases seems a better way to do it. I also gave up because the original poster failed to reply.

    Your new menu window is good idea, but I would like to see a weapon window. Featuring a picture and a description of each weapon, plus an option to select a crosshair (and size, colour etc) or use the default. As well as changing the weapon priority.


    Any method for a crosshair system is good as long as it works correctly and doesn't cause bugs I believe :) And +1 for the menu idea, I fully agree. Basically the current weapons menu does all that just that it doesn't have a picture and description of each weapon in part. Adding that would make the menu you mentioned come true.
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Sun Dec 07, 2008 10:23 pm

  • zuriastrad wrote:i like to play without the weapon model so weapon specific crosshairs sound like a nice idea to me.

    r_drawviewmodel "0"
    (in case someone asks)

    This may seem like the stupidest question ever, but if you're not able to identify the weapon you're using, shouldn't you play with the view model on? Fixed. :wink:
    Ed
    Forum addon
     
    Posts: 1172
    Joined: Wed Mar 01, 2006 12:32 am
    Location: UK

Sun Dec 07, 2008 10:36 pm

  • Ed wrote:
    zuriastrad wrote:i like to play without the weapon model so weapon specific crosshairs sound like a nice idea to me.

    r_drawviewmodel "0"
    (in case someone asks)

    This may seem like the stupidest question ever, but if you're not able to identify the weapon you're using, shouldn't you play with the view model on? Fixed. :wink:


    Just for the info, I made a menu patch a few weeks ago which got applied and now you can turn the weapon model on or off from Player Setup -> Weapons... under the weapon priority list.
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Fri Jan 09, 2009 12:18 pm

  • Thought to post this here as well. I have found a way to implement most of the necessary code for this feature and created a patch which allows custom weapon crosshairs to work as they should, although the patch is still pretty unoptimized and doesn't yet have a menu setting. The patch can be found in THIS POST. If someone can get the crosshair selector in the menus working with this I believe this can be implemented in SVN.
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest



Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest