9
3

Two_Face.lua 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. --[[
  2. Two_Face NPCID: 2490680
  3. Script Name: SpawnScripts/ThunderingSteppes/Two_Face.lua
  4. Script Purpose: Gamble for heads or tails
  5. Script Author: Patrikpatrik
  6. Script Date: August 15 2016
  7. Script Notes: Simple test for functionality
  8. --]]
  9. function spawn(NPC)
  10. SetPlayerProximityFunction(NPC, 10, "InRange")
  11. --Dont need LeaveRange if you dont want it
  12. end
  13. --always include this when npc dies.
  14. function respawn(NPC)
  15. spawn(NPC)
  16. end
  17. function InRange(NPC, Spawn)
  18. PlayFlavor(NPC, "", "Psst, c'mere..", "beckon", 0, 0, Spawn)
  19. end
  20. function hailed(NPC, Spawn)
  21. FaceTarget(NPC, Spawn)
  22. conversation = CreateConversation()
  23. AddConversationOption(conversation, "Yes I do.", "Yes1")
  24. AddConversationOption(conversation, "No I don't.", "No1")
  25. StartConversation(conversation, NPC, Spawn, "Do you want to play a game? It costs 50 silver to play.")
  26. end
  27. function Yes1(NPC, Spawn)
  28. FaceTarget(NPC, Spawn)
  29. conversation = CreateConversation()
  30. coins = 5000
  31. local poolCoins = RemoveCoin(Spawn, coins)
  32. --[[This little section will pool coins but will only last until player logs out =(
  33. local npcCoins = GetLootCoin(NPC)
  34. Say(NPC, "I have " .. npcCoins .. " coins. And I just stole from you.")
  35. --]]
  36. if(poolCoins) then
  37. --[[local totalCoins = npcCoins + coins
  38. SetLootCoin(NPC, totalCoins)--]]
  39. PlaySound(NPC, "voiceover/english/voice_emotes/thank/thank_2_1054.mp3", GetX(NPC), GetY(NPC), GetZ(NPC))
  40. Say(NPC, "Thank you, let's begin!")
  41. randpick = math.random(1, 2)
  42. AddConversationOption(conversation, "Heads!", "Heads1")
  43. AddConversationOption(conversation, "Tails!", "Tails1")
  44. StartConversation(conversation, NPC, Spawn, GetName(Spawn) .. ", I'm going to flip a coin, call it in the air...")
  45. else
  46. Say(NPC, "I'm sorry but you don't have enough money, begone.")
  47. PlaySound(NPC, "sounds/combat/impact/leather/impact_metal_to_leather04.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  48. end
  49. end
  50. --Heads/Tails outcome
  51. function Heads1(NPC, Spawn)
  52. FaceTarget(NPC, Spawn)
  53. conversation = CreateConversation()
  54. if randpick == 1 then
  55. AddCoin(Spawn, 10000)
  56. StartConversation(conversation, NPC, Spawn, "Congratulations " .. GetName(Spawn) .. "! You win" .. GetCoinMessage(coins) .. "!")
  57. ApplySpellVisual(Spawn, 869)
  58. SendPopUpMessage(Spawn, "Congratulations " .. GetName(Spawn) .. "! You win 50 silver!", 0, 255, 0)
  59. else
  60. StartConversation(conversation, NPC, Spawn, "Sorry it's Tails, you lose.")
  61. PlayFlavor(NPC, "voiceover/english/voice_emotes/laugh/laugh_1002.mp3", "", "laugh", 0, 0, Spawn)
  62. end
  63. end
  64. function Tails1(NPC, Spawn)
  65. FaceTarget(NPC, Spawn)
  66. conversation = CreateConversation()
  67. if randpick == 2 then
  68. AddCoin(Spawn, 10000)
  69. StartConversation(conversation, NPC, Spawn, "Congratulations " .. GetName(Spawn) .. "! You win" .. GetCoinMessage(coins) .. "!")
  70. ApplySpellVisual(Spawn, 869)
  71. SendPopUpMessage(Spawn, "Congratulations " .. GetName(Spawn) .. " you win 50 silver!", 0, 255, 0)
  72. else
  73. StartConversation(conversation, NPC, Spawn, "Sorry it's Heads, you lose.")
  74. PlayFlavor(NPC, "voiceover/english/voice_emotes/laugh/laugh_1002.mp3", "", "laugh", 0, 0, Spawn)
  75. end
  76. end
  77. function No1(NPC, Spawn)
  78. Say(NPC, "Your loss!")
  79. end