12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- --[[
- Script Name : SpawnScripts/Commonlands/SWUndeathSentry.lua
- Script Author : Premierio015
- Script Date : 2021.05.12 09:05:54
- Script Purpose :
- :
- --]]
- local BrokenEquipment = 415
- function spawn(NPC)
- AddSpawnAccess(NPC, NPC)
- SetPlayerProximityFunction(NPC, 10, "InRange")
- end
- function respawn(NPC)
- spawn(NPC)
- end
- function InRange(NPC, Spawn)
- if HasQuest(Spawn, BrokenEquipment) then
- AddSpawnAccess(NPC, Spawn)
- AddPrimaryEntityCommand(Spawn, NPC, "repair", 2, "")
- elseif QuestStepIsComplete(Spawn, BrokenEquipment) == 4 then
- RemoveSpawnAccess(NPC, Spawn)
- end
- end
- function casted_on(NPC, Spawn, SpellName)
- if SpellName == 'repair' and HasItem(Spawn, 15095) then
- if HasQuest(Spawn, BrokenEquipment) and not QuestStepIsComplete(Spawn, BrokenEquipment, 4) then
- SetStepComplete(Spawn, BrokenEquipment, 4)
- RemoveItem(Spawn, 15095)
- elseif not HasItem(Spawn, 15095) then
- SendMessage(Spawn, "You need an undying essence to repair the sentry. You can get one from the undead that patrol these ruins")
- end
- end
- end
|