9
3

aChair.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --[[
  2. Script Name : SpawnScripts/TroubledHaunt/aChair.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.11.23 12:11:26
  5. Script Purpose :
  6. :
  7. --]]
  8. function spawn(NPC)
  9. zone = GetZone(NPC)
  10. if GetSpawnLocationID(NPC)==133780830 or GetSpawnLocationID(NPC)==133780829 then
  11. AddTimer(NPC,1000,"ChairMove1")
  12. end
  13. end
  14. function respawn(NPC)
  15. spawn(NPC)
  16. end
  17. function ChairMove1(NPC)
  18. local zone = GetZone(NPC)
  19. if IsAlive(GetSpawnByLocationID(zone,133780858))==true then
  20. SpawnSet(NPC,"pitch",MakeRandomInt(40,70))
  21. SpawnSet(NPC,"roll",MakeRandomInt(130,170))
  22. Head = GetHeading(NPC)
  23. SpawnSet(NPC,"Heading",(Head+3))
  24. AddTimer(NPC,500,"ChairMove1")
  25. else
  26. if GetSpawnLocationID(NPC)==133780830 then
  27. SpawnByLocationID(zone,133780841)
  28. Despawn(NPC)
  29. PlaySound(NPC,"sounds/ui/place_item.wav",GetX(NPC), GetY(NPC), GetZ(NPC))
  30. elseif GetSpawnLocationID(NPC)==133780829 then
  31. SpawnByLocationID(zone,133780842)
  32. Despawn(NPC)
  33. PlaySound(NPC,"sounds/ui/place_item.wav",GetX(NPC), GetY(NPC), GetZ(NPC))
  34. end
  35. end
  36. end