RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Vampire monster problem!

Whooper7777

Wanderer
Vampire monster problem!

here is my script:
Code:
using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "an vampire's corpse" )]
	public class Vampire : BaseCreature
	{
		[Constructable]
		public Vampire() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = Vampire;
			Body = 400;
			BaseSoundID = 0x482;
			Hue = 0x4001;

			SetStr( 145, 234 );
			SetDex( 96, 115 );
			SetInt( 545, 876 );

			SetHits( 560, 595 );

			SetDamage( 15, 27 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Cold, 40 );
			SetDamageType( ResistanceType.Energy, 40 );

			SetResistance( ResistanceType.Physical, 55, 65 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 50, 60 );
			SetResistance( ResistanceType.Poison, 50, 60 );
			SetResistance( ResistanceType.Energy, 25, 30 );

			SetSkill( SkillName.EvalInt, 120.1, 130.0 );
			SetSkill( SkillName.Magery, 120.1, 130.0 );
			SetSkill( SkillName.Meditation, 100.1, 101.0 );
			SetSkill( SkillName.Poisoning, 100.1, 101.0 );
			SetSkill( SkillName.MagicResist, 175.2, 200.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.Wrestling, 75.1, 100.0 );

			Fame = 23000;
			Karma = -23000;

			VirtualArmor = 60;

			PackNecroReg( 150, 200 );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.FilthyRich, 3 );
			AddLoot( LootPack.MedScrolls, 2 );
		}

		public override bool Unprovokable{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override int TreasureMapLevel{ get{ return 5; } }

		public override void InitOutfit()
		{

			AddItem( new HoodedShroudOfShadows );
			Hue = 2222
		}

		public Vampire( Serial serial ) : base( serial )
		{
		}
    
		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();
		}
	}
}
how i can set for that monster weared hooded shroud of shadwos and that is hued on my specific hue and then that robe is blessed so players cant get it?
 

UOT

Knight
First you need to make a reference to you item so you can manipulate its values and then add it. So lets start from what you have
Code:
		public override void InitOutfit()
		{

			AddItem( new HoodedShroudOfShadows );
			Hue = 2222
		}
Before we start I need to point out 2 things: 1) Hue =2222 doesn't have the ; at the end so that would give you an error 2) without the item reference it will look at the current class for Hue and change that to 2222 so you mobile will have that hue, if the current class didn't have Hue it would give you an error. With that being said lets go on with the lesson :)
So first we make the item reference for the shroud
Code:
Item shroud = new HoodedShroudOfShadow();
Notice the () after the class name HoodedShroudOfShadow, you have to add that when declaring a new class if your object needed any parameters for it's constructor they would go between those brackets. Now shroud is our Item reference and that's what we'll refer to, to change it's values. Next we want to change the hue and make it blessed
Code:
 shroud.Hue = 2222;
shroud.LootType = LootType.Blessed;
Now since we are done manipulating our item we are ready to add it to the mobile
Code:
AddItem( shroud );
Another thing to notice is that we didn't use the keyword new, that's because we already have an instance of the object, besides new should only be used with class names to create a new instance of the class not with object references. So now our completed code should look like this
Code:
		public override void InitOutfit()
		{
			Item shroud = new HoodedShroudOfShadow();
			shroud.Hue = 2222;
			shroud.LootType = LootType.Blessed;
			AddItem( shroud );
		}
Just use the same concept for any item that you need to manipulate before adding.
 

DHMagicMan

Wanderer
Thanks UOT.

It wasn't my question but reading through your step-by-step expanation of how this works helps me understand more about scripting for RunUO.

Great post!
 

Whooper7777

Wanderer
hmm

I have done what did you say but i got one error here is the script:
Code:
using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "an vampire's corpse" )]
	public class Vampire : BaseCreature
	{
		[Constructable]
		public Vampire() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = Vampire;
			Body = 400;
			BaseSoundID = 0x482;
			Hue = 0x4001;

			SetStr( 145, 234 );
			SetDex( 96, 115 );
			SetInt( 545, 876 );

			SetHits( 560, 595 );

			SetDamage( 15, 27 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Cold, 40 );
			SetDamageType( ResistanceType.Energy, 40 );

			SetResistance( ResistanceType.Physical, 55, 65 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 50, 60 );
			SetResistance( ResistanceType.Poison, 50, 60 );
			SetResistance( ResistanceType.Energy, 25, 30 );

			SetSkill( SkillName.EvalInt, 120.1, 130.0 );
			SetSkill( SkillName.Magery, 120.1, 130.0 );
			SetSkill( SkillName.Meditation, 100.1, 101.0 );
			SetSkill( SkillName.Poisoning, 100.1, 101.0 );
			SetSkill( SkillName.MagicResist, 175.2, 200.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.Wrestling, 75.1, 100.0 );

			Fame = 23000;
			Karma = -23000;

			VirtualArmor = 60;

			PackNecroReg( 150, 200 );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.FilthyRich, 3 );
			AddLoot( LootPack.MedScrolls, 2 );
		}

		public override void InitOutfit()
		{
			Item shroud = new HoodedShroudOfShadow();
			shroud.Hue = 2654;
			shroud.LootType = LootType.Blessed;
			AddItem( shroud );
		}

		public override bool Unprovokable{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override int TreasureMapLevel{ get{ return 5; } }

		public Vampire( Serial serial ) : base( serial )
		{
		}
    
		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();
		}
	}
}
Code:
and here that one error
Scripts: Compiling C# scripts...failed (1 errors, 1 warnings)
 - Warning: Scripts\Customs\Muut\autoBankStone.cs: CS0105: (line 5, column 7) Th
