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!

[RunUO 2.0 RC1] Economy Control System

Lokai;683333 said:
I know this post is a little old, but this was never addressed, and I found this script, and checked, and you are correct. It does affect Gems and Scrolls. In LootPack.cs we find this line:

PHP:
    if ( item.Stackable )
     item.Amount = m_Quantity.Roll();

Since Gems and Scrolls are stackable, when 1 gem or 1 scroll is dropped, the 90% is applied to it, and rounded down, causing it to result in a quantity of zero.

The fix would be to change the return value to return the Math.Ceiling result of the calculation, rather than the (int) "explicit cast" of the calculation.

I just came across this thread while contemplating how best to adjust gold drops on monsters. This script may not be a full economy solution but it certainly is a quick bandage fix if some farming is getting out of control.

And yes - this script does prohibit selling any Gems and Scrolls. That is a problem (not so much the gems but Scribes should be able to sell their wares.

Lokai's suggestion of "change the return value to return the Math.Ceiling result of the calculation, rather than the (int) "explicit cast" of the calculation" is beyond my coding abilities. The alternative for me looks like manually adjusting individual monster drops.

Has anyone solved this on their version of this script?
 

Lokai

Knight
After reflection, the easiest way to fix is to change the line I quoted as follows:

PHP:
if (item.Stackable)
item.Amount = Math.Max(1, m_Quantity.Roll());

This will return 1 if the amount of the roll is zero.

PigPen-divinity;848192 said:
I just came across this thread while contemplating how best to adjust gold drops on monsters. This script may not be a full economy solution but it certainly is a quick bandage fix if some farming is getting out of control.

And yes - this script does prohibit selling any Gems and Scrolls. That is a problem (not so much the gems but Scribes should be able to sell their wares.

Lokai's suggestion of "change the return value to return the Math.Ceiling result of the calculation, rather than the (int) "explicit cast" of the calculation" is beyond my coding abilities. The alternative for me looks like manually adjusting individual monster drops.

Has anyone solved this on their version of this script?
 
Lokai;848218 said:
After reflection, the easiest way to fix is to change the line I quoted as follows:

PHP:
if (item.Stackable)
item.Amount = Math.Max(1, m_Quantity.Roll());

This will return 1 if the amount of the roll is zero.


Thx Lokai that is an elegant little fix that works like a charm. Now people can not only control how gold drops affect their economy they can also toggle this to control how stackable drops affect it as well.

*bows*
 

hellalex

Sorceror
Code:
Errors:
 + New Custom Scripts/Distro Edits/Loots/LootPack.cs:
    CS0161: Line 986: 'Server.LootPackDice.Roll()': not all code paths return a
value

This is what I get

and this is my lootpack.cs

Code:
//Economy Control Edit
        public int Roll()
		{
			int v = m_Bonus;
			double eco_Modifier = 100;
			double w;

			for ( int i = 0; i < m_Count; ++i )
				v += Utility.Random( 1, m_Sides );
	              	foreach (Item item in World.Items.Values)
                                      {
				
                                      	if (item is StoneGoldCounter)
                                 	{
             	             	StoneGoldCounter GC = (StoneGoldCounter)item;
            	              	             eco_Modifier = GC.EconomyMultiplier;
                                       }

			w = v * (eco_Modifier * .01);
			return (int)w;
        
		}
        }
 

Lokai

Knight
I think this should work:

Code:
        //Economy Control Edit
        public int Roll()
        {
            int v = m_Bonus;
            double eco_Modifier = 100;
            double w;
 
            for ( int i = 0; i < m_Count; ++i )
                v += Utility.Random( 1, m_Sides );
            foreach (Item item in World.Items.Values)
            {
                if (item is StoneGoldCounter)
                {
                    StoneGoldCounter GC = (StoneGoldCounter)item;
                    eco_Modifier = GC.EconomyMultiplier;
                }
            }
            w = v * (eco_Modifier * .01);
            return (int)w;
        }
 

merlyn2000

Sorceror
wow ... i cant belive that this lil bit of code, that i worked on years ago, is still in the pipeline. in doing college work right now, but when i get time, i would like to revive this, and another project that i worked on, an npc invasion system.

good luck guys hope you get this worked out the way you want it.
 

Djeryv

Sorceror
I just wanted to say that this is a cool idea and I have it on my new shard now. I changed the script so it will do 10% cash on creation so I can decorate the world with it and it is set to go. I also took your lump of code for the lootpack change and incorporated into other things like Treasure Map Chest, my Dungeon Chests, and NPC's gold (as they are killable)...so the entire gold dropping system is controlled by this single stone. Thanks!
 

Joker01

Squire
Code:
Errors:
+ Misc/LootPack.cs:
    CS0176: Line 933: Static member 'Server.Items.StoneGoldCounter.EconomyMultip
lier' cannot be accessed with an instance reference; qualify it with a type name
instead

Hi Guys, to fix this error go Lootpack.cs and change Roll-Func to this:

Code:
        public int Roll()
        {
            int v = m_Bonus;
            int eco_Modifier = 100;
            double w;
 
            for ( int i = 0; i < m_Count; ++i )
                v += Utility.Random( 1, m_Sides );
           
           
            //i love amy
            foreach (Item item in World.Items.Values)
            {
               
                if (item is StoneGoldCounter)
                {
                    StoneGoldCounter GC = item as StoneGoldCounter;
                    eco_Modifier = GC.Eco_Multiplier;
                };
               
            }
 
            w = v * (eco_Modifier * .01);
            return (int)w;
        }
 

nadious

Sorceror
I would like to add that I installed this on my ForkUO server and it works FANTASTIC. This script is great for helping control monster drops and farming.

Now, my question is... since this is so simple and easy to use... how difficult would it be to implement a stone like this that would control the buying and selling of vendor items? In SBVendor files, you have the prices for buying and selling of items. Could something like this be made to tap into the values and adjust the buying and selling on the fly? Or, is the SB system different from the way the lootpack works?
 

nadious

Sorceror
I'd just like to add that I shared this idea and thread over at CraftUO.com, asking the same question, to see if anyone might have some additional insight into it. Kalamus came up with a few changes / scripts for a test and I tried it out and it works very well. You can find it at: http://craftuo.com/index.php?threads/wondering-if-this-is-possible.37/#post-164

I just wanted to share if someone else was looking for a solution to adjust vendor buying / selling in an easy method (and on the fly.)
 

wakerild

Wanderer
ok so im new to making a shard and got your program to have no errors but cant seem to find how to get the stuff ingame?
 

wolfinden

Traveler
is it posible to have this script count other things then just gold? EG: a specific weapon or armor and potentially stop that item from spawning? say if you wanted to reduce Regs or arties?
 
Top