Guest User

TD_Encounter

a guest
Jun 6th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. -- A basic encounter script skeleton you can copy and modify for your own creations.
  2.  
  3. currentstate = "NONE"
  4.  
  5. function Update()
  6. if items.inmenu then
  7. items.Update()
  8. end
  9. end
  10.  
  11. function OnHit(bullet)
  12. end
  13.  
  14. function EnteringState(newstate, oldstate)
  15. if newstate == "ITEMMENU" then
  16. items.OpenItemMenu()
  17. end
  18. end
  19.  
  20. music = "MSBSG normalize" --Always OGG. Extension is added automatically. Remove the first two lines for custom music.
  21. encountertext = "Tails Doll appeared!" --Modify as necessary. It will only be read out in the action select screen.
  22. nextwaves = {"bullettest_chaserorb"}
  23. wavetimer = 4.0
  24. arenasize = {155, 130}
  25.  
  26. enemies = {
  27. "Tails Doll"
  28. }
  29.  
  30. enemypositions = {
  31. {0, 0}
  32. }
  33. attacknum = 0
  34. SetGlobal("intro",true)
  35. sparecount = 0
  36. -- A custom list with attacks to choose from. Actual selection happens in EnemyDialogueEnding(). Put here i""n case you want to use it.
  37. possible_attacks = {"bullettest_bouncy", "bullettest_chaserorb", "bullettest_touhou"}
  38.  
  39. function EncounterStarting()
  40. State("ENEMYDIALOGUE")
  41. Player.name = "Tails"
  42. Player.lv = 20
  43. Player.hp = 99
  44. items = require "Libraries/itemsmenu"
  45. end
  46.  
  47. function EnemyDialogueStarting()
  48. local intro = GetGlobal("intro")
  49. if intro == true then
  50. enemies[1].SetVar('currentdialogue',{"Hehehehehe.", "Well well well...", "Hello Tails.", "What does your\nDetermination", "say", "to", "this. . ."})
  51. SetGlobal("intro",false)
  52. end
  53. end
  54.  
  55. function EnemyDialogueEnding()
  56. attacknum = attacknum + 1
  57. if attacknum == 1 then
  58. nextwaves = {"Spears"}
  59. elseif attacknum == 2 then
  60. nextwaves = {"Spears Wave"}
  61. elseif attacknum == 3 then
  62. nextwaves = {"wave_spawning_example_x_version"}
  63. attacknum = 0
  64. end
  65. end
  66. function DefenseEnding() --This built-in function fires after the defense round ends.
  67. encountertext = RandomEncounterText() --This built-in function gets a random encounter text from a random enemy.
  68. end
  69.  
  70. function HandleSpare()
  71. if sparecount == 0 then
  72. enemies[1].SetVar('currentdialogue',{"are you trying to\nspare me?", "pathetic"})
  73. sparecount = sparecount + 1
  74. elseif sparecount == 1 then
  75. enemies[1].SetVar('currentdialogue',{"You did a full\ngenocide and now\nyou are going to\njust spare me?", "no I refuse"})
  76. sparecount = sparecount + 1
  77. elseif sparecount == 2 then
  78. enemies[1].SetVar('currentdialogue',{"If you keep spareing me\nI will end you."})
  79. sparecount = sparecount + 1
  80. elseif sparecount == 3 then
  81. Player.Hurt(99)
  82. end
  83. State("ENEMYDIALOGUE")
  84. end
  85.  
  86. function HandleItem(ItemID)
  87. BattleDialog({"Selected item " .. ItemID .. "."})
  88. end
Advertisement
Add Comment
Please, Sign In to add comment