amolderingsoldier.lua 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. --[[
  2. Script Name : SpawnScripts/Darklight/amolderingsoldier.lua
  3. Script Purpose : A Moldering Soldier ID 340084
  4. Script Author : Cynnar
  5. Script Date : 12/30/2015
  6. Script Notes : Adds a scrap of armor drop for quest Picking Up Slack (Quest ID 139)
  7. Script Notes : Currently using scrap metal (item ID 11996) in place of a scrap of armor.
  8. --]]
  9. local PickingUpSlack = 139
  10. local AGuardInsignia = 140
  11. function spawn(NPC)
  12. choice = math.random(1, 4)
  13. if choice == 1 then
  14. clockwise1(NPC)
  15. elseif choice == 2 then
  16. clockwise2(NPC)
  17. elseif choice == 3 then
  18. counter_clockwise1(NPC)
  19. elseif choice == 4 then
  20. counter_clockwise2(NPC)
  21. end
  22. end
  23. function respawn(NPC)
  24. spawn(NPC)
  25. end
  26. function clockwise1(NPC)
  27. x = GetX(NPC)
  28. y = GetY(NPC)
  29. z = GetZ(NPC)
  30. MovementLoopAddLocation(NPC, x + 7 , y, z - 8 , 1, math.random(5, 15))
  31. MovementLoopAddLocation(NPC, x - 5 , y, z - 10, 1, math.random(5, 15))
  32. MovementLoopAddLocation(NPC, x - 10, y, z + 9 , 1, math.random(5, 15))
  33. MovementLoopAddLocation(NPC, x + 5 , y, z + 8 , 1, math.random(5, 15))
  34. end
  35. function clockwise2(NPC)
  36. x = GetX(NPC)
  37. y = GetY(NPC)
  38. z = GetZ(NPC)
  39. MovementLoopAddLocation(NPC, x + 2 , y, z - 8 , 1, math.random(5, 15))
  40. MovementLoopAddLocation(NPC, x - 7 , y, z - 5 , 1, math.random(5, 15))
  41. MovementLoopAddLocation(NPC, x , y, z + 6 , 1, math.random(5, 15))
  42. MovementLoopAddLocation(NPC, x + 9 , y, z + 1 , 1, math.random(5, 15))
  43. end
  44. function counter_clockwise1(NPC)
  45. x = GetX(NPC)
  46. y = GetY(NPC)
  47. z = GetZ(NPC)
  48. MovementLoopAddLocation(NPC, x - 7 , y, z + 8 , 1, math.random(5, 15))
  49. MovementLoopAddLocation(NPC, x + 5 , y, z + 10, 1, math.random(5, 15))
  50. MovementLoopAddLocation(NPC, x + 10, y, z - 9 , 1, math.random(5, 15))
  51. MovementLoopAddLocation(NPC, x - 5 , y, z - 8 , 1, math.random(5, 15))
  52. end
  53. function counter_clockwise2(NPC)
  54. x = GetX(NPC)
  55. y = GetY(NPC)
  56. z = GetZ(NPC)
  57. MovementLoopAddLocation(NPC, x - 2 , y, z + 8 , 1, math.random(5, 15))
  58. MovementLoopAddLocation(NPC, x + 7 , y, z + 5 , 1, math.random(5, 15))
  59. MovementLoopAddLocation(NPC, x , y, z - 6 , 1, math.random(5, 15))
  60. MovementLoopAddLocation(NPC, x - 9 , y, z - 1 , 1, math.random(5, 15))
  61. end
  62. function death(NPC, Spawn)
  63. if HasQuest(Spawn, PickingUpSlack) then
  64. if GetQuestStep(Spawn, PickingUpSlack) == 1 then
  65. AddLootItem(NPC, 11996)
  66. end
  67. elseif HasCompletedQuest(Spawn, PickingUpSlack) and not HasCompletedQuest(Spawn, AGuardInsignia) and not HasQuest(Spawn, AGuardInsignia) then
  68. local chance = math.random(100)
  69. if not HasItem(Spawn, 2333) and chance <= 45 then
  70. AddLootItem(NPC, 2333)
  71. end
  72. end
  73. end