e using directive for 'Server.Items' appeared previously in this namespace
 - Error: Scripts\Mobiles\Monsters\Humanoid\Magic\Vampire.cs: CS0115: (line 58,
column 24) 'Server.Mobiles.Vampire.InitOutfit()': no suitable method found to ov
erride
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
 

UOT

Knight
Inside the class constructor you should be able add loot by using PackItem(). So somewhere in here
Code:
		[Constructable]
		public Vampire() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = Vampire;
			Body = 400;
			BaseSoundID = 0x482;
			Hue = 0x4001;

			SetStr( 145, 234 );
			SetDex( 96, 115 );
			SetInt( 545, 876 );

			SetHits( 560, 595 );

			SetDamage( 15, 27 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Cold, 40 );
			SetDamageType( ResistanceType.Energy, 40 );

			SetResistance( ResistanceType.Physical, 55, 65 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 50, 60 );
			SetResistance( ResistanceType.Poison, 50, 60 );
			SetResistance( ResistanceType.Energy, 25, 30 );

			SetSkill( SkillName.EvalInt, 120.1, 130.0 );
			SetSkill( SkillName.Magery, 120.1, 130.0 );
			SetSkill( SkillName.Meditation, 100.1, 101.0 );
			SetSkill( SkillName.Poisoning, 100.1, 101.0 );
			SetSkill( SkillName.MagicResist, 175.2, 200.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.Wrestling, 75.1, 100.0 );

			Fame = 23000;
			Karma = -23000;

			VirtualArmor = 60;

			PackNecroReg( 150, 200 );
		}
Add PackItem( youritem) and you have the same options as I showed above for AddItem available for packitem.

@DHMagicMan
Glad to be of help, that's why I try to be as detailed as possible. :)
 

UOT

Knight
Was hoping you'd be able to figure that one out yourself. InitOutfit() is a method of basevendor so you can override it if you based your mobile from basevendor but since it isn't you have 2 options. 1) Call InitOutfit() in you class constructor and get rid of the keyword override or 2) just get rid of InitOutfit all together and move the code that was in there to the class constructor.
 

UOT

Knight
I'll give you 30 minutes to play with it to see if you can figure it out. If you can't by then I'll show you. I don't want to show you right away because then I wouldn't really be helping you I'd be doing it for you ;)
P.S. Show me what you tried and what the errors you get as proof you're trying something :)
 

Murzin

Knight
here is an example from one of my scripts

Code:
			Katana weapon = new Katana();
			EliteWyrmguardChest chest = new EliteWyrmguardChest();
			EliteWyrmguardLegs legs = new EliteWyrmguardLegs();
			EliteWyrmguardArms arms = new EliteWyrmguardArms();
			EliteWyrmguardGloves gloves = new EliteWyrmguardGloves();
			EliteWyrmguardHelm helm = new EliteWyrmguardHelm();
			EliteWyrmguardShield shield = new EliteWyrmguardShield();

			weapon.Skill = SkillName.Wrestling;
			weapon.Hue = 263;
			weapon.Movable = false;
			chest.Hue = 263;
			legs.Hue = 263;
			arms.Hue = 263;
			gloves.Hue = 263;
			helm.Hue = 263;
			shield.Hue = 263;

			AddItem( weapon );
			AddItem( chest );
			AddItem( legs );
			AddItem( arms );
			AddItem( gloves );
			AddItem( helm );
			AddItem( shield );

for this bit of code you did it wrong.

Code:
		public override void InitOutfit()
		{
			Item shroud = new HoodedShroudOfShadow();
			shroud.Hue = 2654;
			shroud.LootType = LootType.Blessed;
			AddItem( shroud );
		}

what you need to do is copy the lines inside the method and paste them around the packitem necro regs and remove your reference to the method.

