ServUO Version
Publish Unknown
Ultima Expansion
Renaissance
Is this possible in RunUO 2.3, I know my preferred server system is dated, for my veteran coders, is it possible at all?

I would like to take lets say a dragon and add to it to drop a DragonEgg every 100 dragons

many other mobs as well, can I AVOID editing lootpack and get away with a line of text in each mob i need a specific loot on?
 
Yes, add a static field to handle counting the dragons that are killed using the OnDeath method and if (count / 100 = 0 remainder) than drop egg to corpse!

This of course was just a high level description of what I would do to achieve this in RunUO
 
Yes, add a static field to handle counting the dragons that are killed using the OnDeath method and if (count / 100 = 0 remainder) than drop egg to corpse!

This of course was just a high level description of what I would do to achieve this in RunUO
Can you give me the text to input? I will change the item that is dropped
Im not a scripter sorry, I do what I can
 
The following chage to the mob's OnDeath method will give a 1 in 100 chance of dropping an item.

Code:
        public override void OnDeath( Container c )
        {
            base.OnDeath( c );        

            switch ( Utility.Random( 100 ) )
            {        
                case 0: c.DropItem( new Item() );break;    
            }

        }
 
You'd put this in your Dragon.cs : This would drop a DragonEgg (Assuming it has no prams) on every 100 Dragons killed!

Example:
private static int TotalDeaths = 0;

public override void OnDeath(Container c)
{
    TotalDeaths++;
   
    if (TotalDeaths % 100 == 0)
    {
        c.DropItem(new DragonEgg());
    }
   
    base.OnDeath(c);
}

You would need to save the Death Count, though that might be beyond your skill atm!
 
You'd put this in your Dragon.cs : This would drop a DragonEgg (Assuming it has no prams) on every 100 Dragons killed!

Example:
private static int TotalDeaths = 0;

public override void OnDeath(Container c)
{
    TotalDeaths++;
  
    if (TotalDeaths % 100 == 0)
    {
        c.DropItem(new DragonEgg());
    }
  
    base.OnDeath(c);
}

You would need to save the Death Count, though that might be beyond your skill atm!
so its more to it than just dropping that text above into place? what do you mean by need to save the death count?
thanks for your help and patience with my lack of understanding
 
The code I provide does all the functional part and can be placed in as is, the additional info on saving the Death count is for handling the field when you restart the server as it'll reset to zero if not saved and loaded! Voxpire has a good post in tutorials iirc on doing just that, saving and loading custom stuff, it would be a good task to complete to get a feel for scripting!
Grabbed the link : https://www.servuo.com/archive/sandboxed-system-serialization.1924/
 
The code I provide does all the functional part and can be placed in as is, the additional info on saving the Death count is for handling the field when you restart the server as it'll reset to zero if not saved and loaded! Voxpire has a good post in tutorials iirc on doing just that, saving and loading custom stuff, it would be a good task to complete to get a feel for scripting!
Grabbed the link : https://www.servuo.com/archive/sandboxed-system-serialization.1924/
I love this thank you!
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back