fork download
  1. -- A basic monster script skeleton you can copy and modify for your own creations.
  2. voicer = require "randomvoice"
  3. -- Now, set some voices that are included in the default directory.
  4. voicer.setvoices({"voice_gaster_1";"voice_gaster_2";"voice_gaster_3";"voice_gaster_4";"voice_gaster_5";"voice_gaster_6";"voice_gaster_7";})
  5.  
  6. comments = {"Smells like the \runknown.", "It gets dark.", "What are we fighting ?"}
  7. commands = {"Talk", "Cry", "Help"}
  8. randomdialogue = {"[font:wingdings]..."}
  9. sprite = "poseur" --Always PNG. Extension is added automatically.
  10. name = "??????"
  11. hp = 99999
  12. atk = 999
  13. def = 999
  14. check = "There is no description about\rsomething that doesn't exist."
  15. dialogbubble = "right" -- See documentation for what bubbles you have available.
  16. canspare = false
  17. cancheck = true
  18.  
  19. function EncounterStarting()
  20. -- If you want to change the game state immediately, this is the place.
  21. local randomdialogue = enemies[1].GetVar("randomdialogue") -- retrieve dialogue first, for readability
  22. enemies[1].SetVar("randomdialogue", voicer.randomizetable(randomdialogue)) -- Randomize voices with the library!
  23. end
  24.  
  25. function EnemyDialogueStarting()
  26. -- Good location for setting monster dialogue depending on how the battle is going.
  27. -- Example: enemies[1].SetVar('currentdialogue', {"Check it\nout!"}) See documentation for details.
  28. local enemydialogue = enemies[1].GetVar("currentdialogue") -- retrieve dialogue first, for readability
  29. if enemydialogue ~= nil then -- Note that this can happen when a monster is having its random dialogue!
  30. enemies[1].SetVar('currentdialogue', voicer.randomizetable(enemydialogue)) -- Randomize voices with the library!
  31. end
  32. end
  33.  
  34. function EnemyDialogueEnding()
  35. -- Good location to fill the 'nextwaves' table with the attacks you want to have simultaneously.
  36. -- This example line below takes a random attack from 'possible_attacks'.
  37. nextwaves = { possible_attacks[math.random(#possible_attacks)] }
  38. end
  39.  
  40. -- Happens after the slash animation but before
  41. function HandleAttack(attackstatus)
  42. if attackstatus == -1 then
  43. -- player pressed fight but didn't press Z afterwards
  44. else
  45. -- player did actually attack
  46. end
  47. end
  48.  
  49. -- This handles the commands; all-caps versions of the commands list you have above.
  50. function HandleCustomCommand(command)
  51. if command == "TALK" then
  52. currentdialogue = {"..."}
  53. BattleDialog({"You're talking to yourself."})
  54. elseif command == "CRY" then
  55. currentdialogue = {"Selected\nAct 2."}
  56. BattleDialog({"Crying won't help."})
  57. elseif command == "HELP" then
  58. currentdialogue = {"..."}
  59. BattleDialog({"There is no one to help."})
  60. end
  61. end
Runtime error #stdin #stdout #stderr 0s 14112KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
lua5.3: prog.lua:2: module 'randomvoice' not found:
	no field package.preload['randomvoice']
	no file '/usr/local/share/lua/5.3/randomvoice.lua'
	no file '/usr/local/share/lua/5.3/randomvoice/init.lua'
	no file '/usr/local/lib/lua/5.3/randomvoice.lua'
	no file '/usr/local/lib/lua/5.3/randomvoice/init.lua'
	no file '/usr/share/lua/5.3/randomvoice.lua'
	no file '/usr/share/lua/5.3/randomvoice/init.lua'
	no file './randomvoice.lua'
	no file './randomvoice/init.lua'
	no file '/usr/local/lib/lua/5.3/randomvoice.so'
	no file '/usr/lib/x86_64-linux-gnu/lua/5.3/randomvoice.so'
	no file '/usr/lib/lua/5.3/randomvoice.so'
	no file '/usr/local/lib/lua/5.3/loadall.so'
	no file './randomvoice.so'
stack traceback:
	[C]: in function 'require'
	prog.lua:2: in main chunk
	[C]: in ?