Advertisement
kensuaga

DinoGenics Original

Aug 21st, 2018
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. --The easiest way to locate an item is with its GUID.
  2. --But we don't always know those in advance. So we need ot search for the item.
  3. --There are many ways to go about it.
  4. --The easist is to hunt for them in scripting zones using tags or names.
  5. --If a scripting zone isn't practical, then you can look for them without it.
  6. --There are more that I haven't even listed, these are just my go-to ones
  7.  
  8. --Runs when the map is first loaded
  9. function onload(saved_data)
  10. --Creates the 4 buttons
  11. self.createButton({
  12. label="Calculate\nPoints", click_function="orangedinocount",
  13. function_owner=self, position={-2.15,0.3,-1.5},
  14. height=100, width=140, font_size=30, color={0.95,0.4,0.0},
  15. })
  16. self.createButton({
  17. label="H", click_function="orangemeeplemove",
  18. function_owner=self, position={0.16,0.2,-1.3},
  19. height=90, width=90, font_size=60, color={0.95,0.4,0.0},
  20. })
  21. end
  22.  
  23. function orangemeeplemove()
  24. --local orangeboard = getObjectFromGUID("5b16a8")
  25. local orangepawn1 = getObjectFromGUID("4d9f73")
  26. local orangepawn2 = getObjectFromGUID("9108ee")
  27. local orangepawn3 = getObjectFromGUID("82dab3")
  28. local orangepawn4 = getObjectFromGUID("49af00")
  29. --print("Orange pawn is located at: " .. orangepawn4.getPosition())
  30. orangepawn1.setRotation({0,0,0})
  31. orangepawn1.setPosition({-5.4,2,-12})
  32. orangepawn2.setRotation({0,0,0})
  33. orangepawn2.setPosition({-4.6,2,-12})
  34. orangepawn3.setRotation({0,0,0})
  35. orangepawn3.setPosition({-3.8,2,-12})
  36. orangepawn4.setRotation({0,0,0})
  37. orangepawn4.setPosition({-3,2,-12})
  38. print("Orange pawns moved")
  39. --object1.setPositionSmooth(Table, bool, bool)
  40. end
  41.  
  42.  
  43.  
  44. --This function finds the name of any object in a scripting zone and prints them
  45. function orangedinocount()
  46. local dinopoints = 0
  47. local dinorep = 0
  48. local zone = getObjectFromGUID("444c10")
  49. local objectsInZone = zone.getObjects()
  50. if #objectsInZone == 0 then
  51. print("Orange - 0 Dinosaurs")
  52. else
  53. for _, object in ipairs(objectsInZone) do
  54. local name = object.getName()
  55. --Then check if it had a name or not
  56. if name == "Triceritops" then
  57. dinopoints = dinopoints + 2
  58. dinorep = dinorep + 1
  59. elseif name == "Brontosaurus" then
  60. dinopoints = dinopoints + 5
  61. dinorep = dinorep + 2
  62. elseif name == "Stegosaurus" then
  63. dinopoints = dinopoints + 3
  64. dinorep = dinorep + 2
  65. elseif name == "Anklyosaurus" then
  66. dinopoints = dinopoints + 5
  67. dinorep = dinorep + 2
  68. elseif name == "Raptor" then
  69. dinopoints = dinopoints + 4
  70. dinorep = dinorep + 2
  71. elseif name == "T - Rex" then
  72. dinopoints = dinopoints + 7
  73. dinorep = dinorep + 3
  74. elseif name == "Pterodactyle" then
  75. dinopoints = dinopoints + 5
  76. dinorep = dinorep + 4
  77. elseif name == "Mutant" then
  78. dinopoints = dinopoints + 2
  79. dinorep = dinorep + 0
  80. end
  81. end
  82. end
  83. --Finally, we print the "closing" line.
  84. --The purpose of the first and last lines are decorative and for clarity
  85. print("orange dinopoints = " .. dinopoints)
  86. print("orange dinorep = " .. dinorep)
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement