Go Back   RunUO - Ultima Online Emulation > RunUO > New Join Forum

New Join Forum So your new to RunUO and looking to work with people that are new, this is the place.

Reply
 
Thread Tools Display Modes
Old 03-10-2005, 01:53 PM   #1 (permalink)
Forum Novice
 
Macil's Avatar
 
Join Date: Oct 2003
Location: Harper Woods, Michigan
Age: 21
Posts: 815
Send a message via ICQ to Macil Send a message via AIM to Macil
Default Destroy on death...

I'm trying to script my own ranger warrior thingy. Which will spawn a random peice of ranger armor upon death. But while you fight it, it wears a full set of ranger armor. How do I make it so what he's wearing disappears when you kill it (the ranger armor), so that only one peice of random ranger armor is left on the corpse after it's dead. Instead of the full suit. - hope that makes sense.
Macil is offline   Reply With Quote
Old 03-10-2005, 01:59 PM   #2 (permalink)
Master of the Internet
 
Quantos's Avatar
 
Join Date: Apr 2003
Location: Edmonton, AB
Age: 41
Posts: 6,867
Send a message via ICQ to Quantos Send a message via AIM to Quantos Send a message via MSN to Quantos Send a message via Yahoo to Quantos
Default

Post the script, using the [code] tags, and any errors that it generates.

Make sure to highlight what you have tried to do to get the armor to not drop.
__________________
Paranoia is what happens when you finally have all of the facts.
Quantos is offline   Reply With Quote
Old 03-10-2005, 02:14 PM   #3 (permalink)
Forum Novice
 
Macil's Avatar
 
Join Date: Oct 2003
Location: Harper Woods, Michigan
Age: 21
Posts: 815
Send a message via ICQ to Macil Send a message via AIM to Macil
Default

Well, I modified the Brigand script so it worked for my ranger guy instead. Everything works like I want it to, I get no errors. My question though is how do I make the armor that the monster is wearing disappears after he dies, so that you only get one random peice of ranger armor instead of the full set off the corpse. Here is the script.

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

namespace Server.Mobiles
{
	public class ForestRanger : BaseCreature
	{
		public override bool ClickTitle{ get{ return false; } }

		[Constructable]
		public ForestRanger() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			SpeechHue = Utility.RandomDyedHue();
			Title = "Forest Ranger";
			Hue = Utility.RandomSkinHue();

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

			SetStr( 86, 100 );
			SetDex( 81, 95 );
			SetInt( 61, 75 );

			SetDamage( 10, 23 );

			SetSkill( SkillName.Archery, 85.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, 75.0, 90.5 );
			SetSkill( SkillName.Wrestling, 15.0, 37.5 );

			Fame = 1000;
			Karma = -1000;

			AddItem( new Boots( Utility.RandomNeutralHue() ) );
			AddItem( new RangerArms());
			AddItem( new RangerChest());
			AddItem( new RangerGloves());
			AddItem( new RangerGorget());
			AddItem( new RangerLegs());

			switch ( Utility.Random( 2 ))
			{
				case 0: AddItem( new CompositeBow() ); break;
				case 1: AddItem( new Bow() ); break;
			}

			AddItem( Server.Items.Hair.GetRandomHair( Female ) );
		}

		public override void GenerateLoot()
		{
			PackGold( 150, 225 );
		}

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

		public ForestRanger( 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();
		}
	}
}
Macil is offline   Reply With Quote
Old 03-10-2005, 02:24 PM   #4 (permalink)
Forum Expert
 
Join Date: Feb 2005
Age: 24
Posts: 985
Send a message via AIM to Nochte
Default

make random pieces newbie'd.
Nochte is offline   Reply With Quote
Old 03-10-2005, 02:51 PM   #5 (permalink)
Forum Novice
 
Macil's Avatar
 
Join Date: Oct 2003
Location: Harper Woods, Michigan
Age: 21
Posts: 815
Send a message via ICQ to Macil Send a message via AIM to Macil
Default

I'm not experienced enough to write code on my own, so I take from other scripts and add modify scripts. So, after some searching I found a newbie loot thingy on a dummy sword dude.

I applied the code to my script using ranger armor instead of normal leather in the dummysword script. And it worked fine for the arms, but when I applied the code to all the peices of armor, I get these errors on start up.

RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (4 errors, 0 warnings)
- Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0128: (line
54, column 16) A local variable named 'glv' is already defined in this scope
- Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0128: (line
57, column 17) A local variable named 'glv' is already defined in this scope
- Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0128: (line
60, column 17) A local variable named 'glv' is already defined in this scope
- Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0128: (line
63, column 15) A local variable named 'glv' is already defined in this scope
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

This is the section of script I believe it is referring to.

Code:

			AddItem( new Boots( Utility.RandomNeutralHue() ) );
			RangerArms glv = new RangerArms();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			RangerChest glv = new RangerChest();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			RangerGloves glv = new RangerGloves();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			RangerGorget glv = new RangerGorget();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			RangerLegs glv = new RangerLegs();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
