本文整理汇总了C#中DOL.GS.GameNPC.SetOwnBrain方法的典型用法代码示例。如果您正苦于以下问题:C# GameNPC.SetOwnBrain方法的具体用法?C# GameNPC.SetOwnBrain怎么用?C# GameNPC.SetOwnBrain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.GameNPC
的用法示例。
在下文中一共展示了GameNPC.SetOwnBrain方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_EXAMPLES)
return;
#region defineNPCs
GameNPC[] npcs = WorldMgr.GetNPCsByName("Sir Quait", eRealm.Albion);
npcs = WorldMgr.GetNPCsByName("Sir Quait", (eRealm)1);
GameNPC SirQuait = null;
if (npcs.Length == 0)
{
SirQuait = new DOL.GS.GameNPC();
SirQuait.Model = 40;
SirQuait.Name = "Sir Quait";
if (log.IsWarnEnabled)
log.Warn("Could not find " + SirQuait.Name + ", creating ...");
SirQuait.Realm = eRealm.Albion;
SirQuait.CurrentRegionID = 1;
SirQuait.Size = 50;
SirQuait.Level = 10;
SirQuait.MaxSpeedBase = 100;
SirQuait.Faction = FactionMgr.GetFactionByID(0);
SirQuait.X = 531971;
SirQuait.Y = 478955;
SirQuait.Z = 0;
SirQuait.Heading = 3570;
SirQuait.RespawnInterval = 0;
SirQuait.BodyType = 0;
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 0;
brain.AggroRange = 0;
SirQuait.SetOwnBrain(brain);
SirQuait.AddToWorld();
}
else
{
SirQuait = npcs[0];
}
#endregion
#region defineBehaviours
BaseBehaviour b = new BaseBehaviour(SirQuait);
MessageAction a = new MessageAction(SirQuait,"This is just a simple test bahaviour.",eTextType.Emote);
b.AddAction(a);
InteractTrigger t = new InteractTrigger(SirQuait,b.NotifyHandler,SirQuait);
b.AddTrigger(t);
// store the behaviour in a list so it won't be garbage collected
behaviours.Add(b);
#endregion
log.Info("Simple Test Behaviour added");
}
示例2: SpawnTimedAdd
/// <summary>
/// Create an add from the specified template.
/// </summary>
/// <param name="templateID"></param>
/// <param name="level"></param>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="uptime"></param>
/// <returns></returns>
protected GameNPC SpawnTimedAdd(int templateID, int level, int x, int y, int uptime, bool isRetriever)
{
GameNPC add = null;
try
{
if (m_addTemplate == null || m_addTemplate.TemplateId != templateID)
{
m_addTemplate = NpcTemplateMgr.GetTemplate(templateID);
}
// Create add from template.
// The add will automatically despawn after 30 seconds.
if (m_addTemplate != null)
{
add = new GameNPC(m_addTemplate);
if (isRetriever)
{
add.SetOwnBrain(new RetrieverMobBrain());
}
add.CurrentRegion = this.CurrentRegion;
add.Heading = (ushort)(Util.Random(0, 4095));
add.Realm = 0;
add.X = x;
add.Y = y;
add.Z = Z;
add.CurrentSpeed = 0;
add.Level = (byte)level;
add.RespawnInterval = -1;
add.AddToWorld();
new DespawnTimer(this, add, uptime * 1000);
}
}
catch
{
log.Warn(String.Format("Unable to get template for {0}", Name));
}
return add;
}
示例3: ApplyEffectOnTarget
/// <summary>
/// Apply effect on target or do spell action if non duration spell
/// </summary>
/// <param name="target">target that gets the effect</param>
/// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
{
GamePlayer player = Caster as GamePlayer;
if (player == null)
{
return;
}
INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn);
if (template == null)
{
if (log.IsWarnEnabled)
log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString());
MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System);
return;
}
GameSpellEffect effect = CreateSpellEffect(target, effectiveness);
TitanBrain controlledBrain = new TitanBrain(player);
controlledBrain.IsMainPet = false;
controlledBrain.WalkState = eWalkState.Stay;
summoned = new GameNPC(template);
summoned.SetOwnBrain(controlledBrain);
//Suncheck:
// Is needed, else it can cause error (i.e. /cast-command)
if (x == 0 || y == 0)
CheckCastLocation();
summoned.X = x;
summoned.Y = y;
summoned.Z = z;
summoned.CurrentRegion = player.CurrentRegion;
summoned.Heading = (ushort)((player.Heading + 2048) % 4096);
summoned.Realm = player.Realm;
summoned.CurrentSpeed = 0;
summoned.Size = 10;
summoned.Level = 100;
summoned.Flags |= GameNPC.eFlags.PEACE;
summoned.AddToWorld();
controlledBrain.AggressionState = eAggressionState.Aggressive;
effect.Start(summoned);
m_growTimer = new RegionTimer((GameObject)m_caster, new RegionTimerCallback(TitanGrows), C_GROWTIMER);
}
示例4: Zephyr
private void Zephyr(GamePlayer target)
{
if (!target.IsAlive || target.ObjectState != GameLiving.eObjectState.Active) return;
GameNPC npc = new GameNPC();
m_npc = npc;
npc.Realm = Caster.Realm;
npc.Heading = Caster.Heading;
npc.Model = 1269;
npc.Y = Caster.Y;
npc.X = Caster.X;
npc.Z = Caster.Z;
npc.Name = "Forceful Zephyr";
npc.MaxSpeedBase = 400;
npc.Level = 55;
npc.CurrentRegion = Caster.CurrentRegion;
npc.Flags |= GameNPC.eFlags.PEACE;
npc.Flags |= GameNPC.eFlags.DONTSHOWNAME;
npc.Flags |= GameNPC.eFlags.CANTTARGET;
BlankBrain brain = new BlankBrain();
npc.SetOwnBrain(brain);
npc.AddToWorld();
npc.TempProperties.setProperty("target", target);
GameEventMgr.AddHandler(npc, GameNPCEvent.ArriveAtTarget, new DOLEventHandler(ArriveAtTarget));
npc.Follow(target, 10, 1500);
m_target = target;
StartTimer();
}