Guest User

TD_Encounter_3

a guest
Jun 6th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. -- A basic encounter script skeleton you can copy and modify for your own creations.
  2.  
  3. function HealAndReturnString(num,sound)
  4. local string = nil
  5. if Player.hp + num >= 99 then
  6. string = "Your HP was maxed out!"
  7. else
  8. string = "You recovered "..num.." HP!"
  9. end
  10. Player.hp = Player.hp + num
  11. if sound ~= nil then
  12. Audio.PlaySound(sound)
  13. else
  14. Audio.PlaySound("healsound")
  15. end
  16. return string
  17. end
  18.  
  19. currentstate = "NONE"
  20.  
  21. function OnHit(bullet)
  22. end
  23.  
  24. music = "MSBSG normalize" --Always OGG. Extension is added automatically. Remove the first two lines for custom music.
  25. encountertext = "Tails Doll appeared!" --Modify as necessary. It will only be read out in the action select screen.
  26. nextwaves = {"bullettest_chaserorb"}
  27. wavetimer = 4.0
  28. arenasize = {155, 130}
  29.  
  30. enemies = {
  31. "Tails Doll"
  32. }
  33.  
  34. enemypositions = {
  35. {0, 0}
  36. }
  37. attacknum = 0
  38. SetGlobal("intro",true)
  39. sparecount = 0
  40. -- A custom list with attacks to choose from. Actual selection happens in EnemyDialogueEnding(). Put here i""n case you want to use it.
  41. possible_attacks = {"bullettest_bouncy", "bullettest_chaserorb", "bullettest_touhou"}
  42.  
  43. function EncounterStarting()
  44. State("ENEMYDIALOGUE")
  45. Player.name = "Tails"
  46. Player.lv = 20
  47. Player.hp = 99
  48. Inventory.AddCustomItems({"Rbpie", "Rblade", "SSIC", "MntCndy", "Chldog", "Hchldog", "Ggrape", "Pgrape", "CDIC", "Eggs"}, {3, 3, 0, 0, 3, 0, 0, 0, 0, 0})
  49. Inventory.SetInventory({"Rbpie", "SSIC", "MntCndy", "Chldog", "Ggrape", "Pgrape", "CDIC", "Eggs"})
  50. end
  51.  
  52. function EnemyDialogueStarting()
  53. local intro = GetGlobal("intro")
  54. if intro == true then
  55. enemies[1].SetVar('currentdialogue',{"Hehehehehe.", "Well well well...", "Hello Tails.", "What does your\nDetermination", "say", "to", "this. . ."})
  56. SetGlobal("intro",false)
  57. end
  58. end
  59.  
  60. function EnemyDialogueEnding()
  61. attacknum = attacknum + 1
  62. if attacknum == 1 then
  63. nextwaves = {"Spears"}
  64. elseif attacknum == 2 then
  65. nextwaves = {"Spears Wave"}
  66. elseif attacknum == 3 then
  67. nextwaves = {"wave_spawning_example_x_version"}
  68. attacknum = 0
  69. end
  70. end
  71. function DefenseEnding() --This built-in function fires after the defense round ends.
  72. encountertext = RandomEncounterText() --This built-in function gets a random encounter text from a random enemy.
  73. end
  74.  
  75. function HandleSpare()
  76. if sparecount == 0 then
  77. enemies[1].SetVar('currentdialogue',{"are you trying to\nspare me?", "pathetic"})
  78. sparecount = sparecount + 1
  79. elseif sparecount == 1 then
  80. enemies[1].SetVar('currentdialogue',{"You did a full\ngenocide and now\nyou are going to\njust spare me?", "no I refuse"})
  81. sparecount = sparecount + 1
  82. elseif sparecount == 2 then
  83. enemies[1].SetVar('currentdialogue',{"If you keep spareing me\nI will end you."})
  84. sparecount = sparecount + 1
  85. elseif sparecount == 3 then
  86. Player.Hurt(99)
  87. end
  88. State("ENEMYDIALOGUE")
  89. end
  90.  
  91. function HandleItem(ItemID)
  92. local index = Inventory.GetItem(1)
  93. for i=1,8 do
  94. if string.upper(Inventory.GetItem(i)) == ItemID then
  95. index = Inventory.GetItem(i)
  96. break
  97. end
  98. end
  99.  
  100. if ItemID == "RBPIE" then
  101. BattleDialog({"You took a bite and felt a\nrazorblade."})
  102. Player.Hurt(15)
  103. Inventory.SetItem(index, "Rblade")
  104. elseif ItemID == "RBLADE" then
  105. BattleDialog({"You tripped on the razor blade.\nOUCH!"})
  106. Player.Hurt(30)
  107. elseif ItemID == "SSIC" then
  108. BattleDialog({"You ate the soft served\nice cream.[w:10]\n"..HealAndReturnString(99,"eat")})
  109. elseif ItemID == "MNTCNDY" then
  110. BattleDialog({"You ate the mint candy.[w:10]\n"..HealAndReturnString(65,"eat")})
  111. elseif ItemID == "GGRAPE" then
  112. BattleDialog({"Eat your greens![w:10]\n"..HealAndReturnString(60,"eat")})
  113. elseif ItemID == "PGRAPE" then
  114. BattleDialog({"Eat your gree-\ner.. purples.[w:10]\n"..HealAndReturnString(60,"eat")})
  115. elseif ItemID == "EGGS" then
  116. BattleDialog({"Mmm protien.[w:10]\n"..HealAndReturnString(40,"eat")})
  117. elseif ItemID == "CHLDOG" then
  118. BattleDialog({"You ate half of a chili dog.[w:10]\n"..HealAndReturnString(27,"eat")})
  119. Inventory.SetItem(index, "Hchldog")
  120. elseif ItemID == "HCHLDOG" then
  121. BattleDialog({"You ate the other half\nof the chili dog.[w:10]\n"..HealAndReturnString(27,"eat")})
  122. elseif ItemID == "CDIC" then
  123. BattleDialog({"You ate the cookie dough\nice cream.[w:10]\n"..HealAndReturnString(15,"eat")})
  124. end
  125. end
Advertisement
Add Comment
Please, Sign In to add comment