Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. local leverChange = {
  2. [1] = {1, 3, 2, 4},
  3. [2] = {2, 1, 3, 4},
  4. [3] = {2, 3, 1, 4},
  5. [4] = {3, 2, 4, 1},
  6. [5] = {4, 2, 1, 3}
  7. }
  8.  
  9. local position = {
  10. [1] = {
  11. Position(33355, 31126, 7),
  12. Position(33356, 31126, 7),
  13. Position(33357, 31126, 7),
  14. Position(33358, 31126, 7)
  15. },
  16. [2] = {
  17. Position(33352, 31126, 5),
  18. Position(33353, 31126, 5),
  19. Position(33354, 31126, 5),
  20. Position(33355, 31126, 5)
  21. }
  22. }
  23.  
  24. function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  25. local player = Player(player)
  26. if target.actionid == 8013 then
  27. return false
  28. end
  29.  
  30. if player:getStorageValue(Storage.ChildrenoftheRevolution.Questline) ~= 14 then
  31. player:say("The lever does not budge.", TALKTYPE_MONSTER_SAY)
  32. return true
  33. end
  34.  
  35. local lever, tmp, ground = toPosition.y - 31122, {}
  36. for i = 1, #position[1] do
  37. ground = Tile(position[1][i]):getGround()
  38. if ground then
  39. tmp[i] = ground.itemid
  40. end
  41. end
  42.  
  43. for i = 1, #position[2] do
  44. ground = Tile(position[2][i]):getGround()
  45. if ground then
  46. ground:transform(tmp[leverChange[lever][i]])
  47. ground:getPosition():sendMagicEffect(CONST_ME_POFF)
  48. end
  49. end
  50.  
  51. local groundIds, pass = {10856, 10853, 10855, 10850}, 0
  52. for i = 1, #position[2] do
  53. ground = Tile(position[2][i]):getGround()
  54. if ground and ground.itemid == groundIds[i] then
  55. pass = pass + 1
  56. end
  57. end
  58.  
  59. if pass ~= 4 then
  60. return true
  61. end
  62.  
  63. player:setStorageValue(Storage.ChildrenoftheRevolution.Questline, 17)
  64. player:setStorageValue(Storage.ChildrenoftheRevolution.Mission04, 5) --Questlog, Children of the Revolution "Mission 4: Zze Way of Zztonezz"
  65. player:say("After a cracking noise a deep humming suddenly starts from somewhere below.", TALKTYPE_MONSTER_SAY)
  66.  
  67. target:transform(target.itemid == 10044 and 10045 or 10044)
  68. return true
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement