Guest User

The Random Specialists v2

a guest
Dec 8th, 2019
109
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] = {loc("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] = {loc("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] = {loc("Chief Broom"), "IndianChief"},
  56. [amResurrector] = {loc("Angel"), "angel"},
  57. [amDrillStrike] = {loc("King"), "crown"},
  58. [amSnowball] = {loc("Kid"), "cap_junior"},
  59. [amTardis] = {loc("Time traveler"), "ShaggyYeti"},
  60. [amLandGun] = {loc("Gardener"), "bushhider"},
  61. [amIceGun] = {loc("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. -- UMK: The class if no weapons are set:
  67. [amNothing] = {loc("Zombie"), "Zombie"};
  68. }
  69.  
  70. function onNewAmmoStore(groupIndex, hogIndex)
  71. if #weapons == 0 then
  72. for ammotype = 1, AmmoTypeMax do
  73. local count = GetAmmo(ammotype)
  74. if count > 0 and ammotype ~= amSkip then -- UMK: "0 < count" changed to "count > 0"
  75. table.insert(weapons, ammotype)
  76. amount[ammotype] = count
  77. end
  78. end
  79. end
  80.  
  81. if not hogammo[hogIndex] then
  82. hogammo[hogIndex] = {}
  83. end
  84.  
  85. -- UMK: You can change the number 3 below to any number (>0) for as many weapons that you want.
  86. while #hogammo[hogIndex] < 3 do
  87. -- UMK: This will end the match if no weapons are set, which will hard-lock the game. Do not enable.
  88. --if #weapons == 0 then EndGame() end
  89. local randomx = 1
  90. --{ UMK: Added a condition barrier so it won't cause errors.
  91. if #weapons > 0 then
  92. randomx = randomx + GetRandom(#weapons)
  93. table.insert(hogammo[hogIndex], weapons[randomx])
  94. table.remove(weapons, randomx)
  95. else
  96. table.insert(hogammo[hogIndex], 0) -- Set weapon to amNothing so it has an index.
  97. end -- }
  98. end
  99.  
  100. for i, ammo in ipairs(hogammo[hogIndex]) do
  101. SetAmmo(ammo, amount[ammo], 0, 0, 0)
  102. end
  103.  
  104. SetAmmo(amSkip, 9, 0, 0, 0)
  105. end
  106.  
  107. function onGameInit()
  108. DisableGameFlags(gfSharedAmmo, gfKing)
  109. EnableGameFlags(gfPerHogAmmo, gfResetWeps)
  110.  
  111. HealthCaseProb = 100
  112. end
  113.  
  114. function onGameStart()
  115. currTeam = ""
  116. lastTeam = ""
  117. team = 0 -- UMK: Team index
  118. mission = {}
  119.  
  120. for i in ipairs(hhs) do
  121.  
  122. currTeam = GetHogTeamName(hhs[i])
  123.  
  124. if currTeam == lastTeam then
  125. team = team + 1
  126. else
  127. team = 0
  128. end
  129.  
  130. if not hoghealth[team] then hoghealth[team] = 80 + GetRandom(13) * 10 end
  131. SetHealth(hhs[i], hoghealth[team])
  132. SetHogName(hhs[i], classes[hogammo[team][1]][1])
  133. SetHogHat(hhs[i], classes[hogammo[team][1]][2])
  134.  
  135. --[ UMK: You can revert this, aka delete all my edits below, and it still be okay.
  136. local NoWeapon, wea = "Empty Hands", {}
  137. for i=1,#hogammo[team] do
  138. wea[i] = hogammo[team][i] ~= 0 and GetAmmoName(hogammo[team][i]) or ""
  139. wea[i] = i > 1 and wea[i] ~= "" and ", "..wea[i] or wea[i]
  140. wea[i] = i == #hogammo[team] and wea[1] == "" and "No weapons" or wea[i]
  141. end
  142. mission[1 + team] = tostring(classes[hogammo[team][1]][1]..": ".. table.concat(wea))
  143.  
  144. mission[1 + team] = mission[1 + team] ~= mission[team] and mission[1 + team] or ""
  145. --]]
  146.  
  147. -- This is the old line. It also works.
  148. --mission[1 + team] = string.format("%s: %s, %s, %s", classes[hogammo[team][1]][1], GetAmmoName(hogammo[team][1]), GetAmmoName(hogammo[team][2]), GetAmmoName(hogammo[team][3]))
  149.  
  150. lastTeam = GetHogTeamName(hhs[i])
  151.  
  152. end
  153.  
  154. ShowMission(loc("Random Specialists"), loc("Minigame"), table.concat(mission, "|"), 0, 0) -- UMK: Changed "minigame" to "Minigame"
  155. end
  156.  
  157. function onNewTurn()
  158. AddCaption(string.format(loc("Prepare yourself, %s!"), GetHogName(CurrentHedgehog)))
  159. end
  160.  
  161. function onGearAdd(gear)
  162. if GetGearType(gear) == gtHedgehog then
  163. table.insert(hhs, gear)
  164. elseif GetGearType(gear) == gtRCPlane then
  165. SetHealth(gear, 1)
  166. elseif GetGearType(gear) == gtAirAttack then
  167. SetHealth(gear, 1)
  168. elseif GetGearType(gear) == gtDrill and band(GetState(gear), gsttmpFlag) == 0 then
  169. SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
  170. elseif GetGearType(gear) == gtCake then
  171. SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
  172. elseif GetGearType(gear) == gtBallGun then
  173. SetTimer(gear, 1001)
  174. elseif GetGearType(gear) == gtHellishBomb then
  175. SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 45)
  176. SetTimer(gear, 3000)
  177. elseif GetGearType(gear) == gtMinigunBullet then
  178. SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 1)
  179. elseif GetGearType(gear) == gtWatermelon then
  180. SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
  181. elseif GetGearType(gear) == gtMelonPiece then
  182. SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 35)
  183. elseif GetGearType(gear) == gtBall then
  184. SetTimer(gear, 1200)
  185. end
  186. 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.

×