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!

Power Scrolls in random loot Question.

MIKTHEBUG

Sorceror
I was woundering if this might solve my ranodm power scroll loot problem, im not at home right now and wont be for some days so i cant test this right now.

But if someone knows something about this, and ideas would be great.

Code:
        public override void GenerateLoot()
        {
            AddLoot( LootPack.FilthyRich, 3 );
            AddLoot( LootPack.Gems, 5 );
            if ( 0.03 > Utility.RandomDouble() )
            PackItem( new TunicOfFire() );
            if ( 0.10 > Utility.RandomDouble() )
            PackItem( new PowerScroll(SkillName.SetValues( 0, m_PossibleSkillName[Utility.Random(m_PossibleSkillName.Length], (Utility.Random( 4 ) == 0 ? 120.0 : 115.0 : 110.0 : 105.0) );
        }

        private static SkillName[] m_PossibleSkillName = new SkillName[]
            {
                SkillName.Archery,
                SkillName.Magery,
                SkillName.Healing
            };
 

MIKTHEBUG

Sorceror
I tested my script now and got some errors.
i dont know if i scripted it bad or if its just the wonrg way of doing it.
any advice would be great!
Thank you beforhand.

Code:
Errors:
+ Mobiles/Monsters/Reptile/Magic/AncientWyrm.cs:
    CS1026: Line 59: ")" förväntas
    CS1026: Line 59: ")" förväntas
    CS1525: Line 59: Ogiltig uttrycksterm: :
    CS1002: Line 59: ";" förväntas
    CS1002: Line 59: ";" förväntas
    CS1525: Line 59: Ogiltig uttrycksterm: :
    CS1002: Line 59: ";" förväntas
    CS1002: Line 59: ";" förväntas
    CS1525: Line 59: Ogiltig uttrycksterm: )
    CS1002: Line 59: ";" förväntas
    CS1525: Line 59: Ogiltig uttrycksterm: )
 

Murzin

Knight
and the errors in english are ?

but one thing i did see is you did not count correctly

PackItem( new PowerScroll(SkillName.SetValues( 0, m_PossibleSkillName[Utility.Random(m_PossibleSkillName.Length], (Utility.Random( 4 ) == 0 ? 120.0 : 115.0 : 110.0 : 105.0) );

count the # of opening and closing parenthesis and brackets

you dont have a close for every open
 

michelle78

Sorceror
Not sure what version of runuo you are using but this method works on 2.0. Just comment out the ones you dont want to drop as loot and make sure you have the case # in sequence with the ones that are not commented out. You can also adjust the chances of the level of scroll near the top. Hope this helps.

Code:
public override void GenerateLoot()
        {
            AddLoot( LootPack.FilthyRich, 2 );

 
            if ( Utility.Random( 100 ) < 98 )
            {

                int level;

                double random = Utility.RandomDouble();

                if ( 0.30 >= random )
                level = 120;

                else if ( 0.40 >= random )
                    level = 115;

                else
                level = 110;

                switch ( Utility.Random( 24 ))
                {
                    case 0: AddToBackpack( new PowerScroll( SkillName.Swords, level ) ); break;
                    case 1: AddToBackpack( new PowerScroll( SkillName.Fencing, level ) ); break;
                    case 2: AddToBackpack( new PowerScroll( SkillName.Archery, level ) ); break;
                    case 3: AddToBackpack( new PowerScroll( SkillName.Parry, level ) ); break;
                    case 4: AddToBackpack( new PowerScroll( SkillName.Tactics, level ) ); break;
                    case 5: AddToBackpack( new PowerScroll( SkillName.Anatomy, level ) ); break;
                    case 6: AddToBackpack( new PowerScroll( SkillName.Healing, level ) ); break;
                    case 7: AddToBackpack( new PowerScroll( SkillName.Magery, level ) ); break;
                    case 8: AddToBackpack( new PowerScroll( SkillName.Meditation, level ) ); break;
                    case 9: AddToBackpack( new PowerScroll( SkillName.EvalInt, level ) ); break;
                    case 10: AddToBackpack( new PowerScroll( SkillName.MagicResist, level ) ); break;
                    //case 11: AddToBackpack( new PowerScroll( SkillName.AnimalTaming, level ) ); break;
                    //case 12: AddToBackpack( new PowerScroll( SkillName.AnimalLore, level ) ); break;
                    //case 13: AddToBackpack( new PowerScroll( SkillName.Veterinary, level ) ); break;
                    case 11: AddToBackpack( new PowerScroll( SkillName.Musicianship, level ) ); break;
                    case 12: AddToBackpack( new PowerScroll( SkillName.Provocation, level ) ); break;
                    case 13: AddToBackpack( new PowerScroll( SkillName.Discordance, level ) ); break;
                    case 14: AddToBackpack( new PowerScroll( SkillName.Peacemaking, level ) ); break;
                    case 15: AddToBackpack( new PowerScroll( SkillName.Chivalry, level ) ); break;
                    case 16: AddToBackpack( new PowerScroll( SkillName.Focus, level ) ); break;
                    case 17: AddToBackpack( new PowerScroll( SkillName.Necromancy, level ) ); break;
                    case 18: AddToBackpack( new PowerScroll( SkillName.Stealing, level ) ); break;
                    case 19: AddToBackpack( new PowerScroll( SkillName.Stealth, level ) ); break;
                    case 20: AddToBackpack( new PowerScroll( SkillName.Macing, level ) ); break;
                    case 21: AddToBackpack( new PowerScroll( SkillName.Wrestling, level ) ); break;
                    //case 25: AddToBackpack( new PowerScroll( SkillName.Blacksmith, level ) ); break;
                    //case 26: AddToBackpack( new PowerScroll( SkillName.Tailoring, level ) ); break;
                    //case 27: AddToBackpack( new PowerScroll( SkillName.Tinkering, level ) ); break;
                    //case 28: AddToBackpack( new PowerScroll( SkillName.Mining, level ) ); break;
                    //case 29: AddToBackpack( new PowerScroll( SkillName.Carpentry, level ) ); break;
                    //case 30: AddToBackpack( new PowerScroll( SkillName.Alchemy, level ) ); break;
                    //case 31: AddToBackpack( new PowerScroll( SkillName.Fletching, level ) ); break;
                    //case 32: AddToBackpack( new PowerScroll( SkillName.Inscribe, level ) ); break;
                    //case 33: AddToBackpack( new PowerScroll( SkillName.Cooking, level ) ); break;
                    //case 34: AddToBackpack( new PowerScroll( SkillName.Cartography, level ) ); break;
                    //case 35: AddToBackpack( new PowerScroll( SkillName.Lumberjacking, level ) ); break;
                    case 22: AddToBackpack( new PowerScroll( SkillName.Lockpicking, level ) ); break;
                    case 23: AddToBackpack( new PowerScroll( SkillName.Fishing, level ) ); break;
                }
            }

}
 

MIKTHEBUG

Sorceror
well i managed to get it to this.
and as you asked befor Murzin the errors in egnlis hare:
CS1026: Line 59: ")" expected
CS1003: Line 59: Syntaxerror: : expected

Code:
Errors:
+ Mobiles/Monsters/Reptile/Magic/AncientWyrm.cs:
    CS1026: Line 59: ")" förväntas
    CS1003: Line 59: Syntaxfel: : förväntas

Code:
PackItem( new PowerScroll(SkillName.SetValues( 0, m_PossibleSkillName[Utility.Random(m_PossibleSkillName.Length], (Utility.Random( 4 ) == 0 ? 120.0 , 115.0 , 110.0 , 105.0) ) );

Michelle78 that looks like a good way of doing it, i will give it a try later, thanks alot :)
im using Runuo 2.1 btw.
 

MIKTHEBUG

Sorceror
michelle78: that worked like a charm thanks alot :D
although if i would like to alter so they dont always drop a 110 scroll how would i do that?
i did try just to do like the once above else if ( 0.20 >= random )
level = 110;
and that error would be like:
local variable not assigned or something.

and why is there always 2?

Code:
Errors:
 + Mobiles/Monsters/Humanoid/Magic/Balron.cs:
    CS0165: Line 74: En lokal variabel som inte har tilldelats används: level
 + Mobiles/Monsters/Reptile/Magic/AncientWyrm.cs:
    CS0165: Line 76: En lokal variabel som inte har tilldelats används: level
 

michelle78

Sorceror
Hmm, I havent tried changing it not to drop 110s but I am thinking you need to change the following

Code:
                if ( 0.30 >= random )
                level = 120;

                else if ( 0.40 >= random )
                    level = 115;

                else
                level = 110;
to
Code:
                               if ( 0.50 >= random )
                level = 120;

                else
                level = 115;
This works, just adjust 0.50 higher or lower depending on how often you want you want 120s popping up. If you want some 110s but not often you can play with the randoms, keeping the total under 1.00
 

Murzin

Knight
mik, you didnt do what i said. count the ( ) [ ]

i know they dont add up.

Code:
 if ( 0.50 >= random )
           level = 120;
 else
           level = 115;

is the right way, no blank lines. this is one of those cases where blank lines or "white space" can hurt and cause problems.
 

MIKTHEBUG

Sorceror
michelle78: once again thank you for your very nice piece of code :)

Murzin: it is as you said they dident add up, but once i changed that i got some other errors and since whe script michelle78 showed works just fine ill go with that for the time beeing. Thanks alot for your advice :)
 

michelle78

Sorceror
Anytime, glad I could help
.
 

Evanonian

Sorceror
Anytime, glad I could help
.

Dear michelle78,

I just stumbled across this post and I must say it's helped me a lot with what I'm trying to achieve in this new dungeon I'm creating. However I was wondering if you could possibly explain to me what those chances are because they seem to be dropping pretty often and when they do drop, I get two of them. I was also curious if you could make them appear in the players backpack?

In advanced, thanks.
 
Top