9
3

afilthyblacksmith.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --[[
  2. Script Name : SpawnScripts/Cache/afilthyblacksmith.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.12.05 04:12:43
  5. Script Purpose :
  6. :
  7. --]]
  8. require "SpawnScripts/Generic/CombatModule"
  9. function spawn(NPC, Spawn)
  10. combatModule(NPC, Spawn)
  11. SetPlayerProximityFunction(NPC, 6, "InRange", "LeaveRange")
  12. SetTempVariable(NPC, "OnGuard", "true")
  13. end
  14. function InRange(NPC,Spawn)
  15. if GetTempVariable(NPC,"OnGuard")=="true" and not IsInCombat(NPC) and GetY(Spawn) <=2 then
  16. FaceTarget(NPC,Spawn)
  17. SetTempVariable(NPC, "OnGuard", "false")
  18. AddTimer(NPC,2500,"Checking",1,Spawn)
  19. AddTimer(NPC,6000,"Checking",1,Spawn)
  20. AddTimer(NPC,8000,"Checking",1,Spawn)
  21. AddTimer(NPC,10000,"ResetGuard",1,Spawn)
  22. AddTimer(NPC,9000,"ResetGuardEmote",1,Spawn)
  23. choice = MakeRandomInt(1,3)
  24. if choice ==1 then
  25. PlayFlavor(NPC, "", "What was that?", "peer", 0, 0, Spawn, 0)
  26. elseif choice ==2 then
  27. PlayFlavor(NPC, "", "", "doubletake", 0, 0, Spawn, 0)
  28. SendMessage(Spawn,"The smith heard something.")
  29. elseif choice ==3 then
  30. PlayFlavor(NPC, "", "Did you hear that?", "stare", 0, 0, Spawn, 0)
  31. end
  32. end
  33. end
  34. function LeaveRange(NPC,Spawn)
  35. if GetTempVariable(NPC,"OnGuard")=="false" then
  36. SetTempVariable(NPC, "OnGuard", "true")
  37. end
  38. end
  39. function Checking(NPC,Spawn)
  40. if GetDistance(NPC,Spawn) <=8 and HasMoved(Spawn)and GetY(Spawn) <=2 then
  41. Attack(NPC,Spawn)
  42. end
  43. end
  44. function respawn(NPC)
  45. spawn(NPC)
  46. end
  47. function aggro(NPC,Spawn)
  48. choice = MakeRandomInt(1,3)
  49. if choice ==1 then
  50. PlayFlavor(NPC, "voiceover/english/optional5/halfelf_base_2/ft/halfelf/halfelf_base_2_1_halfhealth_gm_5ed9a68.mp3", "I won't give up that easily.", "", 3605027223, 2986829956, Spawn, 0)
  51. elseif choice ==2 then
  52. PlayFlavor(NPC, "voiceover/english/halfelf_base_1/ft/halfelf/halfelf_base_1_1_aggro_gm_13a3055.mp3", "Summon help, intruders have arrived!", "", 262436067, 4127133618, Spawn, 0)
  53. elseif choice ==3 then
  54. PlayFlavor(NPC, "voiceover/english/halfelf_base_1/ft/halfelf/halfelf_base_1_1_death_gm_610c650e.mp3", "You must flee! I'll try to hold them.", "", 3580386891, 3023137994, Spawn, 0)
  55. end
  56. end