so instead of having this:

Code:
		[Constructable]
		public Vampire() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = Vampire;
			Body = 400;
			BaseSoundID = 0x482;
			Hue = 0x4001;

			SetStr( 145, 234 );
			SetDex( 96, 115 );
			SetInt( 545, 876 );

			SetHits( 560, 595 );

			SetDamage( 15, 27 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Cold, 40 );
			SetDamageType( ResistanceType.Energy, 40 );

			SetResistance( ResistanceType.Physical, 55, 65 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 50, 60 );
			SetResistance( ResistanceType.Poison, 50, 60 );
			SetResistance( ResistanceType.Energy, 25, 30 );

			SetSkill( SkillName.EvalInt, 120.1, 130.0 );
			SetSkill( SkillName.Magery, 120.1, 130.0 );
			SetSkill( SkillName.Meditation, 100.1, 101.0 );
			SetSkill( SkillName.Poisoning, 100.1, 101.0 );
			SetSkill( SkillName.MagicResist, 175.2, 200.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.Wrestling, 75.1, 100.0 );

			Fame = 23000;
			Karma = -23000;

			VirtualArmor = 60;

			PackNecroReg( 150, 200 );
		}

you should have:

Code:
		[Constructable]
		public Vampire() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = Vampire;
			Body = 400;
			BaseSoundID = 0x482;
			Hue = 0x4001;

			SetStr( 145, 234 );
			SetDex( 96, 115 );
			SetInt( 545, 876 );

			SetHits( 560, 595 );

			SetDamage( 15, 27 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Cold, 40 );
			SetDamageType( ResistanceType.Energy, 40 );

			SetResistance( ResistanceType.Physical, 55, 65 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 50, 60 );
			SetResistance( ResistanceType.Poison, 50, 60 );
			SetResistance( ResistanceType.Energy, 25, 30 );

			SetSkill( SkillName.EvalInt, 120.1, 130.0 );
			SetSkill( SkillName.Magery, 120.1, 130.0 );
			SetSkill( SkillName.Meditation, 100.1, 101.0 );
			SetSkill( SkillName.Poisoning, 100.1, 101.0 );
			SetSkill( SkillName.MagicResist, 175.2, 200.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.Wrestling, 75.1, 100.0 );

			Fame = 23000;
			Karma = -23000;

			VirtualArmor = 60;

			PackNecroReg( 150, 200 );

			Item shroud = new HoodedShroudOfShadow();
			shroud.Hue = 2654;
			shroud.LootType = LootType.Blessed;
			AddItem( shroud );
		}

and delete the initoutfit method as its invalid.
 

Whooper7777

Wanderer
hmm again

ok i have done now this:
Code:
using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "an vampire's corpse" )]
	public class Vampire : BaseCreature
	{
		[Constructable]
		public Vampire() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = Vampire;
			Body = 400;
			BaseSoundID = 0x482;
			Hue = 0x4001;

			SetStr( 145, 234 );
			SetDex( 96, 115 );
			SetInt( 545, 876 );

			SetHits( 560, 595 );

			SetDamage( 15, 27 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Cold, 40 );
			SetDamageType( ResistanceType.Energy, 40 );

			SetResistance( ResistanceType.Physical, 55, 65 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 50, 60 );
			SetResistance( ResistanceType.Poison, 50, 60 );
			SetResistance( ResistanceType.Energy, 25, 30 );

			SetSkill( SkillName.EvalInt, 120.1, 130.0 );
			SetSkill( SkillName.Magery, 120.1, 130.0 );
			SetSkill( SkillName.Meditation, 100.1, 101.0 );
			SetSkill( SkillName.Poisoning, 100.1, 101.0 );
			SetSkill( SkillName.MagicResist, 175.2, 200.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.Wrestling, 75.1, 100.0 );

			Fame = 23000;
			Karma = -23000;

			VirtualArmor = 60;

			PackNecroReg( 150, 200 );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.FilthyRich, 3 );
			AddLoot( LootPack.MedScrolls, 2 );
		}

		public override void InitOutfit()
		{
			Item shroud = new HoodedShroudOfShadow();
			shroud.Hue = 2654;
			shroud.LootType = LootType.Blessed;
			AddItem( shroud );
		}

		public override bool Unprovokable{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override int TreasureMapLevel{ get{ return 5; } }

		public Vampire( Serial serial ) : base( serial )
		{
		}
    
		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();
		}
	}
}
here i added this:
Code:
		public override void InitOutfit()
		{
			Item shroud = new HoodedShroudOfShadow();
			shroud.Hue = 2654;
			shroud.LootType = LootType.Blessed;
			AddItem( shroud );
		}
