Marlingaming

CC Tweaked CCSPS 20 - Games - Wonder Island

Feb 22nd, 2022 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. local Factions = {}
  2. local Power = 0
  3. local Characters = {}
  4. local Structure = {}
  5. local Balance = 0
  6. local w, h = term.getSize()
  7.  
  8. local function Clear()
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. end
  12.  
  13. function RNG_Names(type)
  14. local Names = {}
  15. local Contents
  16. if Type == "character" then
  17. local F = fs.open("os/SystemFiles/WonderIsland.cpf/data/Names_C.txt","r")
  18. repeat
  19. Content = F.readLine()
  20. Names[#Names + 1] = Content
  21. until Content == nil
  22. F.close()
  23. elseif type == "faction" then
  24. local F = fs.open("os/SystemFiles/WonderIsland.cpf/data/Names_F.txt","r")
  25. repeat
  26. Content = F.readLine()
  27. Names[#Names + 1] = Content
  28. until Content == nil
  29. F.close()
  30. end
  31. return Names[math.random(1,3)]
  32. end
  33.  
  34. function CreateCharacter(faction)
  35. local I = #Characters + 1
  36. local Name = RNG_Names("character")
  37. local Age = math.random(18,50)
  38. local Cash = math.random(0,99999)
  39. local Traits = {}
  40. Characters[I] = {Name,faction,Age,Cash,Traits}
  41. return I
  42. end
  43.  
  44. function CreateRNGFaction()
  45. local I = #Factions + 1
  46. local Name = RNG_Names("faction")
  47. local Leader = CreateCharacter(I)
  48. local Supports = {"Mil3","Ind"}
  49. local Against = {"Pup","Elc"}
  50. Factions[I] = {Name,Leader,{Leader},Supports,Against}
  51. return I
  52. end
  53.  
  54. function Prompt(text)
  55. paintutils.drawFilledBox(1,4,16,8,colors.lightGray)
  56. term.setCursorPos(1,4)
  57. print(text)
  58. term.setCursorPos(6,8)
  59. term.write("continue")
  60. repeat
  61. local a, b, c, d = os.pullEvent("mouse_click")
  62. until c >= 6 and c <= 15 and d == 8
  63. end
  64.  
  65. function Event(id)
  66. if id == 1 then--new faction is created
  67. local I = CreateRNGFaction()
  68. Prompt("new Faction has appeared! the "..Factions[I][1].." lead by "..Characters[Factions[I][2]][1].." may seek to replace you!")
  69. end
  70. end
  71.  
  72. Event(1)
Add Comment
Please, Sign In to add comment