DatAmazingCheese

Scope HUD - DatAmazingCheese

Oct 22nd, 2016
634
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @name Scope HUD - DatAmazingCheese
  2. @inputs Button [Cam Pod EGP]:wirelink [Gun Base]:entity EndPos:vector GunReady AmmoCount
  3. @inputs RPM Gear
  4. @outputs Guide:vector Res:vector2
  5. @persist CompassColor:vector
  6. @trigger Active GunReady Mouse1 Button
  7.  
  8. #[
  9.  
  10. ChangeLog
  11.  
  12. -V1
  13. +Added scope
  14.  
  15. -V1.1
  16. +Added reticles
  17. +Added ballistics marker
  18.  
  19. -V1.2
  20. +Added missile guidance for mouse location
  21. +Added crosshairs
  22.  
  23. -V1.3
  24. +Added compass
  25. +Added ammo Counter
  26. +Added ready indicator
  27. -Changed crosshairs
  28.  
  29. -V1.4
  30. +Added dynamic scaling
  31.  
  32. -V1.5
  33. +Fixed dynamic scaling based on resolution, courtesy of Danny
  34. +Fixed compass bugs
  35. -Changed crosshairs
  36.  
  37. -V1.6
  38. +Added EGP Extras Support
  39.  
  40. -V1.61
  41. +Fixed bugs
  42.  
  43.  
  44.  
  45. #########################################################################################################################
  46.  
  47. #Hello, this is a scope HUD for tanks made by DatAmazingCheese with the help of Tyunge for the outer part of the scope.
  48. #Please by all means give this to your friends, but do not claim it as your own. I will find you.
  49.  
  50. #It's recommended you download EGP Extras and turn on "Extra Mode" in the options to have less of an impact on FPS
  51.  
  52. # http://steamcommunity.com/sharedfiles/filedetails/?id=769791162 #
  53.  
  54. ]#
  55.  
  56. Active = Pod["Active",number]
  57. Mouse1 = Pod["Mouse1",number]
  58.  
  59. Version = "1.61"
  60.  
  61. if( first() #[| changed(EGP)]# | changed(Active)&Active){
  62.  
  63. setName("Scope HUD - DatAmazingCheese V" + Version)
  64.  
  65. EGP:egpClear()
  66.  
  67. ### Variables ##
  68.  
  69. CompassSize = 140 ## The size of the compass ##
  70.  
  71. CompassColor = vec(255,255,255) ## The color of the tank in the compass ##
  72.  
  73. Debug = 0 ## For debugging resolution, you shouldn't need to touch this ##
  74.  
  75. Extras = 1 ## Set this to 1 if you have EGP Extras installed ##
  76.  
  77. CrosshairType = "russian" ## Either 'russian' or 'german' this only works with EGP Extras installed & Extras set to 1 ##
  78.  
  79.  
  80. #DO NOT TOUCH UNDER
  81.  
  82. #########################################################################################################################
  83.  
  84. holoCreate(1)
  85. holoAlpha(1,0)
  86. holoCreate(2)
  87. holoAlpha(2,0)
  88.  
  89. #EGP:egpDrawTopLeft(0)
  90.  
  91. Res = egpScrSize(Pod["Entity",entity]:driver())
  92. #Res = vec2(1600,1200)
  93.  
  94. ### Static Index EGP Elements
  95.  
  96. if(Extras == 1)
  97. {
  98.  
  99. EGP:egpBox(24,Res/2,Res/0.55)
  100. EGP:egpMaterial(24,"egpextras/textures/tank/overlays/sniperblack.png")
  101.  
  102. EGP:egpBox(25,Res/2,vec2(1024,1024)/1.05)
  103. EGP:egpMaterial(25,"egpextras/textures/tank/reticles/"+ CrosshairType + "crosshair01.png")
  104.  
  105. }
  106. else
  107. {
  108.  
  109. EGP:egpBox(1,Res/2,vec2(10000,3)) #Line Horiz
  110. EGP:egpColor(1,vec(0,0,0))
  111.  
  112. EGP:egpBox(2,Res/2,vec2(3,10000)) #Line Vert
  113. EGP:egpColor(2,vec(0,0,0))
  114.  
  115. }
  116.  
  117. EGP:egp3DTracker(3,vec(0,0,0)) #Reticle tracker
  118. EGP:egpParent(3,holoEntity(1))
  119.  
  120. EGP:egpCircleOutline(4,vec2(0,0),vec2(7,7)) #Reticle dot
  121. EGP:egpColor(4,vec(0,200,0))
  122. EGP:egpParent(4,3)
  123.  
  124. EGP:egp3DTracker(5,vec(0,0,0)) #Ballistics tracker
  125. EGP:egpParent(5,holoEntity(2))
  126.  
  127. EGP:egpCircleOutline(6,vec2(0,0),vec2(5,5)) #Ballistics dot
  128. EGP:egpColor(6,vec(200,0,0))
  129. EGP:egpParent(6,5)
  130.  
  131. EGP:egpCircleOutline(7,Res/2,vec2(15,15))
  132. EGP:egpColor(7,vec(0,200,0))
  133.  
  134. EGP:egpCircleOutline(8,Res/2,vec2(14,14))
  135. EGP:egpColor(8,vec(0,200,0))
  136.  
  137. if(Debug==1)
  138. {
  139. EGP:egpBoxOutline(900,Res/2,Res)
  140. }
  141.  
  142. ### Variable Index EGP Elements
  143. if(Extras == 0)
  144. {
  145. for (I=50,100)
  146. {
  147. I++
  148. Sin = sin((360 / 50) * I) * (Res:y())
  149. Cos = cos((360 / 50) * I) * (Res:y())
  150.  
  151. EGP:egpBox(I, Res/2 + vec2(Sin, Cos), vec2(Res:y()+100, Res:y()+100))
  152. EGP:egpAngle(I, (((I / 50) * 360)))
  153. EGP:egpColor(I, vec4(0, 0, 0, 0))
  154. }
  155. }
  156.  
  157. rangerFilter(Gun)
  158. rangerFilter(entity():getConstraints())
  159. rangerPersist(1)
  160.  
  161. ###Speed / RPM / Gear###
  162.  
  163. #Gear
  164.  
  165. EGP:egpText(9,"GEAR",vec2(50,50))
  166. EGP:egpSize(9,40)
  167. EGP:egpFont(9,"")
  168.  
  169. #Gear Number
  170.  
  171. EGP:egpText(10 ,""+Gear,vec2(250,50))
  172. EGP:egpSize(10, 40)
  173. EGP:egpAlign(10,2,0)
  174. EGP:egpFont(10,"")
  175.  
  176. #RPM
  177.  
  178. EGP:egpText(11,"RPM",vec2(50,80))
  179. EGP:egpSize(11,40)
  180. EGP:egpFont(11,"")
  181.  
  182. #RPM Number
  183.  
  184. EGP:egpText(12,""+RPM ,vec2(240,80))
  185. EGP:egpSize(12,40)
  186. EGP:egpAlign(12,1,0)
  187. EGP:egpFont(12,"")
  188.  
  189.  
  190. #Speed
  191.  
  192. EGP:egpText(13,"SPD",vec2(50,110))
  193. EGP:egpSize(13,40)
  194. EGP:egpFont(13,"")
  195.  
  196. #Speed Number
  197.  
  198. EGP:egpText(14 ,"123" ,vec2(250,110))
  199. EGP:egpSize(14, 40)
  200. EGP:egpAlign(14,2,0)
  201. EGP:egpFont(14,"")
  202.  
  203. #Speed KMH
  204.  
  205. EGP:egpText(15,"km/h" ,vec2(255,118))
  206. EGP:egpSize(15,30)
  207. EGP:egpFont(15,"")
  208.  
  209. ###COMPASS###
  210.  
  211. CCPos = vec2((CompassSize+50),Res:y()-(CompassSize+50))
  212.  
  213. #Compass Dummy
  214.  
  215. EGP:egpBox(16,CCPos,vec2(0,0))
  216. EGP:egpAlpha(16,0)
  217.  
  218. #Compass Circle
  219.  
  220. EGP:egpCircle(17,vec2(0,0),vec2(CompassSize,CompassSize))
  221. EGP:egpColor(17,vec(60,60,60))
  222. EGP:egpAlpha(17,200)
  223. EGP:egpParent(17,16)
  224.  
  225. #Hull Dummy
  226.  
  227. EGP:egpCircle(18,CCPos,vec2(0,0))
  228. EGP:egpAlpha(18,0)
  229.  
  230. #Hull
  231.  
  232. TDR = array(vec2(35,-55),vec2(35,55),vec2(-35,55),vec2(-35,-55),vec2(0,-65))
  233. EGP:egpPolyOutline(19,TDR)
  234. EGP:egpColor(19,CompassColor)
  235. EGP:egpSize(19,2)
  236. EGP:egpParent(19,18)
  237.  
  238. #Turret Dummy
  239.  
  240. EGP:egpCircle(20,CCPos,vec2(0,0))
  241. EGP:egpAlpha(20,0)
  242.  
  243. #Turret
  244.  
  245. EGP:egpTriangleOutline(21,vec2(0,-50),vec2(30,25),vec2(-30,25))
  246. EGP:egpColor(21,CompassColor)
  247. EGP:egpSize(21,2)
  248. EGP:egpParent(21,20)
  249.  
  250. ###Ammo###
  251.  
  252. #Ammo Circle
  253.  
  254. EGP:egpCircle(22,CCPos+vec2(CompassSize+60,CompassSize-60),vec2(60,60))
  255. EGP:egpColor(22, vec4(60, 220, 60, 60))
  256. EGP:egpAngle(22, 90)
  257. EGP:egpSize(22, 360)
  258.  
  259. #Ammo Counter
  260.  
  261. EGP:egpText(23 ,"0" ,CCPos+vec2(CompassSize+60,CompassSize-60))
  262. EGP:egpSize(23,70)
  263. EGP:egpAlign(23,1,1)
  264.  
  265. }
  266. else
  267. {
  268.  
  269. #Missile Guidance Pos
  270.  
  271. Guide = Cam["Trace",ranger]:pos()
  272.  
  273. timer("ballistics",5000)
  274.  
  275. #3DTracker Pos
  276.  
  277. holoPos(1,rangerOffset(9999999999,Gun:pos()+Gun:forward()*100,Gun:forward()):position())
  278.  
  279. holoPos(2,EndPos)
  280.  
  281. #Color of crosshair based on gun ready
  282.  
  283. EGP:egpColor(7,vec(255*!GunReady,200*GunReady,0))
  284. EGP:egpColor(8,vec(255*!GunReady,200*GunReady,0))
  285. EGP:egpColor(22,vec(255*!GunReady,200*GunReady,0))
  286.  
  287. #Scope
  288.  
  289. if(Button)
  290. {
  291. EGP:egpAlpha(1,255) EGP:egpAlpha(2,255) EGP:egpAlpha(7,0) EGP:egpAlpha(8,0) EGP:egpAlpha(24,255) EGP:egpAlpha(25,255)
  292. for(I=50,100)
  293. {
  294. EGP:egpAlpha(I,255)
  295. }
  296. }
  297.  
  298.  
  299.  
  300. if(Button == 0)
  301. {
  302. EGP:egpAlpha(1,0) EGP:egpAlpha(2,0) EGP:egpAlpha(7,255) EGP:egpAlpha(8,255) EGP:egpAlpha(24,0) EGP:egpAlpha(25,0)
  303. for(I=50,100)
  304. {
  305. EGP:egpAlpha(I,0)
  306. }
  307. }
  308.  
  309. #Changing Text
  310.  
  311. if(changed(Gear)){EGP:egpSetText(10,""+floor(Gear))}
  312. EGP:egpSetText(12,""+int(RPM/100)*100)
  313. KPH= floor(Base:vel():length() / 10.9)
  314. EGP:egpSetText(14,""+KPH)
  315.  
  316. #Changing Angles
  317.  
  318. EGP:egpAngle(16,-Cam["CamAng",angle]:yaw()+90)
  319. EGP:egpAngle(18,(Base:angles():yaw()-90)+EGP:egpAngle(16))
  320. EGP:egpAngle(20,(Gun:angles():yaw()-90)+EGP:egpAngle(16))
  321.  
  322. #AmmoCount
  323.  
  324. if(changed(AmmoCount))
  325. {
  326. EGP:egpSetText(23,""+AmmoCount)
  327. }
  328.  
  329. #Endpos Disable
  330.  
  331. if(clk("ballistics"))
  332. {
  333. if(EndPos == vec(0,0,0))
  334. {
  335. EGP:egpAlpha(6,0)
  336. }
  337. else
  338. {
  339. EGP:egpAlpha(6,255)
  340. }
  341. }
  342.  
  343. interval(100)
  344.  
  345. }
  346.  
  347. if(last())
  348. {
  349. EGP:egpClear()
  350. }
  351. if(dupefinished()|duped())
  352. {
  353. reset()
  354. }
RAW Paste Data