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!

Custom Necromancer AI

Final Realms

Wanderer
Custom Necromancer AI

Summary:
Customised Necromancer AI V1.0

Used for necromantic npcs. This Ai enables you to create Necromancer npcs, that cast necromancer spells while in combat. A good complement to any customised shard.

To use this script you must have the following items scripted in your shard:

Necromancer bag of reagents ( or if not available, necromancer reagents must be part of the npc's loot ).

Full necromancer spellbook ( how to add this, is included on smaple npc code ).

Works on RunUO 1.0 RC0

For support email me at: [email protected]
Or post on this thread.

Description:

Customised Necromancer AI V1.0

Used parts of the standard RunUO MageAI.cs

Used for necromantic npcs. This Ai enables you to create Necromancer npcs, that cast necromancer spells while in combat. A good complement to any customised shard.

To use this script you must have the following items scripted in your shard:

Necromancer bag of reagents ( or if not available, necromancer reagents must be part of the npc's loot ).

Full necromancer spellbook.

Components needed:

These items below are needed, as just like the players, a npc must have the necessary components to use a skill:

Full Necromancer Spellbook ( how to add this is included on sampl npc code ).

Necromancer bag of reagents, comes with the RunUO 1.0 RC0 release.

Necromancer Npcs, will need the following skills for best usage of AI:

Necromancy, Spirit Speak, Poisoning & Meditation skills.

Features:

- Npcs will cast Necromancer spells when attacking.
- Npcs use Spirit Speak as a healing method.
- Npcs usage of high end spells such as Wither & Vengeful Spirit
- Npcs usage of spell combos
- Npcs will teleport to target as Mage Npcs would
- Improved healing performance but based solely on Spirit Speak.

Support:

Script supported only on RunUO 1.0 RC0 version.

For support email me at: [email protected]
Or post on this thread.

Thanks:

My thanks for the collaboration and help for developing this customised AI go to:

Darklon, and Admin Maeve from Maeve's Garden.

SkyMonkey, Sidsid & GoldDraco13 from RunUo Forums for the Sample npc, and the Full Necromancer Spellbook Generation Code.

Enjoy.

Installation Instructions:

To install proceed as follows:

On the file BaseAI.cs:

Under line 26, insert the following:

AI_Necro

Under line 250, insert the following:

SkillName.Necromancy


On BaseCreature.cs:

Under line 1616, insert the following:

/////////////////NECROAI//////////////
case AIType.AI_Necro:
m_AI = new NecroAI(this);
break;
/////////////////NECROAI//////////////


Final steps:

After this is done, put the NecroAi.cs file into your folder:

Scripts/Engines/AI/AI

Start your server after installing, normally.


More info on use:

To use on npcs, declare the AI normally like for any other AI:

public NpcName() : base( AIType.AI_Necro, FightMode.Closest, 10, 1, 0.2, 0.4 )

Update to downloads( 05/20/2004 ):

Released Single pack with all files & one bonus NPC.

Pack inludes:

Pre-modified BaseAI & BaseCreature scripts for a easier installation.

Sample Npc, demonstrating useage of AI, how to include necro reagents, and how to include in loot a full necromancer spellbook (Sample Necromancer, by SkyMonkey ).

Revised versions of the base lich npc, that now use the Necromancer AI ( Revised Lich Npcs, by GoldDraco13 ).

Bonus Custom NPC - Boss type toughness - Grim Reaper.

Installation directories:

To use these files you must not have previously edited them to add anything, as they will overwrite completely you old ones. They contain only the modification for the use of this AI script, and have been tested on a base, clean installation of RunUO 1.0 RC0.

These files should be extracted to:

Scripts/Engines/AI/AI - for BaseAI.cs

and

Scripts/Engines/AI/Creatures - for BaseCreature.cs

The NPC files should be extracted to:

Scripts/Custom/Npc - for SampleNecromancer.cs

Scripts/Custom/Npc - for GrimReaper.cs

and for GoldDraco13's updated lich pack:

Scripts/Mobiles/Monsters/Humanoid/Magic - for the AncientLich.cs, Lich.cs and LichLord.cs

After these files are installed, follow the remainder of instructions to call upon the AI, as explained above, or read through the code of the official sample npc.

For more advanced examples, download GoldDraco13's update to the base distribution lich npc files, also included in the distribution files.

For advanced npc sample also see the bonus custom npc included, named GrimReaper.cs

File includes installation instructions as posted here.

For the matching AI script, the Custom Necromage AI script, you can go here:
Custom Necromage AI v1.0 Beta - RunUO 1.0 RC0

For the newest AI I have released, the paladin AI, go here:
Custom Paladin AI v1.0 Beta - RunUO 1.0 RC0
 

Attachments

  • NecroAI.zip
    44.7 KB · Views: 947

sidsid

Sorceror
why didnt i think of this. just made a couple of evil necro's
great fun to see em using the necro spells. thanks for saving me the trouble
:D :cool:
 

Final Realms

Wanderer
Thnxs

Your both very welcome. Hope your players enjoy it :)

Paladin AI is what Im working on right now,should submit it pretty soon.
 

Final Realms

Wanderer
Reply to email question

Yes you are very right.. I should have posted the features. Its now posted, hope this clarifies all this AI does a bit better to you. :) :cool:
 

