Originally Posted by
weezyC
Does anyone know if its possible to change npc factions after the death of another npc in lua?
Say you kill Thrall, then the guards around him change factions to be friendly with alliance.
Is that possible in lua?
---------- Post added at 09:31 PM ---------- Previous post was at 07:45 PM ----------
Anyone?!?!?!
Code:
local THRALLID = IDHERE
local GUARDID = IDHERE
local Guard = nil
function Thrall_OnSpawn(pUnit, event)
pUnit = Thrall
end
function Guard_OnSpawn(pUnit, event)
pUnit = Guard
Guard:RegisterEvent("DeathCheck", 1000, 0)
end
function DeathCheck(pUnit, event)
if Thrall:IsAlive()==false then
Guard:SetFaction(FACTIONIDHERE)
end
Guard:RegisterEvent("DeathCheck", 1000, 0)
end
RegisterUnitEvent(GUARDID, 18, "Guard_OnSpawn")
RegisterUnitEvent(THRALLID, 18, "Thrall_OnSpawn")
Not tested.