Guest User

encounter code

a guest
Mar 22nd, 2016
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. -- A basic encounter script skeleton you can copy and modify for your own creations.
  2.  
  3. -- music = "shine_on_you_crazy_diamond" --Always OGG. Extension is added automatically. Remove the first two lines for custom music.
  4. encountertext = "Chara traps you in agony!" --Modify as necessary. It will only be read out in the action select screen.
  5. nextwaves = {"kniferings"}
  6. wavetimer = 25.0
  7. arenasize = {155, 130}
  8.  
  9. enemies = {
  10. "chara"
  11. }
  12.  
  13. enemypositions = {
  14. {0, 0}
  15. }
  16.  
  17. -- A custom list with attacks to choose from. Actual selection happens in EnemyDialogueEnding(). Put here in case you want to use it.
  18. possible_attacks = {"kniferings"}
  19.  
  20. function EncounterStarting()
  21. -- If you want to change the game state immediately, this is the place.
  22. Player.name = "Frisk"
  23. Player.lv = 20
  24. Player.hp = 99
  25. end
  26.  
  27. function EnemyDialogueStarting()
  28. -- Good location for setting monster dialogue depending on how the battle is going.
  29. local dm = getGlobal("dm")
  30. local turn = getGlobal ("turn")
  31. if turn == 0 then
  32. enemies[1].SetVar('currentdialogue', {"[voice:voice_chara]So you want \nyour soul back...","[voice:voice_chara]Well then...","[voice:voice_chara]I'll give you\nyour soul back\nall right...","[voice:voice_chara]If you can\ndefeat me!"})
  33. end
  34.  
  35. function EnemyDialogueEnding()
  36. -- Good location to fill the 'nextwaves' table with the attacks you want to have simultaneously.
  37. -- This example line below takes a random attack from 'possible_attacks'.
  38. nextwaves = { possible_attacks[math.random(#possible_attacks)] }
  39. end
  40.  
  41. function DefenseEnding() --This built-in function fires after the defense round ends.
  42. encountertext = RandomEncounterText() --This built-in function gets a random encounter text from a random enemy.
  43. end
  44.  
  45. function HandleSpare()
  46. State("ENEMYDIALOGUE")
  47. end
  48.  
  49. function HandleItem(ItemID)
  50. BattleDialog({"Selected item " .. ItemID .. "."})
  51. end
Advertisement
Add Comment
Please, Sign In to add comment