Droven

Wanderer
Hmm I got errors, when I tried it. First I've got that error :

Code:
Scripts: Compiling C# scripts...failed (19 errors, 0 warnings)
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1513: (line 60, column 33) } exp
ected
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1520: (line 67, column 4) Class,
 struct, or interface method must have a return type
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1031: (line 67, column 14) Type
expected
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1520: (line 67, column 18) Class
, struct, or interface method must have a return type
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1031: (line 67, column 26) Type
expected
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1520: (line 68, column 4) Class,
 struct, or interface method must have a return type
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1031: (line 68, column 14) Type
expected
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1519: (line 68, column 37) Inval
id token ')' in class, struct, or interface member declaration
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1520: (line 69, column 4) Class,
 struct, or interface method must have a return type
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1031: (line 69, column 16) Type
expected
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1513: (line 26, column 11) } expect
ed
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS0116: (line 27, column 3) A namespa
ce does not directly contain members such as fields or methods
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1513: (line 250, column 25) } expec
ted
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1002: (line 250, column 25) ; expec
ted
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1519: (line 252, column 4) Invalid
token '}' in class, struct, or interface member declaration
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1518: (line 254, column 18) Expecte
d class, delegate, enum, interface, or struct
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1518: (line 305, column 34) Expecte
d class, delegate, enum, interface, or struct
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1518: (line 306, column 41) Expecte
d class, delegate, enum, interface, or struct
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1022: (line 330, column 7) Type or
namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

and Baal.cs :

using System;
using System.Collections;
using Server.Items;
using Server.Targeting;

namespace Server.Mobiles
{
[CorpseName( "a ba'al corpse" )]
public class Baal : BaseCreature
{
[Constructable]
public Baal () : base( AIType.AI_Necro, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Name = "Ba'al";
Title = "the Necromancer"
Body = 102;
Hue = 0x83EC;

SetStr( 150, 200 );
SetDex( 100, 150 );
SetInt( 800, 850 );

SetHits( 500 );

SetDamage( 15, 25 );

SetDamageType( ResistanceType.Physical, 40 );
SetDamageType( ResistanceType.Fire, 60 );

SetResistance( ResistanceType.Physical, 30, 45 );
SetResistance( ResistanceType.Fire, 60, 70 );
SetResistance( ResistanceType.Cold, 45, 60 );
SetResistance( ResistanceType.Poison, 45, 70 );
SetResistance( ResistanceType.Energy, 50, 60 );

SetSkill( SkillName.EvalInt, 50.0, 75.0 );
SetSkill( SkillName.Magery, 50.0 );
SetSkill( SkillName.MagicResist, 100.0, 120.0 );
SetSkill( SkillName.Tactics, 100.0 );
SetSkill( SkillName.Wrestling, 50.0, 115.0 );
SetSkill( SkillName.Anatomy, 80.1, 100.1 );
SetSkill( SkillName.Meditation, 300.0 );
SetSkill( SkillName.Necromancy, 150.0, 200.0 );


Fame = 50000;
Karma = -50000;

VirtualArmor = 40;
Female = true;

LongSword Weapon = new LongSword()

weapon.Skill = SkillName.Necromancy
weapon.hue = 1153
weapon.Movable = false;

AddItem( weapon );

new FireSteed().Rider = this;

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

PackItem( new Tokens( 10000, 12000 ) );
PackItem( new BagOfNecroReagents ) );
PackWeapon( 2, 5 );

public override bool Uncalmable{ get{ return true; } }
public override bool Unprovokable{ get{ return true; } }
public override Poison HitPoison{ get{ return Poison.Lesser; } }
public override bool CanRummageCorpses{ get{ return true; } }

public Baal( 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();
}
}
}

Why I'am having that error help me..
 

Final Realms

Wanderer
Droven said:
Hmm I got errors, when I tried it. First I've got that error :

