| Blockland Forums > Modification Help |
| Overriding the default 32x32 cross-hair size |
| (1/2) > >> |
| Sampuu:
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. |
| Crøwn:
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). |
| phflack:
what happens if you change resolution? does the crosshair get resized/moved, or deleted and readded? |
| Sampuu:
--- Quote from: phflack on September 20, 2017, 10:37:12 PM ---what happens if you change resolution? does the crosshair get resized/moved, or deleted and readded? --- End quote --- 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. |
| Sampuu:
--- Quote from: Crøwn on September 20, 2017, 03:40:59 PM ---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). --- End quote --- 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 |
| Navigation |
| Message Index |
| Next page |