bala1412

Member
ServUO Version
Publish 57
Ultima Expansion
Endless Journey
using System;
using Server.Items;

namespace Server.Mobiles
{
[CorpseName("a rotting corpse")]
public class Zombie : BaseCreature
{
[Constructable]
public Zombie()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Name = "a zombie";
Body = 3;
BaseSoundID = 471;


SetStr(46, 70);
SetDex(31, 50);
SetInt(26, 40);

SetHits(68, 92);

SetDamage(3, 7);

SetDamageType(ResistanceType.Physical, 100);

SetResistance(ResistanceType.Physical, 15, 20);
SetResistance(ResistanceType.Cold, 20, 30);
SetResistance(ResistanceType.Poison, 5, 10);

SetSkill(SkillName.MagicResist, 15.1, 40.0);
SetSkill(SkillName.Tactics, 35.1, 50.0);
SetSkill(SkillName.Wrestling, 35.1, 50.0);

Fame = 120;
Karma = -120;

VirtualArmor = 18;

PackBodyPartOrBones();
}

public Zombie(Serial serial)
: base(serial)
{
}

public override bool BleedImmune
{
get
{
return true;
}
}
public override Poison PoisonImmune
{
get
{
return Poison.Regular;
}
}
public override void OnThink()
{
base.OnThink();


if (NextCallout == TimeSpan.Zero)
{
int toRescue = 0;

if(Hits < (HitsMax * 0.10) && Combatant != null)
{
switch(Utility.RandomMinMax( 1, 2 ))
{
case 1: Say("Hi."); break;
case 2: Say("Hello."); break;

default: break;
}
NextCallout = TimeSpan.FromSeconds(Utility.RandomMinMax( 25,30));
}
}
}

private DateTime _nextCallHelp;

[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public TimeSpan NextCallout
{
get
{
TimeSpan time = _nextCallHelp - DateTime.Now;

if (time < TimeSpan.Zero)
time = TimeSpan.Zero;

return time;
}
set
{
try { _nextCallHelp = DateTime.Now + value; }
catch { }
}
}

public override TribeType Tribe { get { return TribeType.Undead; } }

public override OppositionGroup OppositionGroup
{
get
{
return OppositionGroup.FeyAndUndead;
}
}
public override void GenerateLoot()
{
AddLoot(LootPack.Meager);
}

public override bool IsEnemy(Mobile m)
{
if(Region.IsPartOf("Haven Island"))
{
return false;
}

return base.IsEnemy(m);
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}
The above script is my zombie.cs script. When attacking a monster, the monster shouts hi and hello. Can I make this monster not talk hi and hello when the monster is in battle after successful taming? I have another question. Is there a way to get a tame monster to give an answer like "okay" if I shout a command like "all stay / all kill" to a tame monster? I'm curious.
 
Perhaps something like this...
public override bool HandlesOnSpeech(Mobile from)
{
if (from.InRange(Location, 8))
return true;

return base.HandlesOnSpeech(from);
}

public override void OnSpeech(SpeechEventArgs e)
{
if (!e.Handled && e.Mobile.InRange(Location, 2))
{
PlayerMobile pm = e.Mobile as PlayerMobile;

if (!IsDeadPet && Controlled && (ControlMaster == from || IsPetFriend(from)))
{

string keyword = e.Speech.ToLower();

switch (keyword)
{
case "all stay":
{
Say("Sure, I have nothing better to do.");
break;
}
case "all kill":
{
Say("Sweet, can a rip off a piece for myself?");
break;
}
case "all stop":
{
Say("Gee Master; you aren't much fun.");
break;
}
case "all follow me":
{
Say("Ok, as long as it doesn't lead to a dirt nap.");
break;
}

}
}
}
base.OnSpeech(e);
}
 
Perhaps something like this...
Thank you for your reply. This error pops up, is there a solution?
CS0103: Line 292: The name 'from' does not exist in the current context
CS0103: Line 292: The name 'from' does not exist in the current context
Scripts: One or more scripts failed to compile or no script files were found.
 
remove this line...


It will work without it, but best to have a condition for ControlMaster. I'll play with it later.
It works perfectly well. But can you only let it be invoked by the tame master? When other users around you shout "all stay" the same way, the tame monster answers the same way.
 
I properly placed the condition into the 'HandlesOnSpeech' ...oops :) . It still will talk if it is dead (not sure why) but will only talk if speech comes from control master. Try it, let me know how it works. I hadn't done much testing.
public override bool HandlesOnSpeech(Mobile from)
{

if (from.InRange(Location, 8) && !IsDeadPet && Controlled && (ControlMaster == from || IsPetFriend(from)))
return true;

return base.HandlesOnSpeech(from);
}

public override void OnSpeech(SpeechEventArgs e)
{
if (!e.Handled && e.Mobile.InRange(Location, 2))
{
PlayerMobile pm = e.Mobile as PlayerMobile;

string keyword = e.Speech.ToLower();

switch (keyword)
{
case "all stay":
{
Say("Sure, I have nothing better to do.");
break;
}
case "all kill":
{
Say("Sweet, can a rip off a piece for myself?");
break;
}
case "all stop":
{
Say("Gee Master; you aren't much fun.");
break;
}
case "all follow me":
{
Say("Ok, as long as it doesn't lead to a dirt nap.");
break;
}

}
}
base.OnSpeech(e);
}
 
Last edited:
I properly placed the condition into the 'HandlesOnSpeech' ...oops :) . It still will talk if it is dead (not sure why) but will only talk if speech comes from control master. Try it, let me know how it works. I hadn't done much testing.
Oh! It works perfectly well. Thanks to this, the users who are taming can enjoy it more. Thank you.
 

Active Shards

Donations

Total amount
$50.00
Goal
$1,000.00
Back