Boss

Initiate
How do i add a random powerscroll, not tailor or smith to a monsters pack
if i use this it gives me an alchy scroll of 0


c.DropItem ( new PowerScroll( ) );

I am curious how i make it drop a random scroll of a random level thanks in advance!
 
Well you could use something like
Code:
c.DropItem(new PowerScroll((SkillName)(RandomImpl.Next(Enum.GetNames(typeof(SkillName)).Length)), 105 + (5 * RandomImpl.Next(4))));
or make a function inside PowerScroll or make another class called RandomPowerScroll and have it behave like RandomWand for example.
 
RandomImpl does not exsist in the current context, sorry i did not mention i am on runuo not servuo
 
then you need to basically initialize the random yourself and replace it with RandomImpl
 
Well you could use something like
Code:
c.DropItem(new PowerScroll((SkillName)(RandomImpl.Next(Enum.GetNames(typeof(SkillName)).Length)), 105 + (5 * RandomImpl.Next(4))));
or make a function inside PowerScroll or make another class called RandomPowerScroll and have it behave like RandomWand for example.

Thanks I used this today!! It's so nice to have the forums where we can look back for answers.
 
Well you could use something like
Code:
c.DropItem(new PowerScroll((SkillName)(RandomImpl.Next(Enum.GetNames(typeof(SkillName)).Length)), 105 + (5 * RandomImpl.Next(4))));
or make a function inside PowerScroll or make another class called RandomPowerScroll and have it behave like RandomWand for example.
Where can I fix it to have certain skills drop rather than power scrolls randomly? For example, I want to drop only Animal Taming skill power scrolls.
 
Where can I fix it to have certain skills drop rather than power scrolls randomly? For example, I want to drop only Animal Taming skill power scrolls.
public override void OnDeath(Container c)
{

base.OnDeath(c);

if (Utility.RandomDouble() < 0.05)
{
switch (Utility.Random(3))
{
case 0: c.DropItem(new PowerScroll(SkillName.AnimalTaming, 110)); break;
case 1: c.DropItem(new PowerScroll(SkillName.AnimalTaming, 110)); break;
case 2: c.DropItem(new PowerScroll(SkillName.AnimalTaming, 115)); break;
}

if (Utility.RandomDouble() < 0.025)
switch (Utility.Random(3))
{
case 0: c.DropItem(new PowerScroll(SkillName.AnimalTaming, 115)); break;
case 1: c.DropItem(new PowerScroll(SkillName.AnimalTaming, 115)); break;
case 2: c.DropItem(new PowerScroll(SkillName.AnimalTaming, 120)); break;
}

}
}
 
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back