PDA

View Full Version : Simple mob Script template



mag1212
20-02-10, 05:25 AM
having trouble with scripting but u still want to have your private server content scripted?
this is the solution for u. its very simple to use just fill out the script and its done

function NPCName_OnCombat(pUnit, Event)
pUnit:SendChatMessage(14, 0, "What the npc will say when its pulled")
pUnit:RegisterEvent("NPCName_SpellName", Time Elapsed before the spell is used, 0) 1000=1second
pUnit:RegisterEvent("NPCName_SpellName", Time Elapsed before the spell is used, 0)
pUnit:RegisterEvent("NPCName_SpellName", Time Elapsed before the spell is used, 0)
pUnit:RegisterEvent("NPCName_SpellName", Time Elapsed before the spell is used, 0)

end

function NPCname_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end

function NPCName_OnKillTarget(pUnit, Event)
end

function NPCname_OnDeath(pUnit, Event)
pUnit:SendChatMessage(14, 0, "What the npc will say when its dead")
pUnit:RemoveEvents()
end

RegisterUnitEvent(SpellID, 1, "NPCname_OnCombat")
RegisterUnitEvent(SpellID, 2, "NPCname_OnLeaveCombat")
RegisterUnitEvent(SpellID, 3, "NPCname_OnKillTarget")
RegisterUnitEvent(SpellID, 4, "NPCname_OnDeath")

function NPCName_SpellName(pUnit, Event)
pUnit:FullCastSpellOnTarget(SpellID, pUnit:GetRandomPlayer or ClosestPlayer or Maintank(0))
end

function NPCName_SpellName(pUnit, Event)
pUnit:FullCastSpellOnTarget(SpellID, pUnit:GetRandomPlayer or ClosestPlayer or Maintank(0))
end

function NPCName_SpellName(pUnit, Event)
pUnit:CastSpell(SpellID)
end

function NPCName_SpellName(pUnit, Event)
pUnit:FullCastSpellOnTarget(SpellID, pUnit:GetRandomPlayer or ClosestPlayer or Maintank(0))
end