Advertisement
Guest User

explosive eyes

a guest
Dec 27th, 2019
659
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ------ BEGIN SCRIPT ------
  2. -- Copy and Paste this text into an empty text file, and save it as
  3. -- YOURTITLEHERE.lua, in your Data/Missions/Training/ folder.
  4.  
  5. HedgewarsScriptLoad("/Scripts/Locale.lua")
  6. HedgewarsScriptLoad("/Scripts/Tracker.lua")
  7.  
  8. local hhs = {}
  9.  
  10. local wepArray = {
  11. amBazooka, amBee, amMortar, amDrill, amSnowball,
  12. amGrenade, amClusterBomb, amMolotov, amWatermelon, amHellishBomb, amGasBomb,
  13. amShotgun, amDEagle, amSniperRifle, amSineGun, amLandGun, amIceGun,
  14. amFirePunch, amWhip, amBaseballBat, amKamikaze, amSeduction, amHammer,
  15. amMine, amDynamite, amCake, amBallgun, amRCPlane, amSMine, amAirMine,
  16. amAirAttack, amMineStrike, amDrillStrike, amNapalm, amPiano, amBirdy,
  17. amBlowTorch, amPickHammer, amGirder, amRubber, amPortalGun,
  18. amRope, amParachute, amTeleport, amJetpack,
  19. amInvulnerable, amLaserSight, amVampiric,
  20. amLowGravity, amExtraDamage, amExtraTime, amResurrector, amTardis, amSwitch
  21. }
  22.  
  23. function onGameInit()
  24.  
  25. ClearGameFlags()
  26. EnableGameFlags(gfDisableWind, gfDisableGirders, gfDisableLandObjects, gfPerHogAmmo)
  27. Map = "Eyes"
  28. Theme = "Nature"
  29. TurnTime = 45000
  30. Explosives = 0
  31. MinesNum = 0
  32. CaseFreq = 0
  33. Delay = 100
  34. HealthCaseProb = 35
  35. HealthCaseAmount = 25
  36. DamagePercent = 100
  37. MinesTime = 3000
  38. MineDudPercent = 0
  39. SuddenDeathTurns = 50
  40. WaterRise = 0
  41. HealthDecrease = 1
  42.  
  43. ------ TEAM LIST ------
  44.  
  45. AddTeam("The Fruit", "0xff4980c1", "Cherry", "Castle", "Default", "cm_mog")
  46. hhs[1] = AddHog("The Rotten", 0, 1, "fr_apple")
  47. SetGearPosition(hhs[1], 734, 505)
  48. setGearValue(hhs[1], "tag", "failure")
  49.  
  50. AddTeam("Fruit", "0xff1de6ba", "Cherry", "Castle", "Default", "cm_mog")
  51. hhs[2] = AddHog("Juicy", 1, 1, "fr_lemon")
  52. SetGearPosition(hhs[2], 772, 175)
  53. hhs[3] = AddHog("Sweet", 1, 1, "fr_tomato")
  54. SetGearPosition(hhs[3], 1495, 230)
  55. hhs[4] = AddHog("Fruity", 1, 1, "fr_banana")
  56. SetGearPosition(hhs[4], 522, 27)
  57. hhs[5] = AddHog("Ripe", 1, 1, "fr_orange")
  58. SetGearPosition(hhs[5], 683, 314)
  59. hhs[6] = AddHog("Squishy", 1, 1, "fr_pumpkin")
  60. SetGearPosition(hhs[6], 1610, 259)
  61. hhs[7] = AddHog("Sour", 1, 1, "fr_lemon")
  62. SetGearPosition(hhs[7], 1174, 457)
  63. hhs[8] = AddHog("Bitter", 1, 1, "fr_lemon")
  64. SetGearPosition(hhs[8], 1907, 738)
  65.  
  66. AddTeam("Clowns", "0xff1de6ba", "Rubberduck", "Castle", "Mobster", "cm_birdy")
  67. hhs[9] = AddHog("Chester", 1, 1, "Joker")
  68. SetGearPosition(hhs[9], 808, 661)
  69. hhs[10] = AddHog("Buster", 1, 1, "clown")
  70. SetGearPosition(hhs[10], 134, 493)
  71. hhs[11] = AddHog("Molly", 1, 1, "WhySoSerious")
  72. SetGearPosition(hhs[11], 972, 862)
  73. hhs[12] = AddHog("Bozo", 1, 1, "clown-copper")
  74. SetGearPosition(hhs[12], 866, 484)
  75. hhs[13] = AddHog("Loopy", 1, 1, "clown-crossed")
  76. SetGearPosition(hhs[13], 450, 315)
  77. hhs[14] = AddHog("Bobo", 1, 1, "clown-crossed")
  78. SetGearPosition(hhs[14], 562, 275)
  79. hhs[15] = AddHog("Giggles", 1, 1, "clown-copper")
  80. SetGearPosition(hhs[15], 1136, 282)
  81. hhs[16] = AddHog("Baggy", 1, 1, "clown-copper")
  82. SetGearPosition(hhs[16], 196, 819)
  83.  
  84. AddTeam("The Zoo", "0xff1de6ba", "Bone", "Castle", "Default", "cm_hurrah")
  85. hhs[17] = AddHog("Sheepy", 1, 1, "zoo_Sheep")
  86. SetGearPosition(hhs[17], 560, 620)
  87. hhs[18] = AddHog("Deer", 1, 1, "zoo_Deer")
  88. SetGearPosition(hhs[18], 1509, 592)
  89. hhs[19] = AddHog("Fishy", 1, 1, "zoo_fish")
  90. SetGearPosition(hhs[19], 676, 65)
  91. hhs[20] = AddHog("Batty", 1, 1, "zoo_Bat")
  92. SetGearPosition(hhs[20], 2020, 767)
  93. hhs[21] = AddHog("Bacon", 1, 1, "zoo_Pig")
  94. SetGearPosition(hhs[21], 1377, 703)
  95. hhs[22] = AddHog("Legs", 1, 1, "zoo_frog")
  96. SetGearPosition(hhs[22], 1924, 885)
  97. setGearValue(hhs[22], "tag", "victory")
  98. hhs[23] = AddHog("Horns", 1, 1, "zoo_Moose")
  99. SetGearPosition(hhs[23], 458, 557)
  100. hhs[24] = AddHog("Tails", 1, 1, "zoo_Beaver")
  101. SetGearPosition(hhs[24], 1578, 39)
  102.  
  103.  
  104. end
  105.  
  106. function LoadHogWeapons()
  107.  
  108. for i = 1,24 do
  109. AddAmmo(hhs[i], amBazooka, 100)
  110. AddAmmo(hhs[i], amGrenade, 100)
  111. AddAmmo(hhs[i], amRope, 100)
  112. end
  113.  
  114. end
  115.  
  116.  
  117. function LoadSprite(pX, pY, pSprite, pFrame, pTint, p1, p2, p3, pLandFlags)
  118. PlaceSprite(pX, pY, pSprite, pFrame, pTint, p1, p2, p3, pLandFlags)
  119. end
  120.  
  121.  
  122. function LoadGearData()
  123.  
  124. --BEGIN CORE DATA--
  125.  
  126. ------ PORTAL DISTANCE and UFO FUEL ------
  127. ufoFuel = 0
  128. portalDistance = 5000
  129.  
  130. ------ GIRDER LIST ------
  131. LoadSprite(732, 532, sprAmGirder, 7, 4294967295, nil, nil, nil, lfNormal)
  132.  
  133. ------ UTILITY CRATE LIST ------
  134.  
  135. ------ BARREL LIST ------
  136. SetHealth(AddGear(143, 556, gtExplosives, 0, 0, 0, 0), 1)
  137. SetHealth(AddGear(363, 689, gtExplosives, 0, 0, 0, 0), 1)
  138. SetHealth(AddGear(740, 696, gtExplosives, 0, 0, 0, 0), 1)
  139. SetHealth(AddGear(524, 343, gtExplosives, 0, 0, 0, 0), 1)
  140. SetHealth(AddGear(563, 95, gtExplosives, 0, 0, 0, 0), 1)
  141. SetHealth(AddGear(967, 101, gtExplosives, 0, 0, 0, 0), 1)
  142. SetHealth(AddGear(1017, 316, gtExplosives, 0, 0, 0, 0), 1)
  143. SetHealth(AddGear(1264, 637, gtExplosives, 0, 0, 0, 0), 1)
  144. SetHealth(AddGear(1054, 968, gtExplosives, 0, 0, 0, 0), 1)
  145. SetHealth(AddGear(1397, 944, gtExplosives, 0, 0, 0, 0), 1)
  146. SetHealth(AddGear(1450, 693, gtExplosives, 0, 0, 0, 0), 1)
  147. SetHealth(AddGear(1784, 419, gtExplosives, 0, 0, 0, 0), 1)
  148. SetHealth(AddGear(1539, 286, gtExplosives, 0, 0, 0, 0), 1)
  149. SetHealth(AddGear(1607, 79, gtExplosives, 0, 0, 0, 0), 1)
  150. SetHealth(AddGear(448, 610, gtExplosives, 0, 0, 0, 0), 1)
  151. SetHealth(AddGear(1759, 789, gtExplosives, 0, 0, 0, 0), 1)
  152. SetHealth(AddGear(1888, 771, gtExplosives, 0, 0, 0, 0), 1)
  153. SetHealth(AddGear(2012, 799, gtExplosives, 0, 0, 0, 0), 1)
  154. SetHealth(AddGear(1865, 962, gtExplosives, 0, 0, 0, 0), 1)
  155. SetHealth(AddGear(79, 960, gtExplosives, 0, 0, 0, 0), 1)
  156.  
  157. --END CORE DATA--
  158.  
  159. LoadHogWeapons()
  160.  
  161. end
  162.  
  163.  
  164. function onGameStart()
  165.  
  166. LoadGearData()
  167. DetermineMissionGoal()
  168.  
  169. end
  170.  
  171.  
  172. function onNewTurn()
  173. --insert code according to taste
  174. end
  175.  
  176.  
  177. function onGameTick()
  178. runOnGears(UpdateTagCircles)
  179. end
  180.  
  181. function UpdateTagCircles(gear)
  182. if getGearValue(gear,"tag") ~= nil then
  183. if getGearValue(gear,"tCirc") == nil then
  184. setGearValue(gear, "tCirc",AddVisualGear(0,0,vgtCircle,0,true))
  185. end
  186.  
  187. if getGearValue(gear,"tag") == "victory" then
  188. SetVisualGearValues(getGearValue(gear,"tCirc"), GetX(gear), GetY(gear), 100, 255, 1, 10, 0, 150, 3, 0xff0000ff)
  189. elseif getGearValue(gear,"tag") == "failure" then
  190. SetVisualGearValues(getGearValue(gear,"tCirc"), GetX(gear), GetY(gear), 100, 255, 1, 10, 0, 150, 3, 0x00ff00ff)
  191. elseif getGearValue(gear,"tag") == "collection" then
  192. SetVisualGearValues(getGearValue(gear,"tCirc"), GetX(gear), GetY(gear), 100, 255, 1, 10, 0, 150, 3, 0x0000ffff)
  193. end
  194. end
  195. end
  196.  
  197. function CheckForConditions(gear)
  198. if getGearValue(gear,"tag") == "victory" then
  199. victoryObj = victoryObj +1
  200. elseif getGearValue(gear,"tag") == "failure" then
  201. failObj = failObj +1
  202. elseif getGearValue(gear,"tag") == "collection" then
  203. collectObj = collectObj +1
  204. end
  205. end
  206.  
  207. function CheckForConclusion(gear)
  208.  
  209. if getGearValue(gear,"tag") == "failure" then
  210. EndGameIn("failure")
  211. else
  212.  
  213. victoryObj = 0
  214. failObj = 0
  215. collectObj = 0
  216. runOnGears(CheckForConditions)
  217.  
  218. if GetGearType(gear) ~= gtCase then
  219.  
  220. victoryObj = victoryObj - 1
  221.  
  222. if (victoryObj == 0) and (collectObj == 0) then
  223. EndGameIn("victory")
  224. end
  225.  
  226. else
  227.  
  228. if (GetGearMessage(gear) == 256) and (getGearValue(gear,"tag") == "collection") then
  229. if GetHogLevel(CurrentHedgehog) ~= 0 then
  230. EndGameIn("failure")
  231. else
  232. collectObj = collectObj - 1
  233. if (victoryObj == 0) and (collectObj == 0) then
  234. EndGameIn("victory")
  235. end
  236. end
  237. elseif (GetGearMessage(gear) == 0) and (getGearValue(gear,"tag") == "victory") then
  238. victoryObj = victoryObj - 1
  239. if (victoryObj == 0) and (collectObj == 0) then
  240. EndGameIn("victory")
  241. end
  242. else
  243. EndGameIn("failure")
  244. end
  245.  
  246. end
  247.  
  248. end
  249.  
  250. end
  251.  
  252. function DetermineMissionGoal()
  253.  
  254. victoryObj = 0
  255. failObj = 0
  256. collectObj = 0
  257. vComment = ""
  258. fComment = ""
  259. collectComment = ""
  260.  
  261. runOnGears(CheckForConditions)
  262.  
  263. if victoryObj > 0 then
  264. if victoryObj == 1 then
  265. vComment = loc("Destroy the red target")
  266. else
  267. vComment = loc("Destroy the red targets")
  268. end
  269. end
  270.  
  271. if collectObj > 0 then
  272. if collectObj == 1 then
  273. collectComment = loc("Collect the blue target")
  274. else
  275. collectComment = loc("Collect all the blue targets")
  276. end
  277. end
  278.  
  279. if (collectObj == 0) and (victoryObj == 0) then
  280. vComment = loc("Destroy the enemy.")
  281. end
  282.  
  283. if failObj > 0 then
  284. if failObj == 1 then
  285. fComment = loc("The green target must survive")
  286. else
  287. fComment = loc("The green targets must survive")
  288. end
  289. end
  290.  
  291. ShowMission(loc("User Challenge"), loc("Mission Goals") .. ":", collectComment .. "|" .. vComment .. "|" .. fComment, 0, 0)
  292.  
  293. end
  294.  
  295. function isATrackedGear(gear)
  296. if (GetGearType(gear) == gtHedgehog) or
  297. (GetGearType(gear) == gtExplosives) or
  298. (GetGearType(gear) == gtMine) or
  299. (GetGearType(gear) == gtSMine) or
  300. (GetGearType(gear) == gtAirMine) or
  301. (GetGearType(gear) == gtTarget) or
  302. (GetGearType(gear) == gtKnife) or
  303. (GetGearType(gear) == gtPortal) or
  304. (GetGearType(gear) == gtCase)
  305. then
  306. return(true)
  307. else
  308. return(false)
  309. end
  310. end
  311.  
  312.  
  313. function onGearAdd(gear)
  314. if isATrackedGear(gear) then
  315. trackGear(gear)
  316. end
  317. end
  318.  
  319.  
  320. function EndGameIn(c)
  321.  
  322. teamCounter = 0
  323. lastRecordedTeam = ""
  324. for i = 1, #hhs do
  325.  
  326. if GetHogTeamName(hhs[i]) ~= lastRecordedTeam then --er, is this okay without nill checks?
  327.  
  328. lastRecordedTeam = GetHogTeamName(hhs[i])
  329. teamCounter = teamCounter + 1
  330. if teamCounter == 9 then
  331. teamCounter = 1
  332. end
  333.  
  334. if (c == "victory") and (GetHogLevel(hhs[i]) ~= 0) then
  335. DismissTeam(GetHogTeamName(hhs[i]))
  336. ShowMission(loc("User Challenge"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0)
  337. elseif (c == "failure") and (GetHogLevel(hhs[i]) == 0) then
  338. DismissTeam(GetHogTeamName(hhs[i]))
  339. ShowMission(loc("User Challenge"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
  340. elseif (c == "victory") and (GetHogLevel(hhs[i]) == 0) then
  341. PlaySound(sndVictory,hhs[i]) -- check if we actually need this
  342. end
  343.  
  344. end
  345.  
  346. end
  347.  
  348. end
  349.  
  350.  
  351. function onGearDelete(gear)
  352.  
  353. --insert code according to taste
  354.  
  355. if isATrackedGear(gear) then
  356.  
  357. if getGearValue(gear,"tag") ~= nil then
  358. CheckForConclusion(gear)
  359. end
  360.  
  361. if getGearValue(gear, "tCirc") ~= nil then
  362. DeleteVisualGear(getGearValue(gear, "tCirc"))
  363. end
  364.  
  365. trackDeletion(gear)
  366.  
  367. end
  368.  
  369. end
  370.  
  371.  
  372. --enable and/or alter code according to taste
  373. function onAmmoStoreInit()
  374.  
  375. for i = 1, #wepArray do
  376. SetAmmo(wepArray[i], 0, 0, 0, 1)
  377. end
  378.  
  379. SetAmmo(amSkip, 9, 0, 0, 0)
  380.  
  381. end
  382.  
  383. ------ END GENERATED MISSION ------
  384.  
  385. function GeneratePreviewData()
  386.  
  387. PreviewGirder(732, 532, 7)
  388. PreviewPlacedGear(143, 556)
  389. PreviewPlacedGear(363, 689)
  390. PreviewPlacedGear(740, 696)
  391. PreviewPlacedGear(524, 343)
  392. PreviewPlacedGear(563, 95)
  393. PreviewPlacedGear(967, 101)
  394. PreviewPlacedGear(1017, 316)
  395. PreviewPlacedGear(1264, 637)
  396. PreviewPlacedGear(1054, 968)
  397. PreviewPlacedGear(1397, 944)
  398. PreviewPlacedGear(1450, 693)
  399. PreviewPlacedGear(1784, 419)
  400. PreviewPlacedGear(1539, 286)
  401. PreviewPlacedGear(1607, 79)
  402. PreviewPlacedGear(448, 610)
  403. PreviewPlacedGear(1759, 789)
  404. PreviewPlacedGear(1888, 771)
  405. PreviewPlacedGear(2012, 799)
  406. PreviewPlacedGear(1865, 962)
  407. PreviewPlacedGear(79, 960)
  408. PreviewPlacedGear(672, 553)
  409. PreviewPlacedGear(672, 548)
  410. PreviewPlacedGear(674, 552)
  411.  
  412. end
  413.  
  414.  
  415. --BEGIN HWMAP CONVERTER POINTS--
  416. -- You can paste this data into the HWMAP converter if needed.
  417. --[[
  418.  
  419. 5000 0 98
  420. 732 532 107
  421. 143 556 15
  422. 363 689 15
  423. 740 696 15
  424. 524 343 15
  425. 563 95 15
  426. 967 101 15
  427. 1017 316 15
  428. 1264 637 15
  429. 1054 968 15
  430. 1397 944 15
  431. 1450 693 15
  432. 1784 419 15
  433. 1539 286 15
  434. 1607 79 15
  435. 448 610 15
  436. 1759 789 15
  437. 1888 771 15
  438. 2012 799 15
  439. 1865 962 15
  440. 79 960 15
  441. 672 553 20
  442. 672 548 25
  443. 674 552 63
  444.  
  445. --]]
  446. --END HWMAP CONVERTER POINTS--
  447.  
  448. ------ END GENERATED SCRIPT ------
Advertisement
RAW Paste Data Copied
Advertisement