Dan

Moderator
Code:
public static Map[] Maps = new Map[]                   // Maps that paragons will spawn on
        {
            Map.Ilshenar && DungeonRegion == true
        };

I have tried multiple instances of this but can't seem to wrap my head around it. Any help pointing me in the right direction would be great!!
 
I think it has something to do with the Map. just not sure how to go about it.

Code:
using System;
using Server.Items;
using Server.Regions;

namespace Server.Mobiles
{
    public class Paragon
    {
        public static double ChestChance = .10;// Chance that a paragon will carry a paragon chest
        public static double ChocolateIngredientChance = .20;// Chance that a paragon will drop a chocolatiering ingredient
        public static Map[] Maps = new Map[]                   // Maps that paragons will spawn on
        {
            Map.Ilshenar && Region is DungeonRegion
        };

Error

Code:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

ServUO - [http://www.servuo.com] Version 0.5, Build 6046.39597
Publish 54
Core: Optimizing for 8 64-bit processors
RandomImpl: CSPRandom (Software)
Core: Loading config...
Scripts: Compiling C# scripts...Failed with: 1 errors, 2 warnings
Errors:
 + Services/Paragon.cs:
  CS0118: Line 13: 'Server.Region' is a 'type' but is used like a 'variable'
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
 
It can't be done from there Tas,

public static Map[] Maps = new Map[]

This is just building an array of maps, named Maps, and Ilshenar is being placed in it..
You will need to make a new check like Ravenwolfe suggested in a different location.
[doublepost=1469458105][/doublepost]Try in CheckConvert
 
Fraz you are the best as always!

CheckConvert

So how would I go about calling for the opposite of this?

Code:
if (bc.Region is DungeonRegion)
                return false;

I tried like !is obviously I was wrong lol

Like if it does not = DungeonRegion return false
 
Thank you Fraz! I really need to learn how to call the opposites of everything. Like != , ect ect
[doublepost=1469461974][/doublepost]So I run a Pre AOS shard but want Peerless to spawn in Felucca dungeons ONLY.

This is my code. Everything loads but Mobs do not convert.

I commented out the AOS code that would prevent it and even checked in BaseCreature.cs.

Here is my script

Code:
using System;
using Server.Items;
using Server.Regions;

namespace Server.Mobiles
{
    public class Paragon
    {
        public static double ChestChance = .10;// Chance that a paragon will carry a paragon chest
        public static double ChocolateIngredientChance = .20;// Chance that a paragon will drop a chocolatiering ingredient
        public static Map[] Maps = new Map[]                   // Maps that paragons will spawn on
        {
            Map.Felucca
        };
        public static Type[] Artifacts = new Type[]
        {
            typeof(GoldBricks), typeof(PhillipsWoodenSteed),
            typeof(AlchemistsBauble), typeof(ArcticDeathDealer),
            typeof(BlazeOfDeath), typeof(BowOfTheJukaKing),
            typeof(BurglarsBandana), typeof(CavortingClub),
            typeof(EnchantedTitanLegBone), typeof(GwennosHarp),
            typeof(IolosLute), typeof(LunaLance),
            typeof(NightsKiss), typeof(NoxRangersHeavyCrossbow),
            typeof(OrcishVisage), typeof(PolarBearMask),
            typeof(ShieldOfInvulnerability), typeof(StaffOfPower),
            typeof(VioletCourage), typeof(HeartOfTheLion),
            typeof(WrathOfTheDryad), typeof(PixieSwatter),
            typeof(GlovesOfThePugilist)
        };
        public static int Hue = 0x501;// Paragon hue

        // Buffs
        public static double HitsBuff = 5.0;
        public static double StrBuff = 1.05;
        public static double IntBuff = 1.20;
        public static double DexBuff = 1.20;
        public static double SkillsBuff = 1.20;
        public static double SpeedBuff = 1.20;
        public static double FameBuff = 1.40;
        public static double KarmaBuff = 1.40;
        public static int DamageBuff = 5;
        public static void Convert(BaseCreature bc)
        {
            if (bc.IsParagon ||
                !bc.CanBeParagon)
                return;

            bc.Hue = Hue;

            if (bc.HitsMaxSeed >= 0)
                bc.HitsMaxSeed = (int)(bc.HitsMaxSeed * HitsBuff);

            bc.RawStr = (int)(bc.RawStr * StrBuff);
            bc.RawInt = (int)(bc.RawInt * IntBuff);
            bc.RawDex = (int)(bc.RawDex * DexBuff);

            bc.Hits = bc.HitsMax;
            bc.Mana = bc.ManaMax;
            bc.Stam = bc.StamMax;

            for (int i = 0; i < bc.Skills.Length; i++)
            {
                Skill skill = (Skill)bc.Skills[i];

                if (skill.Base > 0.0)
                    skill.Base *= SkillsBuff;
            }

            bc.PassiveSpeed /= SpeedBuff;
            bc.ActiveSpeed /= SpeedBuff;
            bc.CurrentSpeed = bc.PassiveSpeed;

            bc.DamageMin += DamageBuff;
            bc.DamageMax += DamageBuff;

            if (bc.Fame > 0)
                bc.Fame = (int)(bc.Fame * FameBuff);

            if (bc.Fame > 32000)
                bc.Fame = 32000;

            // TODO: Mana regeneration rate = Sqrt( buffedFame ) / 4

            if (bc.Karma != 0)
            {
                bc.Karma = (int)(bc.Karma * KarmaBuff);

                if (Math.Abs(bc.Karma) > 32000)
                    bc.Karma = 32000 * Math.Sign(bc.Karma);
            }
        }

        public static void UnConvert(BaseCreature bc)
        {
            if (!bc.IsParagon)
                return;

            bc.Hue = 0;

            if (bc.HitsMaxSeed >= 0)
                bc.HitsMaxSeed = (int)(bc.HitsMaxSeed / HitsBuff);

            bc.RawStr = (int)(bc.RawStr / StrBuff);
            bc.RawInt = (int)(bc.RawInt / IntBuff);
            bc.RawDex = (int)(bc.RawDex / DexBuff);

            bc.Hits = bc.HitsMax;
            bc.Mana = bc.ManaMax;
            bc.Stam = bc.StamMax;

            for (int i = 0; i < bc.Skills.Length; i++)
            {
                Skill skill = (Skill)bc.Skills[i];

                if (skill.Base > 0.0)
                    skill.Base /= SkillsBuff;
            }

            bc.PassiveSpeed *= SpeedBuff;
            bc.ActiveSpeed *= SpeedBuff;
            bc.CurrentSpeed = bc.PassiveSpeed;

            bc.DamageMin -= DamageBuff;
            bc.DamageMax -= DamageBuff;

            if (bc.Fame > 0)
                bc.Fame = (int)(bc.Fame / FameBuff);
            if (bc.Karma != 0)
                bc.Karma = (int)(bc.Karma / KarmaBuff);
        }

        public static bool CheckConvert(BaseCreature bc)
        {
            return CheckConvert(bc, bc.Location, bc.Map);
        }

        public static bool CheckConvert(BaseCreature bc, Point3D location, Map m)
        {
            //if (!Core.AOS)
                //return false;
           
            if (!(bc.Region is DungeonRegion))
                return false;

            if (Array.IndexOf(Maps, m) == -1)
                return false;

            if (bc is BaseChampion || bc is Harrower || bc is BaseVendor || bc is BaseEscortable || bc is Clone || bc.IsParagon)
                return false;

            int fame = bc.Fame;

            if (fame > 32000)
                fame = 32000;

            double chance = 1 / Math.Round(20.0 - (fame / 3200));

            return (chance > Utility.RandomDouble());
        }

        public static bool CheckArtifactChance(Mobile m, BaseCreature bc)
        {
            //if (!Core.AOS)
                //return false;

            double fame = (double)bc.Fame;

            if (fame > 32000)
                fame = 32000;

            double chance = 1 / (Math.Max(10, 100 * (0.83 - Math.Round(Math.Log(Math.Round(fame / 6000, 3) + 0.001, 10), 3))) * (100 - Math.Sqrt(m.Luck)) / 100.0);

            return chance > Utility.RandomDouble();
        }

        public static void GiveArtifactTo(Mobile m)
        {
            Item item = (Item)Activator.CreateInstance(Artifacts[Utility.Random(Artifacts.Length)]);

            if (m.AddToBackpack(item))
                m.SendMessage("As a reward for slaying the mighty paragon, an artifact has been placed in your backpack.");
            else
                m.SendMessage("As your backpack is full, your reward for destroying the legendary paragon has been placed at your feet.");
        }
    }
}
 

Attachments

  • Paragon.cs
    5.9 KB · Views: 4
Yeah, sorry, that was the check but not the right place. I'm not near my IDE right now.

The script looks ok. Where does CheckConvert get called from? Maybe something there restricting?
 
I checked BaseCreature on the Convert and it just points back to Paragon. Checked spawners, nothing there.
[doublepost=1469469732][/doublepost]Nothing in the core under Map or Mobile either.

Must be an issue in Paragon.
 
I have nothing set up to test spawns in dungeons,

just for curiosity sake.. try instead

if (!bc.Region.IsPartOf(typeof(DungeonRegion)))

if that doesn't help another guess that could be something to check could be the fame calc?
 
or maybe location.Region?
[doublepost=1469469919][/doublepost]It is being called from BaseCreature but it just says to check Paragon.cs for Map ect.
 
CheckConvert is called from public override void OnBeforeSpawn(Point3D location, Map m) in BaseCreature.cs..
 
I need it to be the negative of that. So that the paragon will ONLY spawn inside a dungeon region and not out in the wild.
 
I tried if (!bc.Region.IsPartOf(typeof(DungeonRegion))) and it did not work.

Just to test, since I am running pre AOS, I also removed the check 100% so it was just the Map.Felucca just to make sure it was not AOS blocking it and it worked.

The issue is in that statement if (!bc.Region.IsPartOf(typeof(DungeonRegion)))
 
Errors:
+ Services/Paragon.cs:
CS0120: Line 133: An object reference is required for the non-static field,
method, or property 'Server.Region.IsPartOf(System.Type)'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 
sorry bc.Region
[doublepost=1469471459][/doublepost]I copied and pasted it from here that time..
 
duh stupid on my part.

If it does not work I will mess around with BaseCreature.
[doublepost=1469471540][/doublepost]Make it check if canconvert + region
 
its like so? (where you return false I mean)

if (bc.Region.IsPartOf(typeof(DungeonRegion)))
{

}
else
{
return false;
}
 
Nope lol 1 sec
[doublepost=1469472313][/doublepost]Okay I tried both and still nothing.

Does it call the exceptions in order? Like should I put it under the Map check?
[doublepost=1469472664][/doublepost]Nm that doesn't really make sense. Since if in dungeon it'd move along to map anyways.

I'll tinker around with BaseCreature.cs
 
None of my checks seem to be in a dungeon region when I spawn.. lets try this.. (under map is a good place though)

Would you mind trying it this way instead? Maybe we aren't looking far enough back.. maybe Region hasn't been set yet?
I'd have to look more.. but its a good guess :)

if (Region.Find(location, m).GetRegion(typeof(DungeonRegion)) == null)
{
return false;
}
[doublepost=1469474206][/doublepost]That seems to have solved it for me..
 
Just another way to skin a cat...
If you're using a ServUO core, that comes with Xmlspawner, including XmlParagon. Prevent Paragons from spawning (that's a script setting) and then use an XmlParagon spawner to hand-place exactly where you want them to spawn. They are setup with the same system as Ilsh Paragons, but you can also determine chest drop rates too.
 
Thank you Fraz that did it! I wish I knew all that you did!!

Thanks everyone else for the input and help!! I do use ServUO and I will have to take a look at XmlParagon in the future!
 
try this:

Code:
            if (Array.IndexOf(Maps, m) == -1 || !Region.Find(location, m).IsPartOf(typeof(DungeonRegion)))
                return false;
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back