huntersmanifest.lua 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. --[[
  2. Script Name : SpawnScripts/Antonica/huntersmanifest.lua
  3. Script Author : Premierio015
  4. Script Date : 2023.04.05 09:04:26
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/PlayerHistory"
  9. local HuntersManifest1 = 5799
  10. local HuntersManifest2 = 5801
  11. local HuntersManifest3 = 5802
  12. function spawn(NPC)
  13. SetPlayerProximityFunction(NPC, 10, "InRange", Spawn)
  14. end
  15. function InRange(NPC, Spawn)
  16. if GetPlayerHistory(Spawn, 8) == 0 or GetPlayerHistory(Spawn, 8) == nil then
  17. SpawnSet(NPC, "show_command_icon", 1)
  18. SpawnSet(NPC, "display_hand_icon", 1)
  19. SetAccessToEntityCommand(Spawn,NPC,"open manifest", 1)
  20. else
  21. SpawnSet(NPC, "show_command_icon", 0)
  22. SpawnSet(NPC, "display_hand_icon", 0)
  23. SetAccessToEntityCommand(Spawn,NPC,"open manifest", 0)
  24. end
  25. end
  26. function casted_on(NPC, Spawn, SpellName)
  27. if SpellName == 'open manifest' then
  28. local con = CreateConversation()
  29. AddConversationOption(con, "Open manifest.", "con1")
  30. AddConversationOption(con, "Leave the manifest alone.")
  31. StartDialogConversation(con, 1, NPC, Spawn, "Within the storage box you find a leather bound manifest. It appears to be untouched for quite some time, but the leather is still in excellent condition.")
  32. SpawnSet(NPC, "show_command_icon", 0)
  33. SpawnSet(NPC, "display_hand_icon", 0)
  34. SetAccessToEntityCommand(Spawn,NPC,"open manifest", 0)
  35. AddTimer(NPC, 10000, "check", 1, Spawn)
  36. end
  37. end
  38. function check(NPC, Spawn)
  39. if GetPlayerHistory(Spawn, 8) == 0 or GetPlayerHistory(Spawn, 8) == nil then
  40. SpawnSet(NPC, "show_command_icon", 1)
  41. SpawnSet(NPC, "display_hand_icon", 1)
  42. SetAccessToEntityCommand(Spawn,NPC,"open manifest", 1)
  43. end
  44. end
  45. function con1(NPC, Spawn)
  46. if GetPlayerHistory(Spawn, 8) == 0 or GetPlayerHistory(Spawn, 8) == nil then
  47. local generate_random_quest_option = MakeRandomInt(1, 3)
  48. if generate_random_quest_option == 1 then
  49. OfferQuest(NPC, Spawn, HuntersManifest1)
  50. elseif generate_random_quest_option == 2 then
  51. OfferQuest(NPC, Spawn, HuntersManifest2)
  52. elseif generate_random_quest_option == 3 then
  53. OfferQuest(NPC, Spawn, HuntersManifest3)
  54. end
  55. end
  56. local con = CreateConversation()
  57. AddConversationOption(con, "I will hunt game in Antonica.")
  58. AddConversationOption(con, "exit")
  59. StartDialogConversation(con, 1, NPC, Spawn, "The manifest once belonged to a hunter, that apparently had something to do with organizing hunts for Qeynosian royalty. Great hunts were organized, where hunters from all over Norrath were invited to participate, competing for prizes and prestige. The manifest is not particularly well written, but it sparks your imagination nonetheless.")
  60. end
  61. function respawn(NPC)
  62. spawn(NPC)
  63. end