I though this was an interesting one to script, and probably many people would need it too. /emoticons/default_smile.png
[CODE]-- Keep Out
SET @ENTRY := 78713;
DELETE FROM creature_template
WHERE entry
=@ENTRY;
INSERT INTO creature_template
( entry
,difficulty_entry_1
,difficulty_entry_2
,difficulty_entry_3
,KillCredit1
,KillCredit2
,modelid1
,modelid2
,modelid3
,modelid4
,name
,subname
,IconName
,gossip_menu_id
,minlevel
,maxlevel
,exp
,faction_A
,faction_H
,npcflag
,speed_walk
,speed_run
,scale
,rank
,mindmg
,maxdmg
,dmgschool
,attackpower
,dmg_multiplier
,baseattacktime
,rangeattacktime
,unit_class
,unit_flags
,dynamicflags
,family
,trainer_type
,trainer_spell
,trainer_class
,trainer_race
,minrangedmg
,maxrangedmg
,rangedattackpower
,type
,type_flags
,lootid
,pickpocketloot
,skinloot
,resistance1
,resistance2
,resistance3
,resistance4
,resistance5
,resistance6
,spell1
,spell2
,spell3
,spell4
,spell5
,spell6
,spell7
,spell8
,PetSpellDataId
,VehicleId
,mingold
,maxgold
,AIName
,MovementType
,InhabitType
,Health_mod
,Mana_mod
,Armor_mod
,RacialLeader
,questItem1
,questItem2
,questItem3
,questItem4
,questItem5
,questItem6
,movementId
,RegenHealth
,equipment_id
,mechanic_immune_mask
,flags_extra
,ScriptName
,WDBVerified
)VALUES
(@ENTRY,0,0,0,0,0,262,0,0,0,“Keep Out”,“You shouldn’t be here”,“”,0,255,255,0,35,35,0,1.5,1.5,1,1,1,1,0,1,1,1,1,1,390,0,0,0,0,0,0,1,1,1,10,8,0,0,0,500,500,500,500,500,500,0,0,0,0,0,0,0,0,0,0,0,0,“”,0,1,1,1,2.5,0,0,0,0,0,0,0,0,8,0,0,0,“npc_keep_out”,-1);[/sql]
Basic Keep Out NPC, teleports away anyone without a GM tag who gets within 15 yards of the creature.
[code]/*######
npc_keep_out
######*/
class npc_keep_out : public CreatureScript
{
public:
npc_keep_out() : CreatureScript(“npc_keep_out”) { }
struct npc_keep_outAI : public ScriptedAI
{
npc_keep_outAI(Creature* creature) : ScriptedAI(creature) { }
void MoveInLineOfSight(Unit* who)
{
if (!who)
return;
if (Player* player = who->ToPlayer())
{
if (player->isGameMaster()) // Only if GM tag is on we will ignore, else we will teleport this player as well
return;
if (!player->IsBeingTeleported() && me->IsWithinDist(player, 15.0f))
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
}
}
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_keep_outAI(creature);
}
};[/code]
This one teleports players away if they are below a certain level. Just change the ‘xx’ to the level you want to restrict.
[spoiler][code]
/*######
npc_keep_out
######*/
class npc_keep_out : public CreatureScript
{
public:
npc_keep_out() : CreatureScript(“npc_keep_out”) { }
struct npc_keep_outAI : public ScriptedAI
{
npc_keep_outAI(Creature* creature) : ScriptedAI(creature) { }
void MoveInLineOfSight(Unit* who)
{
if (!who)
return;
if (Player* player = who->ToPlayer())
{
if (player->isGameMaster()) // Only if GM tag is on we will ignore, else we will teleport this player as well
return;
if (!player->IsBeingTeleported() && me->IsWithinDist(player, 15.0f))
if (player->getLevel() <= xx)
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
}
}
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_keep_outAI(creature);
}
};
[/code]
[/spoiler]
[/CODE]