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!

Loot question

Loot question

I used Nerun's spawner to spawn mobs on my server but I noticed that none of the mobs drop anything but gold. Is this because of the spawn system I used or is that the way OSI wanted it to be ? I have read the posts on changing this..and I'm still trying but it's a bit daunting to think I have to change each mob individually. To be quite honest the script lootpacks.cs is a bit confusing.

I went into the Daemon.cs to see what I could change there..I just need some clarification.


public override void GenerateLoot()
{
AddLoot( LootPack.FilthyRich,1 );
AddLoot( LootPack.Average,2 );
AddLoot( LootPack.MedScrolls, 2 );
}


I changed the second line to filthy rich and the loot on the daemon did not change. Is there something else I need to accomplish here ?

thanks for your help in advance.
 
ok, I actually figured this out on my own. yay me ! Was wondering. If I want several different items to drop on one mob but at random times do I add new lootpack lines for each item and keep the same frequency number( I guess that's what it's called) like 1 or 2 ?
 
those are not freq numbers, but number of "packs" being dropped

to have it random need it to be either in a "switch" (so just 1 in the switch list comes out) or something like
if (Utility.Random(5) == 0) AddLoot( LootPack.FilthyRich,1 );
where 5 is the 1 in "chance" number - i.e. it has a 1 in 5 chance (20%)
higher numbers are rarer and lower numbers a more freq
 
Can someone help me with this error ? I've read so many posts and changed so many things I have no clue what's happening here.

Thanks :)



 

LuxoR

Sorceror
Essentially, you need to convert a generic list to an ArrayList object. It might be easier to keep using the generic list in all places. Your LootPack.cs seems to have been modified, please post it, or the relevant code around line 75 for more help.
 
Sorry, I should have inlcuded the line in question. I can't remember where I saw this. I'm attempting to increase loot on all mobs as they have nothing but gold on them right now.

Thanks in advance.

 

daat99

Moderator
Staff member
Do we need to guess which line is line 75?

When you post code please do NOT use pictures.

Please use [code] tags and copy/paste the code between them.

If you want to add code tags wither click on the # symbol in the post editing tool bar or write:

[code]
code goes here
[/code]

It'll look like this:
Code:
code goes here

**You need the square brackets.
 
pardon my offense, I'm fairly new to all this. Here is the code with line 75 in red.





Code:
{
			if ( !Core.AOS )
				return 0;

			int luck = from.Luck;

			if ( luck > m_LuckTable.Length )
				luck = m_LuckTable.Length;

			--luck;

			if ( luck < 0 )
				return 0;

			return m_LuckTable[luck];
		}

		public static int GetLuckChanceForKiller( Mobile dead )
		{
			[COLOR="Red"]ArrayList list = BaseCreature.GetLootingRights( dead.DamageEntries, dead.HitsMax );[/COLOR]
			DamageStore highest = null;

			for ( int i = 0; i < list.Count; ++i )
			{
				DamageStore ds = (DamageStore)list[i];

				if ( ds.m_HasRight && (highest == null || ds.m_Damage > highest.m_Damage) )
					highest = ds;
			}
 
that is because you are tying to use a general list for it
replace
ArrayList list = BaseCreature.GetLootingRights( dead.DamageEntries, dead.HitsMax );
with:
List<DamageStore> list = BaseCreature.GetLootingRights( dead.DamageEntries, dead.HitsMax );

and see if that works (that is taken from basecreature and how it gets the list)
 

LuxoR

Sorceror
Now you know how to get help quickly for next time. :D

I suspect your LootPack.cs is old, or modified by someone who hasn't heard of generics. Check out the LootPack.cs on the SVN.

You'll notice the following:
Code:
 List<DamageStore> list = BaseCreature.GetLootingRights( dead.DamageEntries, dead.HitsMax );
 
I changed the lootpack and got a new error. Again, I appreciate any help you can give.


Code:
RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 4 processors
Scripts: Compiling C# scripts...failed (1 errors, 1 warnings)
Errors:
 + Misc/LootPack.cs:
    CS0246: Line 75: The type or namespace name 'List' could not be found (are y
ou missing a using directive or an assembly reference?)
    CS0021: Line 81: Cannot apply indexing with [] to an expression of type 'Lis
t<Server.Mobiles.DamageStore>'
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

here is the code as I have it now, including line 81

Code:
public static int GetLuckChance( Mobile from )
		{
			if ( !Core.AOS )
				return 0;

			int luck = from.Luck;

			if ( luck > m_LuckTable.Length )
				luck = m_LuckTable.Length;

			--luck;

			if ( luck < 0 )
				return 0;

			return m_LuckTable[luck];
		}

		public static int GetLuckChanceForKiller( Mobile dead )
		{
			 [COLOR="red"]List<DamageStore> list = BaseCreature.GetLootingRights( dead.DamageEntries, dead.HitsMax );[/COLOR]
			DamageStore highest = null;

			for ( int i = 0; i < list.Count; ++i )
			{
				[COLOR="red"]DamageStore ds = (DamageStore)list[i];[/COLOR]

				if ( ds.m_HasRight && (highest == null || ds.m_Damage > highest.m_Damage) )
					highest = ds;
			}
 

LuxoR

Sorceror
For the first error, you need to add the following:

Code:
using System.Collections.Generic;

The second highlighted statement should be:
Code:
DamageStore ds = list[i];

I'm not sure if the second part was part of any errors, but let's see.
 
The second error is gone..I'm assuming the first error lingers because I have placed the items you suggested in the wrong spot on line 75.



Code:
RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 4 processors
Scripts: Compiling C# scripts...failed (1 errors, 1 warnings)

Errors:
 + Misc/LootPack.cs:
    CS1002: Line 75: ; expected
    CS1525: Line 75: Invalid expression term '<'
    CS1002: Line 75: ; expected
    CS1003: Line 75: Syntax error, '(' expected
    CS1525: Line 75: Invalid expression term '='
    CS1026: Line 75: ) expected
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.



Code:
public static int GetLuckChance( Mobile from )
		{
			if ( !Core.AOS )
				return 0;

			int luck = from.Luck;

			if ( luck > m_LuckTable.Length )
				luck = m_LuckTable.Length;

			--luck;

			if ( luck < 0 )
				return 0;

			return m_LuckTable[luck];
		}

		public static int GetLuckChanceForKiller( Mobile dead )
		{           
			[COLOR="red"] List<DamageStore> list <using System.Collections.Generic> = BaseCreature.GetLootingRights( dead.DamageEntries, dead.HitsMax );[/COLOR]
			DamageStore highest = null;

			for ( int i = 0; i < list.Count; ++i )
			{
				DamageStore ds = list[i];
 

LuxoR

Sorceror
I think you misunderstood where I wanted you to add the using statement. Add it to the top of the file along with other references, and the line should be as follows.

Code:
List<DamageStore> list = BaseCreature.GetLootingRights( dead.DamageEntries, dead.HitsMax );
 
Yes, I saw that after I posted. I am error free thanks to you :) The mobs still have no loot though...so do I now need to go back into the lootpack.cs and tweek a few numbers ? They are all carrying only gold.
 

LuxoR

Sorceror
I don't recall if loot is generated when they die, or when they are spawned. You may have to trying killing one.
 
that is semi corrrect
gold from loot is is made when spawned, unless the false part is added to the loot setup
the rest is spawned upon death
 
Top