and i have set that monster body to 400 wich is male bodyvalue now im getting only 1 error and its this:
Code:
Scripts: Compiling C# scripts...failed (1 errors, 1 warnings)
 - Warning: Scripts\Customs\Muut\autoBankStone.cs: CS0105: (line 5, column 7) Th
e using directive for 'Server.Items' appeared previously in this namespace
 - Error: Scripts\Mobiles\Monsters\Humanoid\Magic\Vampire.cs: CS0115: (line 58,
column 24) 'Server.Mobiles.Vampire.InitOutfit()': no suitable method found to ov
erride
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
so im out... this is my first script what i tried to do!
 

UOT

Knight
OK again 2 ways of doing this 1) copy what Murzin posted and DELETE the whole InitOutfit method 2)
Code:
		[Constructable]
		public Vampire() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = Vampire;
			Body = 400;
			BaseSoundID = 0x482;
			Hue = 0x4001;

			SetStr( 145, 234 );
			SetDex( 96, 115 );
			SetInt( 545, 876 );

			SetHits( 560, 595 );

			SetDamage( 15, 27 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Cold, 40 );
			SetDamageType( ResistanceType.Energy, 40 );

			SetResistance( ResistanceType.Physical, 55, 65 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 50, 60 );
			SetResistance( ResistanceType.Poison, 50, 60 );
			SetResistance( ResistanceType.Energy, 25, 30 );

			SetSkill( SkillName.EvalInt, 120.1, 130.0 );
			SetSkill( SkillName.Magery, 120.1, 130.0 );
			SetSkill( SkillName.Meditation, 100.1, 101.0 );
			SetSkill( SkillName.Poisoning, 100.1, 101.0 );
			SetSkill( SkillName.MagicResist, 175.2, 200.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.Wrestling, 75.1, 100.0 );

			Fame = 23000;
			Karma = -23000;

			VirtualArmor = 60;

			PackNecroReg( 150, 200 );
			InitOutfit();
		}
		public void InitOutfit() // Notice I took out the override keyword
		{
			Item shroud = new HoodedShroudOfShadow();
			shroud.Hue = 2654;
			shroud.LootType = LootType.Blessed;
			AddItem( shroud );
		}
 

Whooper7777

Wanderer
here it is

ok here is error:
Code:
 - Error: Scripts\Mobiles\Monsters\Humanoid\Magic\Vampire.cs: CS0118: (line 13,
column 11) 'Server.Mobiles.Vampire' denotes a 'class' where a 'variable' was exp
ected
and here is code:
Code:
using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "an vampire's corpse" )]
	public class Vampire : BaseCreature
	{
		[Constructable]
		public Vampire() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = Vampire;
			Body = 400;
			BaseSoundID = 0x482;
			Hue = 0x4001;

			SetStr( 145, 234 );
			SetDex( 96, 115 );
			SetInt( 545, 876 );

			SetHits( 560, 595 );

			SetDamage( 15, 27 );

			SetDamageType( ResistanceType.Physical, 20 );
			SetDamageType( ResistanceType.Cold, 40 );
			SetDamageType( ResistanceType.Energy, 40 );

			SetResistance( ResistanceType.Physical, 55, 65 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 50, 60 );
			SetResistance( ResistanceType.Poison, 50, 60 );
			SetResistance( ResistanceType.Energy, 25, 30 );

			SetSkill( SkillName.EvalInt, 120.1, 130.0 );
			SetSkill( SkillName.Magery, 120.1, 130.0 );
			SetSkill( SkillName.Meditation, 100.1, 101.0 );
			SetSkill( SkillName.Poisoning, 100.1, 101.0 );
			SetSkill( SkillName.MagicResist, 175.2, 200.0 );
			SetSkill( SkillName.Tactics, 90.1, 100.0 );
			SetSkill( SkillName.Wrestling, 75.1, 100.0 );

			Fame = 23000;
			Karma = -23000;

			VirtualArmor = 60;

			PackNecroReg( 150, 200 );
			InitOutfit();
		}
		public void InitOutfit() // Notice I took out the override keyword
		{
			Item shroud = new HoodedShroudOfShadows();
			shroud.Hue = 2654;
			shroud.LootType = LootType.Blessed;
			AddItem( shroud );
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.FilthyRich, 3 );
			AddLoot( LootPack.MedScrolls, 2 );
		}

		public override bool Unprovokable{ get{ return true; } }
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
		public override int TreasureMapLevel{ get{ return 5; } }

		public Vampire( Serial serial ) : base( serial )
		{
		}
    
		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();
		}
	}
}
 

daat99

Moderator
Staff member
Code:
Name = Vampire;
The name is a string, strings should be contained inside "".
Make it look like this:
Code:
Name = "Vampire";
 
Top