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, 03:55 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 utility.random

Okay, I ran into one more problem with my Forest Ranger script. Thankfully, this is the last. And I don't think it's a hard one.

I used a code for my efreets that my friend wrote for me that made it so a random peice of daemon bone armor would spawn on a random efreet, one in every 13 or something. Now I'm quite sure the script works. I'm just unsure of where I should put it. My guess right now is that I can't have the switch (utility.random) thing, if it already exists for something else. Anywho, here are the errors and 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() ) );
			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);

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

			switch ( Utility.Random( 10 ) )
			{
				case 0: switch ( Utility.Random( 5 ))
				        {
						case 0: PackItem( new RangerArms() ); break;
						case 1: PackItem( new RangerChest() ); break;
						case 2: PackItem( new RangerGloves() ); break;
						case 3: PackItem( new RangerLegs() ); break;
						case 4: PackItem( new RangerGorget() ); break;
					} 
					break;
				case 1: break;
				case 2: break;
				case 3: break;
				case 4: break;
				case 5: break;
				case 6: break;
				case 7: break;
				case 8: break;
				case 9: 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();
		}
	}
}


And the errors...

RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS1513: (line
96, column 4) } expected
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, 04:05 PM   #2 (permalink)
Forum Expert
 
Join Date: Aug 2004
Location: Redmond, WA
Age: 21
Posts: 1,288
Send a message via AIM to Sep102 Send a message via MSN to Sep102
Default

You're missing an ending bracket '}' after the final case statement to end this switch block
Code:
switch ( Utility.Random( 2 ))
{
	case 0: AddItem( new CompositeBow() ); break;
	case 1: AddItem( new Bow() ); break;
Sep102 is offline   Reply With Quote
Old 03-10-2005, 04:13 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

By George, you're right. Always the little mistakes that I get caught on.
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