From ZDoom Wiki
Jump to navigation Jump to search

A_SetCrosshair (int number)

Sets or disables a custom crosshair for the currently selected weapon.

  • number: The crosshair number to use. A value of 0 resets the crosshair to the player's default selection.

You can use this function to set a specific crosshair for the currently-selected weapon, or change the current crosshair based on zoom factor or other conditions. The last crosshair set will be saved to the current weapon and reset if the player switches back to it at a later time.

Both the default crosshairs present in ZDoom.pk3 and custom crosshairs can be set with this function. If you want to disable the crosshair for a given weapon, you can include an empty graphic for your custom crosshair and use this function to set the weapon to use that crosshair.

Note that the player may override the custom crosshair by setting the crosshairforce CVAR to true.


Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.