that actually probably possible through creature Ai and not challenging either......
if its possible i would think this is how you do it
Code:
#include "StdAfx.h"
#include "Setup.h"
class GuardAI : public CreatureAIScript
{
public:
GuardAI(Creature* pCreature) : CreatureAIScript(pCreature) {}
void OnDied(Unit * mKiller)
{
}
void OnCombatStart(Unit* mTarget)
{
if(mTarget->IsPlayer() && mTarget->GetTeam() != _unit->GetTeam())
{
Player * plr = objmgr.GetPlayer(mTarget->GetGUID());
plr->BroadcastMessage("Area Under attack");
Channel * chan = channelmgr.GetChannel("World Defence", plr);
chan->Say(plr, "Your area is under attack", plr, true);
}
}
void Destroy()
{
delete (GuardAI*)this;
}
static CreatureAIScript *Create(Creature * c) { return new GuardAI(c); }
};
CreatureAIScript * create_guard(Creature * c) { return new GuardAI(c); }
void SetupMafiaInstance(ScriptMgr * mgr)
{
mgr->register_creature_script(100001, &GuardAI::Create);
}