Page 1 of 1

Re: Rangefinder on custom scope

Posted: 2009-10-18 14:53
by Alex6714
Exapmple of what the code should be to add range. You could ad target altitude and position coordinates aswell iirc.

hudBuilder.setNodeLogicShowVariable EQUAL GuiIndex 150 - Index of your hud, use one that isnt used, I don“t think 150 is, check the guiindex.txt in the menu server zip, hudsetup folder.

hudBuilder.createTextNode MonocularHud MonocularRangetext 523 424 40 10 - Parenthud, name of "part", position, size.

Example, 523 424 = 523 pixels from left, 424 pixels from top. Based on 800x600 pixels.

hudBuilder.setTextNodeString "Range" - Text to display, to indicate that the number is range. If you want to just display the range numbers and no text to say range, delete the text node.

hudBuilder.setNodeColor 0.4 1 0.4 1 - Colour, values Red Green Blue Alpha. 0 1 0 1 iirc is green, no transparency for example.


You will need to put this in a new .con file called Hudelementsmonocular.con for example (look at the files there to see what I mean).

You also need to add this line to your weapon hud component.

ObjectTemplate.weaponHud.guiIndex 150 - The guiindex of your hud.
ObjectTemplate.weaponHud.hasRangeFinder 1 - To enable rangefinder.

Finally. Look for HudSetupWeapons.con and add to the bottom "run Hudelementsmonocular.con" or whatever you called it. Again, compare to the ones already there.

Code: Select all

hudBuilder.createSplitNode				IngameHud MonocularHud
hudBuilder.setNodeLogicShowVariable 	EQUAL GuiIndex 150


hudBuilder.createTextNode					MonocularHud MonocularRangetext 523 424 40 10
hudBuilder.setTextNodeStyle					Fonts/vehicleHudFont_6.dif 0
hudBuilder.setTextNodeString				"Range"
hudBuilder.setNodeColor		 				0.4 1 0.4 1

hudBuilder.createTextNode					MonocularHud MonocularRangeLabel 552 424 100 10
hudBuilder.setTextNodeStyle					Fonts/vehicleHudFont_6.dif 2
hudBuilder.setTextNodeStringVariable		TargetDistanceString
hudBuilder.setNodeColor		 				0.4 1 0.4 1