Guest User

The Random Specialists v2

a guest
Dec 7th, 2019
138
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. HedgewarsScriptLoad("/Scripts/Locale.lua")
  2.  
  3. local hhs = {}
  4. local weapons = {}
  5. local amount = {}
  6. local hogammo = {}
  7. local hoghealth = {}
  8. local classes = {
  9. [amGrenade] = {loc("Veteran"), "Rambo"},
  10. [amClusterBomb] = {loc("Bomber"), "ushanka"},
  11. [amMortar] = {loc("Terminator"), "Terminator_Glasses"},
  12. [amBee] = {loc("Researcher"), "scif_2001Y"},
  13. [amShotgun] = {loc("Hunter"), "RobinHood"},
  14. [amPickHammer] = {loc("Worker"), "constructor"},
  15. [amRope] = {loc("Ninja"), "NinjaTriangle"},
  16. [amMine] = {loc("Terrorist"), "Skull"},
  17. [amDEagle] = {"Taxi driver", "punkman"},
  18. [amDynamite] = {loc("Pirate"), "pirate_jack"},
  19. [amFirePunch] = {loc("Fighter"), "StrawHatFacial"},
  20. [amWhip] = {loc("Adventurer"), "anzac"},
  21. [amBaseballBat] = {loc("Gangster"), "cap_blue"},
  22. [amParachute] = {loc("Infiltrator"), "Disguise"},
  23. [amAirAttack] = {loc("Colonel"), "war_trenchfrench01"},
  24. [amMineStrike] = {loc("Air General"), "war_desertofficer"},
  25. [amBlowTorch] = {loc("Miner"), "dwarf"},
  26. [amGirder] = {loc("Engineer"), "Glasses"},
  27. [amTeleport] = {loc("Wizard"), "WizardHat"},
  28. [amSwitch] = {"The trickster", "sf_balrog"},
  29. [amBazooka] = {loc("Soldier"), "war_americanww2helmet"},
  30. [amKamikaze] = {loc("Fanatic"), "Mummy"},
  31. [amCake] = {loc("Santa"), "Santa"},
  32. [amSeduction] = {loc("Siren"), "hair_red"},
  33. [amWatermelon] = {loc("Greengrocer"), "fr_banana"},
  34. [amHellishBomb] = {loc("Devil"), "Evil"},
  35. [amNapalm] = {loc("Commander"), "leprechaun"},
  36. [amDrill] = {loc("Oilman"), "flag_usa"},
  37. [amBallgun] = {loc("Joker"), "WhySoSerious"},
  38. [amRCPlane] = {loc("Pilot"), "tf_scout"},
  39. [amLowGravity] = {loc("Alien"), "mv_Venom"},
  40. [amExtraDamage] = {loc("Spartan"), "spartan"},
  41. [amInvulnerable] = {loc("Shaman"), "AkuAku"},
  42. [amExtraTime] = {loc("Turtle"), "zoo_turtle"},
  43. [amLaserSight] = {loc("Cyborg"), "cyborg2"},
  44. [amVampiric] = {loc("Vampire"), "vampirichog"},
  45. [amSniperRifle] = {loc("Sniper"), "hair_green"},
  46. [amJetpack] = {loc("Astronaut"), "Meteorhelmet"},
  47. [amMolotov] = {loc("Thug"), "thugclean"},
  48. [amBirdy] = {loc("Birdman"), "OldMan"},
  49. [amPortalGun] = {loc("Scientist"), "Einstein"},
  50. [amPiano] = {loc("Musician"), "fr_lemon"},
  51. [amGasBomb] = {loc("Infector"), "Gasmask"},
  52. [amSineGun] = {loc("Tesla"), "Moustache"},
  53. [amFlamethrower] = {loc("Pyromaniac"), "poke_charmander"},
  54. [amSMine] = {loc("Trapper"), "rasta"},
  55. [amHammer] = {"Chief Broom", "IndianChief"},
  56. [amResurrector] = {loc("Angel"), "angel"},
  57. [amDrillStrike] = {loc("King"), "crown"},
  58. [amSnowball] = {loc("Kid"), "cap_junior"},
  59. [amTardis] = {"Time traveler", "ShaggyYeti"},
  60. [amLandGun] = {loc("Gardener"), "bushhider"},
  61. [amIceGun] = {"Ice Lord", "snowhog"},
  62. [amKnife] = {loc("Chef"), "chef"},
  63. [amRubber] = {loc("Bouncer"), "bubble"},
  64. [amAirMine] = {loc("Coward"), "barrelhider"},
  65. [amMinigun] = {loc("Clone"), "scif_swStormtrooper"}
  66. }
  67.  
  68. function onNewAmmoStore(groupIndex, hogIndex)
  69. if #weapons == 0 then
  70. for ammotype = 1, AmmoTypeMax do
  71. local count = GetAmmo(ammotype)
  72. if 0 < count and ammotype ~= amSkip then
  73. table.insert(weapons, ammotype)
  74. amount[ammotype] = count
  75. end
  76. end
  77. end
  78.  
  79. if not hogammo[hogIndex] then
  80. hogammo[hogIndex] = {}
  81. end
  82.  
  83. while #hogammo[hogIndex] < 3 do
  84. if #weapons == 0 then EndGame() end
  85. local random = 1 + GetRandom(#weapons)
  86. table.insert(hogammo[hogIndex], weapons[random])
  87. table.remove(weapons, random)
  88. end
  89.  
  90. for i, ammo in ipairs(hogammo[hogIndex]) do
  91. SetAmmo(ammo, amount[ammo], 0, 0, 0)
  92. end
  93.  
  94. SetAmmo(amSkip, 9, 0, 0, 0)
  95. end
  96.  
  97. function onGameInit()
  98. DisableGameFlags(gfSharedAmmo, gfKing)
  99. EnableGameFlags(gfPerHogAmmo, gfResetWeps)
  100.  
  101. HealthCaseProb = 100
  102. end
  103.  
  104. function onGameStart()
  105. currTeam = ""
  106. lastTeam = ""
  107. z = 0
  108. mission = {}
  109.  
  110. for i in ipairs(hhs) do
  111.  
  112. currTeam = GetHogTeamName(hhs[i])
  113.  
  114. if currTeam == lastTeam then
  115. z = z + 1
  116. else
  117. z = 0
  118. end
  119.  
  120. if not hoghealth[z] then hoghealth[z] = 80 + GetRandom(13) * 10 end
  121. SetHealth(hhs[i], hoghealth[z])
  122. SetHogName(hhs[i], classes[hogammo[z][1]][1])
  123. SetHogHat(hhs[i], classes[hogammo[z][1]][2])
  124.  
  125. mission[1 + z] = string.format("%s: %s, %s, %s", classes[hogammo[z][1]][1], GetAmmoName(hogammo[z][1]), GetAmmoName(hogammo[z][2]), GetAmmoName(hogammo[z][3]))
  126.  
  127. lastTeam = GetHogTeamName(hhs[i])
  128.  
  129. end
  130.  
  131. ShowMission(loc("Random Specialists"), loc("minigame"), table.concat(mission, "|"), 0, 0)
  132. end
  133.  
  134. function onNewTurn()
  135. AddCaption(string.format(loc("Prepare yourself, %s!"), GetHogName(CurrentHedgehog)))
  136. end
  137.  
  138. function onGearAdd(gear)
  139. if GetGearType(gear) == gtHedgehog then
  140. table.insert(hhs, gear)
  141. elseif GetGearType(gear) == gtRCPlane then
  142. SetHealth(gear, 1)
  143. elseif GetGearType(gear) == gtAirAttack then
  144. SetHealth(gear, 1)
  145. elseif GetGearType(gear) == gtDrill and band(GetState(gear), gsttmpFlag) == 0 then
  146. SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
  147. elseif GetGearType(gear) == gtCake then
  148. SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
  149. end
  150. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×