Macil is offline   Reply With Quote
Old 03-10-2005, 02:57 PM   #6 (permalink)
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default

Code:
RangerArms glv = new RangerArms(); <--------- declared here
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			RangerChest glv = new RangerChest(); <---- and here
you cant declare the same variable more than once within the same scope, where "declaring" means assigning a type to a variable with the specified name.
You want something like this instead

Code:
RangerArms glv = new RangerArms();  <------ declare once
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			glv = new RangerChest();  <-- then just reassign after that
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. "

For questions, information, and support for XmlSpawner and its addons, visit the
XmlSpawner Support Forum
ArteGordon is offline   Reply With Quote
Old 03-10-2005, 03:02 PM   #7 (permalink)
Forum Novice
 
Macil's Avatar
 
Join Date: Oct 2003
Location: Harper Woods, Michigan
Age: 21
Posts: 815
Send a message via ICQ to Macil Send a message via AIM to Macil
Default

Code:
			RangerArms glv = new RangerArms();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			glv = new RangerChest();
			glv = new RangerGloves();
			glv = new RangerGorget();
			glv = new RangerLegs();
Like that? I get a few errors from that.

RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (4 errors, 0 warnings)
- Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0029: (line
55, column 10) Cannot implicitly convert type 'Server.Items.RangerChest' to 'Se
rver.Items.RangerArms'
- Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0029: (line
56, column 10) Cannot implicitly convert type 'Server.Items.RangerGloves' to 'S
erver.Items.RangerArms'
- Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0029: (line
57, column 10) Cannot implicitly convert type 'Server.Items.RangerGorget' to 'S
erver.Items.RangerArms'
- Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0029: (line
58, column 10) Cannot implicitly convert type 'Server.Items.RangerLegs' to 'Ser
ver.Items.RangerArms'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
Macil is offline   Reply With Quote
Old 03-10-2005, 03:12 PM   #8 (permalink)
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default

your other items are not of the RangerArms type. Since you arent accessing any properties or methods that are specific to the RangerArms type, and your RangerArms and all of the other things you are adding are derived from the Item class, just declare the glv variable as an Item and then it can be used to refer to all of your other items as well.

Code:
Item glv = new RangerArms();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. "

For questions, information, and support for XmlSpawner and its addons, visit the
XmlSpawner Support Forum
ArteGordon is offline   Reply With Quote
Old 03-10-2005, 03:18 PM   #9 (permalink)
Forum Novice
 
Macil's Avatar
 
Join Date: Oct 2003
Location: Harper Woods, Michigan
Age: 21
Posts: 815
Send a message via ICQ to Macil Send a message via AIM to Macil
Default

I'm not sure I understand, where/how do I include the rest of the peices, what would it look like?
Macil is offline   Reply With Quote
Old 03-10-2005, 03:22 PM   #10 (permalink)
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default

Code:
AddItem( new Boots( Utility.RandomNeutralHue() ) );
			Item glv = new RangerArms();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			glv = new RangerChest();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			glv = new RangerGloves();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			glv = new RangerGorget();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			glv = new RangerLegs();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
you could also just declare a new variable for each piece and give them all different names, like

Code:
AddItem( new Boots( Utility.RandomNeutralHue() ) );
			RangerArms glv = new RangerArms();
			glv.LootType = LootType.Newbied;
			AddItem(glv);
			RangerChest glchest = new RangerChest();
			glchest.LootType = LootType.Newbied;
			AddItem(glchest);

			etc.
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. "

For questions, information, and support for XmlSpawner and its addons, visit the
XmlSpawner Support Forum
ArteGordon is offline   Reply With Quote
Old 03-10-2005, 03:24 PM   #11 (permalink)
Forum Novice
 
Macil's Avatar
 
Join Date: Oct 2003
Location: Harper Woods, Michigan
Age: 21
Posts: 815
Send a message via ICQ to Macil Send a message via AIM to Macil
Default

I tried the second code you put down already and got some errors. Let me try the first one.
Macil is offline   Reply With Quote
Old 03-10-2005, 03:26 PM   #12 (permalink)
Forum Novice
 
Macil's Avatar
 
Join Date: Oct 2003
Location: Harper Woods, Michigan
Age: 21
Posts: 815
Send a message via ICQ to Macil Send a message via AIM to Macil
Default

Ahhh, that worked. I think I see what I did wrong too, and what you were trying to tell me. With puting item instead of ranger arms, right? Er, I think.
Macil is offline   Reply With Quote
Old 03-10-2005, 03:29 PM   #13 (permalink)
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default

yep
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. "

For questions, information, and support for XmlSpawner and its addons, visit the
XmlSpawner Support Forum
ArteGordon is offline   Reply With Quote
Old 03-10-2005, 03:35 PM   #14 (permalink)
Forum Novice
 
Macil's Avatar
 
Join Date: Oct 2003
Location: Harper Woods, Michigan
Age: 21
Posts: 815
Send a message via ICQ to Macil Send a message via AIM to Macil
Default

Well, thanks a ton Arte. Have a good one. I shall be enjoying my script. =)
Macil is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5