Advertisement
Guest User

Encounter.lua

a guest
Jan 31st, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. number_of_hits = 0
  2.  
  3. music = "Theme" --Either OGG or WAV. Extension is added automatically. Uncomment (remove the two dashes) for custom music.
  4. encountertext = "Your flesh begins to crawl." --Modify as necessary. It will only be read out in the action select screen.
  5. wavetimer = 8.0
  6. arenasize = {155, 130}
  7. canflee = false
  8.  
  9. enemies = {
  10. "Placeholder"
  11. }
  12.  
  13. enemypositions = {
  14. {0, 0}
  15. }
  16.  
  17. SetGlobal("intro", true)
  18.  
  19. -- A custom list with attacks to choose from. Actual selection happens in EnemyDialogueEnding(). Put here in case you want to use it.
  20. possible_attacks = {""}
  21.  
  22. function EncounterStarting()
  23. require "Animations/placeholder_animation"
  24. State("ENEMYDIALOGUE")
  25. Player.name = "Placeholder"
  26. Player.lv = 19
  27. Player.hp = 92
  28. Inventory.AddCustomItems({"Ramen","Sushi"},{0,0})
  29. Inventory.SetInventory({"Ramen","Sushi"})
  30. Audio.Pause()
  31. -- If you want to change the game state immediately, this is the place.
  32. end
  33.  
  34. function EnemyDialogueStarting()
  35. local intro = GetGlobal("intro")
  36. if intro == true then
  37. enemies[1].SetVar('currentdialogue', {"[effect:none]Let me tell you\nsomething about\nmyself.","[effect:none]I try my best\nto be nice to\neveryone I meet.", "[effect:none][func:SetSide]But when people like you\ncome around...", "[effect:none [func:SetAnnoyed]...Whatever.", "[func:SetNeutral][effect:none]Here we go."})
  38. SetGlobal("intro", false)
  39. end
  40. -- Good location for setting monster dialogue depending on how the battle is going.
  41. end
  42.  
  43. function Update()
  44. AnimatePlaceholder()
  45. ChangePlaceholder()
  46. end
  47.  
  48.  
  49. function EnemyDialogueEnding()
  50. -- Good location to fill the 'nextwaves' table with the attacks you want to have simultaneously.
  51. number_of_hits = number_of_hits + 1
  52. if number_of_hits == 1 then
  53. nextwaves = {"blue_soul"}
  54. elseif number_of_hits == 2 then
  55. nextwaves = {"bullet_hell"}
  56. elseif number_of_hits == 3 then
  57. nextwaves = {"gravity_spikes"}
  58. end
  59. end
  60.  
  61. function DefenseEnding() --This built-in function fires after the defense round ends. --This built-in function gets a random encounter text from a random enemy.
  62. Audio.Unpause()
  63. encountertext = RandomEncounterText()
  64. end
  65.  
  66. function HandleSpare()
  67. BattleDialog("It's too late for that now.")
  68. end
  69.  
  70. function HandleItem(ItemID)
  71. if (ItemID == "RAMEN") then
  72. if Player.hp >= 62 then
  73. Player.Heal(30)
  74. BattleDialog({"You ate the Ramen. Your HP\rwas maxed out!"})
  75. elseif Player.hp <= 61 then
  76. Player.Heal(30)
  77. BattleDialog({"You ate the Ramen.\rYou recovered 30 HP!"})
  78. end
  79. end
  80.  
  81. if (ItemID == "SUSHI") then
  82. if Player.hp <= 81 then
  83. Player.Heal(10)
  84. BattleDialog({"You ate the Sushi.\rYou recovered 10 HP!"})
  85. elseif Player.hp >= 82 then
  86. Player.Heal(10)
  87. BattleDialog({"You ate the Sushi. Your HP\rwas maxed out!"})
  88. end
  89. end
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement