I'm trying to make a script for an attacker that will also make remarks.


It compiles fine but when I [Add the object in game I see this on the server console:

19:34:15 Client: 127.0.0.1: Entered World (0xA790 "Piper")
19:34:32 Offending Mobile: Server.Mobiles.banshee [0x4E5 "Chaya"]
19:34:32 Offending Item: 0x40022A34 "StuddedBustierArms" [Server.Items.StuddedBustierArms]
19:34:32 Equipped Item: 0x40022A1E "FemaleStuddedChest" [Server.Items.FemaleStuddedChest]
19:34:32 Layer: InnerTorso


Here's the script, it's cobbled together from a few sources:

using System;
using Server;
using Server.Items;
using Server.Network;
using Server.Mobiles;
using Server.ContextMenus;
using System.Collections.Generic;
using System.Data;

namespace Server.Mobiles
{


public class banshee : BaseCreature
{


// public int Clothcol;
private static bool m_Talked;

string[] kfcsay = new string[]
{

"Prepare to die!",
"You won't get away!",
"There! Get them!",
"Hurry, this way!",
"Aarrgghh!",
"Come here!",
"I can smell your fear!",
"Go meet your maker!"
};


[Constructable]
public banshee()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.8, 3.0)
{

{




this.Name = NameList.RandomName("female");
this.Title = "the Banshee";

SpeechHue = 56;
Hue = Utility.RandomSkinHue();
Item hair = new Item(Utility.RandomList(0x2FC2, 0x2FC2));
hair.Hue = Utility.RandomNeutralHue();
hair.Layer = Layer.Hair;
hair.Movable = false;
AddItem(hair);
}
{
SetStr(200);
SetDex(200);
SetInt(200);
SetStr(186, 200);

SetDamage(33, 66);

SetSkill(SkillName.Fencing, 66.0, 97.5);
SetSkill(SkillName.Macing, 65.0, 87.5);
SetSkill(SkillName.MagicResist, 25.0, 47.5);
SetSkill(SkillName.Swords, 65.0, 87.5);
SetSkill(SkillName.Tactics, 65.0, 87.5);
SetSkill(SkillName.Wrestling, 15.0, 37.5);
Body = 0x191;
AddItem(new LeatherGorget());
AddItem(new LeatherSkirt());
AddItem(new FemaleStuddedChest());
AddItem(new StuddedBustierArms());
AddItem(new Boots());
Name = NameList.RandomName("female");
Fame = 1000;
Karma = -1000;


SetSkill(SkillName.Discordance, 60.0, 70.0);
}
{

Container pack = new Backpack();
pack.DropItem(new Gold(0, 50));
pack.Movable = false;
AddItem(pack);
}


{



}




switch ( Utility.Random(7))
{
case 0:
AddItem(new Longsword());
break;
case 1:
AddItem(new Cutlass());
break;
case 2:
AddItem(new Broadsword());
break;
case 3:
AddItem(new Axe());
break;
case 4:
AddItem(new Club());
break;
case 5:
AddItem(new Dagger());
break;
case 6:
AddItem(new Spear());
break;
}




}


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

public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (m_Talked == false)
{
if (m.InRange(this, 1))
{
m_Talked = true;
SayRandom(kfcsay, this);
this.Move(GetDirectionTo(m.Location));
SpamTimer t = new SpamTimer();
t.Start();
}
}
}

private class SpamTimer : Timer
{
public SpamTimer()
: base(TimeSpan.FromSeconds(10))
{
Priority = TimerPriority.OneSecond;
}

protected override void OnTick()
{
m_Talked = false;
}
}

private static void SayRandom(string[] say, Mobile m)
{
m.Say(say[Utility.Random(say.Length)]);
}

public override bool AlwaysMurderer
{
get
{
return true;
}
}

public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

writer.Write((int)0); // version
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);

int version = reader.ReadInt();
}
}
}
 
Well one problem is that "studdedbustierarms" is actually just the bustier and sits on the chest slot, so you cant have it and the female studded chest on the same slot/layer.
 
Ahh OK - thanks... which folder is armor stored in?

I'm looking for a way to spawn shadow plate armor on an NPC. Can it be changed with hue?
 
Just set the resource type when creating it on the NPC...

BaseArmor armor = (BaseArmor)item;
armor.Resource = CraftResource.ShadowIron;
 
I kind of follow what you're saying but I'm not 100%. Am I doing this?

BaseArmor armor = (BaseArmor)FemalePlateChest;
armor.Resource = CraftResource.ShadowIron;
this.AddItem(new FemalePlateChest());
 
BaseArmor armor = new FemalePlateChest();
armor.Resource = CraftResource.ShadowIron;
this.AddItem( armor );
 
You can also write it in a shorter version (just to complete the examples)

C#:
Additem( new FemalePlateChest() { Resource = CraftResource.ShadowIron });
 
You can also write it in a shorter version (just to complete the examples)

C#:
Additem( new FemalePlateChest() { Resource = CraftResource.ShadowIron });

I tried it this way - loads of errors about objects not existing.

Weird though, I tried the other method listed above and all of the spawns have regular armor, not iron plate. If I make a new spawn it does correctly use iron plate.
 
That fixed it. Any idea why the plate armor is losing color when I log out? It still says ShadowIron but the NPC and it's paperdoll are just regular plate.
 
I don't have crafted armor on them, they're spawning with the armor command you showed me. Is there a better way for me to do it?
 
No I ment, what happens if you craft armor yourself. Does that lose the hue too? If so all armor? Or just that piece of armor?
 
Well you know what? I crafted shadow iron plate and put it on a spawned NPC, logged out, logged in and the color was still there. So I went to one of the spawns that was not working, deleted the spawn, re-added it, logged out/in and the color was still there....!
 
Back