Code:
Scripts: Compiling C# scripts...failed (19 errors, 0 warnings)
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1513: (line 60, column 33) } exp
ected
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1520: (line 67, column 4) Class,
 struct, or interface method must have a return type
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1031: (line 67, column 14) Type
expected
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1520: (line 67, column 18) Class
, struct, or interface method must have a return type
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1031: (line 67, column 26) Type
expected
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1520: (line 68, column 4) Class,
 struct, or interface method must have a return type
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1031: (line 68, column 14) Type
expected
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1519: (line 68, column 37) Inval
id token ')' in class, struct, or interface member declaration
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1520: (line 69, column 4) Class,
 struct, or interface method must have a return type
 - Error: Scripts\Custom\MyCreatures\Baal.cs: CS1031: (line 69, column 16) Type
expected
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1513: (line 26, column 11) } expect
ed
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS0116: (line 27, column 3) A namespa
ce does not directly contain members such as fields or methods
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1513: (line 250, column 25) } expec
ted
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1002: (line 250, column 25) ; expec
ted
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1519: (line 252, column 4) Invalid
token '}' in class, struct, or interface member declaration
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1518: (line 254, column 18) Expecte
d class, delegate, enum, interface, or struct
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1518: (line 305, column 34) Expecte
d class, delegate, enum, interface, or struct
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1518: (line 306, column 41) Expecte
d class, delegate, enum, interface, or struct
 - Error: Scripts\Engines\AI\AI\BaseAI.cs: CS1022: (line 330, column 7) Type or
namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

and Baal.cs :



Why I'am having that error help me..

The errors you report here, arent related to the script itself.

You have 2 errors here, one belongs to your NPC script and is caused directly by it ( I tested it on my test server where I develop my scripts and I get the same lines reporting error that you show here for your NPC in the error log, but no errors related to the AI engines ).

The second error is a installation mistake.

Under line 26 of the file you must include the code I wrote. It should look like this in your file:

Code:
		AI_Thief,
		AI_Necro
	}

The error about lines 26 & 27 says you are missing the "}" as show in this code I just typed.

The error on lines 250 and forward is because u are missing again a "}" and a ";".

Your file after modifying to my instructions should look like this:

Code:
				SkillName.Meditation,
				SkillName.Necromancy
			};

In case you have altered either the BaseAI.cs or included other custom AI, I would need to see your BaseAI.cs file to see whats colliding with my script.

Right now though, the only thing wrong is a bad installation, and a bugged npc script. You are missing a "(" in one of the lines, etc...

If you want, and have not touched the BaseAI.cs file or the BaseCreature.cs files that come with the RunUO 1.0 RC0 base distro installation, I have uploaded the edited versions that go along with my script, for a easier installation of this AI, in the main post of the script.

Install these in their proper folders, and allow them to overwrite your existing ones.

These scripts should be extracted from the zip file into your:

Scripts/Engines/AI/AI - for BaseAI.cs file

and

Scripts/Engines/AI/Creature - for BaseCreature.cs file

A warning about the following procedure of overwritting original distribution files:

Before overwritting or deleting your old files you must make sure you have backup copies of your original files.

Do not use these files I just uploaded if your RunUO Server is not RunUO 1.0 RC0, or if you have these files customised with other AI scripts or changes.

Use these only if you have not changed the base distribution ones.
 

Droven

Wanderer
I hadn't change them that they are the same as the Runuo 1.0 installition, I'll try it again, then post what will happen..
 
H

hudel

Guest
The Server starts fine by me. I have not testet the AI itself by a script, but I think it will work. Thanks for sharing.
Hmm,... could you maybe post one EvilNecro so that I can see how you handle the Necroregs? I have no NecroBag.
 

Final Realms

Wanderer
hudel said:
The Server starts fine by me. I have not testet the AI itself by a script, but I think it will work. Thanks for sharing.
Hmm,... could you maybe post one EvilNecro so that I can see how you handle the Necroregs? I have no NecroBag.

The useage on a npc is simple:

First set the skills needed to use necromancy, they are the same a player needs to work on to be a GM necromancer.

The Skills, as per OSI standard are:

  • Necromancy
  • Spirit Speak
  • Poisoning

The code would look like this:

Code:
// 100.0 is GM level tweak the number to more or less skill
// depending on how hard u want the npc to be.

SetSkill( SkillName.SpiritSpeak, 100.0 ); 
SetSkill( SkillName.Necromancy, 100.0 );
SetSkill( SkillName.Poisoning, 100.0 );

Now add the necromancer reagents:

The code would look like so:

Code:
PackNecroReg( 50, 100 );// Creates 10 to 20 of each necro reagent.

The rest of the npc code is exactly like any plain npc you can make.

Remember that you need a full necromancer spellbook as well for best results. I will not post the book's script as it is not mine, I didnt make the full spellbook script, and obviously it isnt right to post other people's work without their consent.
 
S

SkyMonkey

Guest
I have one problem with you not posting the 'full spellbook script'.

I cant find it! :p

Could you atleast post a LINK to the thread it's in?
 

sidsid

Sorceror
SkyMonkey said:
I have one problem with you not posting the 'full spellbook script'.

