Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 12-04-2008, 04:53 PM   #1 (permalink)
Forum Novice
 
Join Date: Mar 2007
Age: 21
Posts: 266
Default ConsumeType.Half / Felluca resource banks.

hello again.

i got two questions again.

First:

In CraftItem, there is a possibility to use consumeType.Half or All.

where exectly do i have to make this check?

PlayerMobile plm = (PlayerMobile) from;
if( plm.HalfResourcesRequired == true )
consumetype = ConsumeType.Half
else
ConsumeType consumeType = ( UseAllRes ? ConsumeType.Half : ConsumeType.All );

I tried this:

Code:
			}
			else if ( !allRequiredSkills )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, 1044153 ) );
				else
					from.SendLocalizedMessage( 1044153 ); // You don't have the required skills to attempt this item.
			}
			else
			{
				PlayerMobile plm = (PlayerMobile)from;
				if( plm.HalfResourcesRequired == true )
					consumeType = ConsumeType.Half;
				else
					ConsumeType consumeType = ( UseAllRes ? ConsumeType.Half : ConsumeType.All );

				int resHue = 0;
				int maxAmount = 0;

				object message = null;
but throws me this error:

Code:
RunUO - [www.runuo.com] Version 2.0, Build 2959.20979
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
 + Engines/Craft/Core/CraftItem.cs:
    CS1023: Line 1176: Embedded statement cannot be a declaration or labeled sta
tement
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.


And


in HarvestSystem, i found this:

Code:
				if ( type != null )
				{
					Item item = Construct( type, from );

					if ( item == null )
					{
						type = null;
					}
					else
					{
						//The whole harvest system is kludgy and I'm sure this is just adding to it.
						if ( item.Stackable )
						{
							int amount = def.ConsumedPerHarvest;
							int feluccaAmount = def.ConsumedPerFeluccaHarvest;

							int racialAmount = (int)Math.Ceiling( amount * 1.1 );
							int feluccaRacialAmount = (int)Math.Ceiling( feluccaAmount * 1.1 );

							bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human );
							bool inFelucca = (map == Map.Felucca);

							if( eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount )
								item.Amount = feluccaRacialAmount;
							else if( inFelucca && bank.Current >= feluccaAmount )
								item.Amount = feluccaAmount;
							else if( eligableForRacialBonus && bank.Current >= racialAmount )
								item.Amount = racialAmount;
							else
								item.Amount = amount;
						}

						bank.Consume( item.Amount, from );

						if ( Give( from, item, def.PlaceAtFeetIfFull ) )
						{
							SendSuccessTo( from, item, resource );
						}
						else
						{
							SendPackFullTo( from, item, def, resource );
							item.Delete();
						}

						BonusHarvestResource bonus = def.GetBonusResource();

						if ( bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill )
						{
							Item bonusItem = Construct( bonus.Type, from );

							if ( Give( from, bonusItem, true ) )	//Bonuses always allow placing at feet, even if pack is full irregrdless of def
							{
								bonus.SendSuccessTo( from );
							}
							else
							{
								item.Delete();
							}
						}
Tho, where exactly do i have to make the check that if from.TripleResources == true, it triples the gained item, tho, does not affect the harvest bank?


thanks in advance

Last edited by DarkViper2006; 12-04-2008 at 04:56 PM.
DarkViper2006 is offline   Reply With Quote
Old 12-04-2008, 05:28 PM   #2 (permalink)
Forum Master
 
Lord_Greywolf's Avatar
 
Join Date: Dec 2005
Posts: 9,640
Send a message via Yahoo to Lord_Greywolf
Default

1st one is easy - you are redifinging it again - remove the 1st part of this statement (in red)

ConsumeType consumeType


2nd one
felucca consume amounts are defined in the individual harvest scripts (search for felucca in mining, etc)
but they take the extra out of the vein
felucca bonuses is not more ore, but faster extraction - i.e. you get 2-3 or what ever out at a time instead of 1, but the vein still only holds 20 or what ever, so you drain the vein faster

you could make it so fel only removes 1 at a time in the harvest core by setting it to only remove from the bank the same amount as non fel - but that gives a very big unbalanced advantage to mining on fel then
__________________
http://www.AoAUO.com

:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :)
Lord_Greywolf is offline   Reply With Quote
Old 12-04-2008, 11:56 PM   #3 (permalink)
Forum Novice
 
Join Date: Mar 2007
Age: 21
Posts: 266
Default

Quote:
Originally Posted by Lord_Greywolf View Post
1st one is easy - you are redifinging it again - remove the 1st part of this statement (in red)

ConsumeType consumeType


2nd one
felucca consume amounts are defined in the individual harvest scripts (search for felucca in mining, etc)
but they take the extra out of the vein
felucca bonuses is not more ore, but faster extraction - i.e. you get 2-3 or what ever out at a time instead of 1, but the vein still only holds 20 or what ever, so you drain the vein faster

you could make it so fel only removes 1 at a time in the harvest core by setting it to only remove from the bank the same amount as non fel - but that gives a very big unbalanced advantage to mining on fel then
Well, i only use the Felucca map, removed trammel ( custom ruleset tho )

And want to set felucca to trammel like mining( just 1 ).
But i have a customskill, that will triple the harvested amount for a minute.

But that skill coding is messing with me mind.


And for the ConsumeType. i when i remove it it sends the error: consumeType is missing.... are you missing a file error.

and when i change it to this i get :

Code:
			else if ( !allRequiredSkills )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, 1044153 ) );
				else
					from.SendLocalizedMessage( 1044153 ); // You don't have the required skills to attempt this item.
			}
			else
			{
				PlayerMobile plm = (PlayerMobile)from;
				if( plm.HalfResourcesRequired == true )
					ConsumeType consumeType = ConsumeType.Half;				else
					ConsumeType consumeType = ( UseAllRes ? ConsumeType.Half : ConsumeType.All );

				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				// Not enough resource to craft it
				if ( !ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true ) )
				{
					if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
						from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
					else if ( message is int && (int)message > 0 )
						from.SendLocalizedMessage( (int)message );
					else if ( message is string )
						from.SendMessage( (string)message );

					return;
				}
