Is it possible to make adjustable crosshairs? I realised that it is difficult to play without self-adjusting crosshairs for different weapons.
If there is a solution to this, how would I go about scripting this in?
You could possibly write a script assigning cross-hair sizes to each weapon, and then script your scroll-wheel, or other keys, to cycle through that list as it would with the regular weapon setup. ( The regular setup strikes me as a tad broken )
RaZgRiZ will probably know what to do. :]
Hmm, interesting, but seems kinda dodgey... good idea though! This is one of the most interesting aspects of C++, a problem can be fixed multiple different ways.
If it IS possible to create adjustable crosshairs, would it also be possible to make them widen when you run, and narrow when you stop, kinda like Counter-Strike?
he was talking about cubescript, i believe.
you wouldnt need widen/narrowing crosshairs like in Counter Strike because in sauerbraten, weapon accuracy is not affected by your speed.
By dodgey I meant with the scripting of the scroll wheel. i thought there may be a way to make the crosshair adjust according to each weapon's spray amount (accuracy).
You could code, in C++, a way to specify a preset for each weapon. Then expand on that via cubescript. The cross-hair size adjustment would have to be set by yourself though, as it would be more personal preference than anything else.
Hmm... This would be very useful, as I am attempting a seperate singleplayer extenstion/mod...
As for weapon accuraccy not being affected by movement, this would lead me to ask, where do I add that in/what particular code do I manipulate (weapons.cpp etc.)
im sure you could put something in your autoexe.cfg that says something to the effect of "if weapon ____ is selected, then /loadcrosshair 'blahblah' ; /crosshairsize '#'". Im not too adept on cubescript quite yet, but im sure something could be done without even having to mess with the core.
Yes, it was already done by viruz; we need a fixed version :P
here
there is a function called getweapon: it return a number 1-7. Change the binds for 1-7 and mouse 4-5 so that they run a function to check the weapon then change the weapon like the following:
de = "15 data/crosshair.png data/hit.png" weapons = "noSize noCH noHT ShSize ShCH ShHT ChSize ChCH ChHT RkSize RkCH RkHT RfSize RfCH RfHT GrSize GrCh GrHT PiSize PiCH PiHT FiSize FiCH FiHT" createVars reset = [ loop i 8 [ (at $weapons (+ $i 0 ) ) = (at de 0 ) (at $weapons (+ $i 1 ) ) = (at de 1 ) (at $weapons (+ $i 2 ) ) = (at de 2 ) ] ] reset getCrossHairMenuInfo = [ guitext "crosshair size" guislider (concatword (at $weapons $arg1 ) ) 1 50 guibar guititle "Crosshair" guibar guilist [ loop row (div (+ (listlen $crosshairs) 6) 7) [ loop col 7 [ ch = (at $crosshairs (+ (* $row 7) $col)) if (!=s $ch "") [ guiimage (at $ch 0) [ (at $weapons (+ $arg1 1 ) ) = @(at $ch 0) 0 (at $weapons (+ $arg1 2 ) ) = @(at $ch (if (> (listlen $ch) 1) 1 0)) 2 //(concat $arg3 ) = $temp ] 0.5 ] ] ] ] guibar guibutton "Reset" "echo Reset" ] use = 1 newgui CH [ guistayopen [ guicheckbox "Use Dynamic Cross Hairs" "use" guibar normal = ( getCrossHairMenuInfo 0 ) guibar guibutton "Reset All" "reset" if (= $use 1 ) [ guitab "Shot" (getCrossHairMenuInfo 3) guitab "Chain Gun" (getCrossHairMenuInfo 6) guitab "Rockets" (getCrossHairMenuInfo 9) guitab "Rifle" (getCrossHairMenuInfo 12) guitab "Grenades" (getCrossHairMenuInfo 15) guitab "Pistol" getCrossHairMenuInfo 18 guitab "Fist" getCrossHairMenuInfo 21 ] ] ]
try this ... its a menu to change all of this stuff, i will write the rest when i get back and the end of the weekend :)
chasester
O_O
I never realised that the forum community would be so helpful! Thank you very much!
I shall try all this on the weekend.
chasester's method looks like it may work...
Let me get this straight...
I put this in the source code in weapons.cpp?
NO, You put it in a .cfg file. the code chasester gave you is CUBESCRIPT not C++ :)
if you were to inject that into your source, you wouldnt even compile :)
so, put that in a .cfg file (crosshair.cfg for example) and put that file in your sauerbraten root directory then do /exec crosshair.cfg in-game to use chasester's code
i found some errors ... i will realse in a node when it is complete :)
xD sorry, my noobishness reveals itself!
I haven't worked much with cubescript either.
I really don't code much, so I'm using this program to learn how C++ and CubeScript worx, gotta loooong way to go!
thanx to everyone!
it done :)