Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → help me, i need it
help me, i need it
2002-06-11, 10:53 AM #1
Anyone know how to get external crosshairs in JK?
Those who live by the sword get shot by those who don't.
OSC
2002-06-11, 11:29 AM #2
http://www.massassi.net/tutorials/crosshair/

Nuff said.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-06-11, 2:03 PM #3
not quite enough, i can't figure it out. i know, i suck, i shouldn't be editing, but I have to start somewhere, don't I?
Those who live by the sword get shot by those who don't.
OSC
2002-06-12, 7:27 AM #4
Everyone has to start somewhere. [http://forums.massassi.net/html/wink.gif]

That tutorial will do what you want, but the cog and templates are far from perfect. Here's a simple cog that will work:

Code:
# crosshair.cog
#
# This cog uses a fast pulse to create an
# external crosshair in front of the player.
#
# [SM]
#======================================================================#
symbols

thing		player				local
template	chtemp=+crosshair		local

message	newplayer
message	pulse
message	killed

end
#======================================================================#
code
#----------------------------------------------------------------
newplayer:
       player = GetSenderRef();
       SetPulse(0.001);

Return;
#----------------------------------------------------------------
pulse:
	if(GetCurrentCamera() == 1 && GetThingHealth(player) > 0)
	  FireProjectile(player, chtemp, -1, -1, '0 0.2 0', '0 0 0', 0, 0, 0, 0);

Return;
#----------------------------------------------------------------
killed:
	SetPulse(0);

Return;
#----------------------------------------------------------------
end


You will want to change the offset used by FireProjectile(). As it is, the offset is '0 0.2 0'. This will make the crosshair sprite appear 0.2 JKUs in front of the player. Here's the templates to use:

Code:
_based     none     orient=(0/0/0) type=weapon move=physics timer=0.01
+crosshair     _based     sprite=crosshair.spr


Were you able to figure out how to use the tutorial's crosshair? Make sure that you have the crosshair.cog, static.jkl, crosshair.spr, and crosshair.mat in their appropriate directories. And make sure that you have an entry for crosshair.cog in your items.dat. It should be something like:

Code:
crosshair     116     0   0   0x000   cog=crosshair.cog


Ok, if you still don't understand how to get the crosshair working, ask more specific questions, and I'll explain. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.

[This message has been edited by SaberMaster (edited June 12, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-06-12, 8:27 AM #5
with the tutorial, i had the hotkey (it wouldn't let me bind it though) but the main crosshair was still the same. i'm about to try your cog.
Those who live by the sword get shot by those who don't.
OSC
2002-06-12, 8:38 AM #6
Well, i con't quite figure out where to put your line in items.dat. where does it go?
Those who live by the sword get shot by those who don't.
OSC
2002-06-13, 9:10 AM #7
One thing I have also noticed, is that the players eyeoffset must be taken into account when making external crosshairs. Otherwise the crosshair will be off. The players eyes are actually set 0.037 (or something like that, check the walkplayer template) on the z axis.

It took me a while to realise that was why my crosshairs were always off, so I thought I'd save you the same frustration.
2002-06-14, 7:42 AM #8
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Lord_Grismath:
http://www.massassi.net/tutorials/crosshair/

Nuff said.
</font>




------------------


Come to: http://shiningsaber.cjb.net
for the best star wars fanfilms ever!
[url="mailto:satish.solanki77@ntlworld.com"]mailto:satish.solanki77@ntlworld.com[/url]satish.solanki77@ntlworld.com</A>
Shining Saber Productions

Never be afraid to try something new. Remember, amateurs built the ark, and professionals built the Titanic.

The force is like Duct Tape - it has a dark side, it has a light side, and it binds the universe together!

If Bill Gates had a dime for every time a Windows box crashed...oh, wait a minute - he already does.

If a turtle doesn't have a shell, is he homeless or naked?
2002-06-15, 6:36 AM #9
That code for the items bin goes near the end of the items.dat file. Put it right after the last goal bin. Don't use the tutorial's items.dat. Instead, extract a new one from Res2.gob.

Remember that the method I propose is a simple, bugless version of the original. My cog does not use a hotkey to change the crosshair. Though if you want, I can add it. [http://forums.massassi.net/html/wink.gif]

Sidious, you have no idea. [http://forums.massassi.net/html/tongue.gif]

------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!