Code:
RunUO - [www.runuo.com] Version 2.0, Build 2959.20979
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
 + Engines/Craft/Core/CraftItem.cs:
    CS1023: Line 1174: Embedded statement cannot be a declaration or labeled sta
tement
    CS1023: Line 1176: Embedded statement cannot be a declaration or labeled sta
tement
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
Red lines are the error lines.

Last edited by DarkViper2006; 12-05-2008 at 12:03 AM.
DarkViper2006 is offline   Reply With Quote
Old 12-05-2008, 12:23 AM   #4 (permalink)
Forum Novice
 
Cheetah2003's Avatar
 
Join Date: Jun 2006
Location: Laramie, Wyoming
Age: 37
Posts: 364
Send a message via ICQ to Cheetah2003 Send a message via AIM to Cheetah2003 Send a message via MSN to Cheetah2003 Send a message via Yahoo to Cheetah2003
Default

Change it to this, you need to declare the variable before using it in the fashion you're using it.

Code:
			else if ( !allRequiredSkills )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, 1044153 ) );
				else
					from.SendLocalizedMessage( 1044153 ); // You don't have the required skills to attempt this item.
			}
			else
			{
				ConsumeType consumeType;
				PlayerMobile plm = (PlayerMobile)from;
				if( plm.HalfResourcesRequired == true )
					consumeType = ConsumeType.Half;
				else
					consumeType = ( UseAllRes ? ConsumeType.Half : ConsumeType.All );

				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				// Not enough resource to craft it
__________________
Take a walk on The Wild side.
Cheetah2003 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 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5