Before you begin:
Download the necessary files for this tutorial.
Well, you clicked on this link because you wanted to learn how to do create some cool crosshairs like I have. Well, here is your chance to learn how to do them... (sorry, I am not good at introductions...)
Instead of me just giving you the cog, we will actually open it up and see what each part does. First we will do the cog, then the templates, then finally get rid of the Jedi Knight default crosshair without editing the .exe file:
Open up the crosshair.cog now. Done looking? Time to explain what each statement does.
The symbols section is the templates (you can add on more for more crosshairs), 2 ints (the switch is just a "storage" space to see what crosshair you currently got on the toggle, so don't change this!, the zoomed int is a supportive feature for different zoom functions, don't change this! It's just another storage place, the int dummy is another storage space, and the temp vector is a vector storage place.
player = GetLocalPlayerThing(); This will get the player on your own computer and save it as a thing number.
SetPulse(0.001); This will set the pulse, in the pulse, it will fire a crosshair template if you are not dead, making the new crosshair appear.
return; this just returns the information to the server and closes the cog message. not having it will skip to the next message.
Seeing a pattern in the crosshair cog now? Just add on or change as necessary for more crosshairs. Scroll down in your copy of the cog till you come to zoom 1, you may change the vectors and stuff for a different zoom and send a trigger to this cog telling to zoom in, so the crosshair will be there. Think of it as a "master" cog for crosshairs.Killed:
So, how do we block them, well, we put a # in front of them. Just like this:#"GUI_CROSSHAIR" 0 "Enable aiming crosshair"
There, oh wait, we are not done yet! Open up that renameme.plr file, ohhh, I bet we never edited these before... Well, I will walk you through...
See that part where its crosshair 0? That's the flag for the crosshair, 1= JK crosshair on, 0= JK crosshair off. Make sure its 0. Now this file will be a little tricky to install since it can't go into a .gob. In your readme.txt for your mod, you will need to tell the player how to install this file. Tell them to make a new character, then paste this into the new folder JK created in their player folder, then have them delete their old .plr file, and rename it to their player. This way it will stop all but the most determined people to turn on JK's crosshair.
Oh wait, we need to put on the crosshair toggle. I already did it in the jkstrings.uni, and in the items dat.By The Way, if you want to hotkey it, but not use these files, a suggest use for items.dat is this:
Please give me credit for learning how to do crosshairs, it would be nice, but if you use any of these files, then you must give me credit, please! Thank you.