9
3

abanditcook.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. --[[
  2. Script Name : SpawnScripts/Cache/abanditcook.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.12.05 04:12:53
  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) <=0 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 cook heard something.")
  29. elseif choice ==3 then
  30. PlayFlavor(NPC, "", "Hmm?", "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 aggro(NPC,Spawn)
  40. choice = MakeRandomInt(1,4)
  41. if choice ==1 then
  42. PlayFlavor(NPC, "voiceover/english/optional3/human_base_1/ft/human/human_base_1_1_aggro_gf_583690dc.mp3", "Summon help! We have invaders!", "", 1598905349, 2204481929, Spawn, 0)
  43. elseif choice ==2 then
  44. PlayFlavor(NPC, "voiceover/english/optional3/human_base_1/ft/human/human_base_1_1_halfhealth_gf_8529e507.mp3", "I can't hold them forever!", "", 3371581229, 792393228, Spawn, 0)
  45. elseif choice ==3 then
  46. PlayFlavor(NPC, "voiceover/english/optional3/human_base_1/ft/human/human_base_1_1_aggro_gf_a203c9ec.mp3", "Prepare to face your doom, meddler.", "", 3593389433, 3838830228, Spawn, 0)
  47. elseif choice ==4 then
  48. PlayFlavor(NPC, "voiceover/english/optional3/barbarian_base_1/ft/barbarian/barbarian_base_1_2_aggro_gf_394a7fe3.mp3", "Not sneaky enough to get past me.", "", 1014195867, 4030043484, Spawn, 0)
  49. end
  50. end
  51. function Checking(NPC,Spawn)
  52. if GetDistance(NPC,Spawn) <=8 and HasMoved(Spawn) then
  53. Attack(NPC,Spawn)
  54. end
  55. end
  56. function respawn(NPC)
  57. spawn(NPC)
  58. end