Overriding the default 32x32 cross-hair size

Author Topic: Overriding the default 32x32 cross-hair size  (Read 1626 times)

 I had the idea to add a functional rangefinder next to my cross-hair like you would find in many precision rifle scopes, just something to get an estimate for distance of another player for fun and possibly a small amount of usefulness. When i created the cross-hair i assumed that enlarging the window of the cross-hair wouldn't affect the actual in-game size of the cross-hair but i was wrong, i increased the window from 32x32 to 128x128 to fit everything in, so obviously the cross-hair is 1/4 the normal size, completely negating the usefulness of the rangefinder. Is there any way to override the 32x32 default window?



A picture of the cross-hair at 128x128, each dot/hash denotes 100, 150, 300, and 400 studs respectively. I do intend to re-evaluate the space between distances as 100-150 isn't a very practical distance gap, this cross-hair was more of a test than anything.

The crosshair on your screen is a GUI object. Its name is "Crosshair".

To accomplish what you're trying to do you'll need to resize the object. You can do this by calling resize(x, y, w, h) on it.

Example: Crosshair.resize( getWord(Crosshair.position, 0), getWord(Crosshair.position, 1), 128, 128);

The first two arguments are the position of the object, all I did was make it stay where it already was but keep in mind if you're resizing the object it's not going to be centered how you want it anymore. You'll have to offset it. You're also going to have to figure out when to run this code, look into when the crosshair is added (hint: onAdd).

what happens if you change resolution?
does the crosshair get resized/moved, or deleted and readded?

what happens if you change resolution?
does the crosshair get resized/moved, or deleted and readded?

When it is resized the cursor becomes smaller relative to the resolution change, almost as if the dpi in the image changed. i resized it 4x bigger so it was 4x smaller.

The crosshair on your screen is a GUI object. Its name is "Crosshair".

To accomplish what you're trying to do you'll need to resize the object. You can do this by calling resize(x, y, w, h) on it.

Example: Crosshair.resize( getWord(Crosshair.position, 0), getWord(Crosshair.position, 1), 128, 128);

The first two arguments are the position of the object, all I did was make it stay where it already was but keep in mind if you're resizing the object it's not going to be centered how you want it anymore. You'll have to offset it. You're also going to have to figure out when to run this code, look into when the crosshair is added (hint: onAdd).

I have absolutely next to no modding experience, but I'm gonna give this a swing. I've been trying to read up on how to go about scripting this, I'm only worried that this is too much effort for a cross-hair design! XD

When it is resized the cursor becomes smaller relative to the resolution change, almost as if the dpi in the image changed. i resized it 4x bigger so it was 4x smaller.
that's definitely happening when you try to modify it with a script

i'm curious what the game does when you decide to double the resolution of the whole game
there must be some kind of GUI resizing going on, or is everything always the same resolution?