9
3

smolderingtrout.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --[[
  2. Script Name : ItemScripts/smolderingtrout.lua
  3. Script Purpose : clickable used in quest "The Big One" (ID = 190)
  4. Script Author : fearfx
  5. Script Date : 25 Jan 2017
  6. Script Notes : Smoldering trout (ID = 48104)
  7. : Theres no Spawn for SmolderFin, so I have used a razortooth shark (2530014) instead.
  8. --]]
  9. local TheBigOne = 190
  10. function used(Item, Player)
  11. local target = GetTarget(Player)
  12. local zone = GetZone(Player)
  13. local x = GetX(Player)
  14. local y = GetY(Player)
  15. local z = GetZ(Player)
  16. if GetTempVariable(Player, "TheBigOne") == nil then
  17. spawnChance = 0
  18. else
  19. spawnChance = tonumber(GetTempVariable(Player, "TheBigOne"))
  20. end
  21. if GetZoneID(zone) == 34 and GetQuestStep(TheBigOne) == 1 then
  22. if between(-91.3, 35.5, x) and between(-67, -60, y) and between(-186.79, -54.40, z) then
  23. RemoveItem(Player, 48104)
  24. spawnChance = spawnChance + 20
  25. SetTempVariable(Player, "TheBigOne", spawnChance)
  26. if tonumber(GetTempVariable(Player, "TheBigOne")) > 20 then
  27. if tonumber(GetTempVariable(Player, "TheBigOne")) > math.random(30, 80) then
  28. spawnSmolderFin(Player, zone)
  29. end
  30. end
  31. else
  32. SendMessage(Player, "Can only be used in Smoldering Lake.", "yellow")
  33. end
  34. else
  35. SendMessage(Player, "Can only be used in Darklight Wood.", "yellow")
  36. end
  37. end
  38. function spawnSmolderFin(Player, zone)
  39. local newSpawn = SpawnMob(zone, 1240025, 1, -27.18, -65.33, -110.43, 167.84)
  40. SpawnSet(newSpawn, "name", "Smolderfin")
  41. SpawnSet(newSpawn, "faction", "1")
  42. SpawnSet(newSpawn, "level", "11")
  43. SpawnSet(newSpawn, "size", "90")
  44. SpawnSet(newSpawn, "hp", "220")
  45. if newSpawn ~= nil then
  46. AddSpawnAccess(newSpawn, Player)
  47. end
  48. end
  49. function between(low, higher, n)
  50. if low <= n and n <= higher then
  51. return true
  52. else
  53. return false
  54. end
  55. end