I cant find it! :p

Could you atleast post a LINK to the thread it's in?

its not in one. just create a new script with an item based on the necromancerspellbook class and set this.content=ulong.maxvalue;
 
G

GoldDraco13

Guest
SkyMonkey said:
I have one problem with you not posting the 'full spellbook script'.

I cant find it! :p

Could you atleast post a LINK to the thread it's in?


Don't need to make s script for a Full necro spell book:

Just add this to the necro creature script:

PackItem( new NecromancerSpellbook( (UInt64)0xFFFF ) );


Hope this helps :)
 
S

SkyMonkey

Guest
GoldDraco13 said:
Don't need to make s script for a Full necro spell book:

Just add this to the necro creature script:

PackItem( new NecromancerSpellbook( (UInt64)0xFFFF ) );


Hope this helps :)

Sure did!


Code:
using System; 
using System.Collections; 
using Server.Items; 
using Server.ContextMenus; 
using Server.Misc; 
using Server.Network; 

namespace Server.Mobiles 
{ 
	public class Necromancer : BaseCreature 
	{ 
		[Constructable] 
		public Necromancer() : base( AIType.AI_Necro, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{ 
			SpeechHue = Utility.RandomDyedHue(); 
			Title = "the Necromancer"; 
			Hue = 0x3C6; 

			if ( this.Female = Utility.RandomBool() ) 
			{ 
				this.Body = 0x191; 
				this.Name = NameList.RandomName( "female" ); 
				AddItem( new Skirt( Utility.RandomRedHue() ) ); 
			} 
			else 
			{ 
				this.Body = 0x190; 
				this.Name = NameList.RandomName( "male" ); 
				AddItem( new ShortPants( Utility.RandomRedHue() ) ); 
			} 

			SetStr( 386, 400 );
			SetDex( 151, 165 );
			SetInt( 161, 175 );

			SetDamage( 8, 10 );

			SetDamageType( ResistanceType.Physical, 100 );

			SetResistance( ResistanceType.Physical, 35, 45 );
			SetResistance( ResistanceType.Fire, 25, 30 );
			SetResistance( ResistanceType.Cold, 25, 30 );
			SetResistance( ResistanceType.Poison, 10, 20 );
			SetResistance( ResistanceType.Energy, 10, 20 );

			SetSkill( SkillName.SpiritSpeak, 100.0 ); 
			SetSkill( SkillName.Necromancy, 100.0 );
			SetSkill( SkillName.Poisoning, 100.0 );
			SetSkill( SkillName.MagicResist, 80.0, 100.0 );


			Fame = 5000;
			Karma = -5000;

			VirtualArmor = 40;

			AddItem( new Shoes( 0x151 ) );
			AddItem( new Robe( 0x455 ) );
			AddItem( new FancyShirt( 0x455 ) );
			PackNecroReg( 50, 100 );// Creates 10 to 20 of each necro reagent.
			AddItem( new NecromancerSpellbook( (UInt64)0xFFFF ) );

			Item hair = new Item( Utility.RandomList( 0x203B, 0x2049, 0x2048, 0x204A ) );
			hair.Hue = Utility.RandomNondyedHue();
			hair.Layer = Layer.Hair;
			hair.Movable = false;
			AddItem( hair );

		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.FilthyRich );
			AddLoot( LootPack.Meager );
		}

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

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

		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(); 
		} 
	} 
}


Just a note:

Spellbooks are nubed on my shard so this bad boy doesn't drop a full necrobook every time it dies. Best to adjust accordingly (or alteast be aware that a player is going to get a FULL Necro book every time he/she kills one of these!)
 

Final Realms

Wanderer
Kudos to SidSid, SkyMonkey & GoldDraco :)

Thnxs for posting this NPC, and extra bit of info on the Necrospellbook, it makes things a lot easier for other people to use my script thanks to your supperb imput.

If you guys dont mind Id like to package all that with the Necro AI download.

Once again Kudos to u guys and thnxs :)
 
H

hudel

Guest
Thanks for sharing the NPC-Script and the info abaout the Spellbook :D
 

Final Realms

Wanderer
Updated downloads on main post, to include Skymonkey's Necromancer as the Sample Necromancer for this script.

This Npc illustrates use of the script on NPC, showing both skill use, how to add the necromancer reagents & how to create the full necromancer spellbook.

Thanks again to SkyMonkey, Sidsid & GoldDraco13.
 
G

GoldDraco13

Guest
You and anyone in this community are allowed to copy/paste/change/edit or use my scripts at will :)



P.S. I took the liberty to change the distro lich/lich lord and ancient lich lord scripts to necro AI as they should have been in the first place(OSI Bad) =]
 

Attachments

  • New Lich's Update.zip
    3 KB · Views: 55
Top