Discussion in   Coding Corner   started     11 years ago   July 16, 2013, 11:29:10 AM   by   Keldon

Random Slayer?

Keldon
Offline
223 Posts
Topic :   Random Slayer?
11 years ago  July 16, 2013, 11:29:10 AM

I was thinking about this when I went to bed this morning.  You mentioned having different boxes drop from my mob with various quality weapons.  I got to thinking about it and came up with something.  Best I can tell this would be a level-able double axe with a random super slayer that starts with 30% on HP and Mana leech.  Does this work or can I not use a switch for determining weapon properties?

Kyn
Offline
336 Posts
#1 Re :   Random Slayer?
11 years ago  July 16, 2013, 12:07:21 PM

I was thinking about this when I went to bed this morning.  You mentioned having different boxes drop from my mob with various quality weapons.  I got to thinking about it and came up with something.  Best I can tell this would be a level-able double axe with a random super slayer that starts with 30% on HP and Mana leech.  Does this work or can I not use a switch for determining weapon properties?


You can definitely use a switch for weapon attributes and properties. You can even randomize it further by using min/max for numbered properties such as weapon damage, LRC, LMC and various other attributes.


Code: [Select]
Utility.RandomMinMax(1,100)

Keldon
Offline
223 Posts
#2 Re :   Random Slayer?
11 years ago  July 16, 2013, 02:46:01 PM

Yes I was thinking of giving them ranges by instead of using a hard = 30 instead using a = ( 25, 35 ).


Is the section for making it exceptional correct?  Would that make it a weapon that would level up?  If so it gives an added level of customization to the weapons for each player.

Kyn
Offline
336 Posts
#3 Re :   Random Slayer?
11 years ago  July 16, 2013, 03:03:25 PM

Yes I was thinking of giving them ranges by instead of using a hard = 30 instead using a = ( 25, 35 ).


Is the section for making it exceptional correct?  Would that make it a weapon that would level up?  If so it gives an added level of customization to the weapons for each player.


Evolution has a custom item leveling tag that needs to be added to each item we want to make levelable, exceptional items crafted by players are automatically given this tag.


Off the top of my head I think that
Code: [Select]
ArmorQuality.Exceptional



Is the attribute. I could be mistaken. Our levelable tag is simple


Code: [Select]
islevelable = true;

Keldon
Offline
223 Posts
#4 Re :   Random Slayer?
11 years ago  July 16, 2013, 03:31:36 PM

Ok, Thank you Kyn!


I have an idea for how all of this so going to work and I think for the weapons and boxes I have a good solid basis to go on now.  When I start working on the mob again I am sure I will have more questions.


Actually one question before I go switch within a switch?  Basically, have the script select a slayer group then randomly pick a slayer in that sub group.  Would cut down on the number of scripts needed for weapons while giving a truly diverse weapon basis.


Basically something like this for example.



switch (Utility.Random(2))
{
    case 0:switch (Utility.Random(2))
        {
        case 0: from.SendMessage ( "Yes"); break;
        case 1: from.SendMessage ( "No"); break;
        }
    case 1:switch (Utility.Random(2))
       {
       case 0: from.SendMessage ( "Maybe"); break;
       case 1: from.SendMessage ( "Maybe Not" ); break;
       }
}

Kyn
Offline
336 Posts
#5 Re :   Random Slayer?
11 years ago  July 16, 2013, 09:17:20 PM

To my knowledge you cannot use a switch utility/construct inside of itself. However you can use if and else statements within a switch to further define criteria/variables :)


Code: [Select]

 case 1:
                if(blah blah blah = blah blah)
                from.SendMessage ( "Maybe" );
                   
                else
                if(blah = blah)
                    return blah  blah;


Sorry for the sloppy code, just woke up. hope that helps. :)

Keldon
Offline
223 Posts
#6 Re :   Random Slayer?
11 years ago  July 16, 2013, 09:40:51 PM

hehe, Thanks.  I will play around with it some and see what comes out.

Keldon
Offline
223 Posts
#7 Re :   Random Slayer?
11 years ago  July 16, 2013, 11:46:58 PM

The islevelable = true; is erroring out on my compiler.  I am guessing there is a script outside of the normal runuo scripts I need for it to recognize that command.

Kyn
Offline
336 Posts
#8 Re :   Random Slayer?
11 years ago  July 17, 2013, 01:16:20 AM

The islevelable = true; is erroring out on my compiler.  I am guessing there is a script outside of the normal runuo scripts I need for it to recognize that command.


Yes sorry, I should have mentioned that UO Evolution runs on a highly customized core. My apologies.

Keldon
Offline
223 Posts
#9 Re :   Random Slayer?
11 years ago  July 17, 2013, 01:26:20 AM

Ya I kind of figured that.  Oh well I will add that line to the weapons I want it on and not worry about the error.


I have this strangely planned out in my head.  Hopefully next week I will get to get all of code put down.

Kyn
Offline
336 Posts
#10 Re :   Random Slayer?
11 years ago  July 17, 2013, 01:54:43 AM

Ya I kind of figured that.  Oh well I will add that line to the weapons I want it on and not worry about the error.


I have this strangely planned out in my head.  Hopefully next week I will get to get all of code put down.


You can find a similar system to the one we use for levelable items, obviously ours has been modified.


http://www.runuo.com/community/threads/runuo-2-0-rc1-levelable-items-system-3-0.71218/