MavsStone.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --[[
  2. Script Name : ItemScripts/MavsStone.lua
  3. Script Purpose : Mav's Stone
  4. Script Author : Scatman
  5. Script Date : 2009.10.05
  6. Script Notes :
  7. --]]
  8. local DWARF_MENTOR_QUEST_4 = 287
  9. function examined(Item, Player)
  10. conversation = CreateConversation()
  11. if HasQuest(Player, DWARF_MENTOR_QUEST_4) then
  12. local x1 = GetX(Player)
  13. local y1 = GetY(Player)
  14. local z1 = GetZ(Player)
  15. local x2 = 897.01
  16. local y2 = -22.31
  17. local z2 = -113.83
  18. local x = x2 - x1 --math.Pow(x2 - x1, 2)
  19. x = x * x
  20. local y =y2 - y1 -- math.pow(y2 - y1, 2)
  21. y = y * y
  22. local z = z2 - z1 -- math.pow(z2 - z1, 2)
  23. z = z * z
  24. local distance = math.sqrt((x + y + z))
  25. if distance <= 10.0 then
  26. AddConversationOption(conversation, "Hold the stone in your hand and focus on it.", "HoldStone")
  27. end
  28. end
  29. AddConversationOption(conversation, "Put the stone away.", "CloseItemConversation")
  30. StartDialogConversation(conversation, 2, Item, Player, "The stone is cold and rough, your instincts tell you it would be a good stone for building.")
  31. end
  32. function HoldStone(Item, Player)
  33. if GetQuestStep(Player, DWARF_MENTOR_QUEST_4) == 1 then
  34. SetStepComplete(Player, DWARF_MENTOR_QUEST_4, 1)
  35. end
  36. conversation = CreateConversation()
  37. AddConversationOption(conversation, "Put the stone away.", "CloseItemConversation")
  38. StartDialogConversation(conversation, 2, Item, Player, "When you focus on the stone there is an almost audible sense of hammers and chisels working at stone, carts moving back and forth, and a low hum of an ancient dwarven work song.")
  39. end