Drake11

Member
I feel like I'm missing something simple and obvious here, maybe it's lack of sleep lol, anyone mind taking and look because I'm definitely missing something.

Code:
        private DateTime m_Delay;

        public override void OnActionCombat()
        {
            if ( DateTime.Now > m_Delay )
            {
                DoDragonCall();
                m_Delay = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 15, 15 ) );
            }

            base.OnActionCombat();
        }

        public void DoDragonCall( Mobile from )
        {
            Map map = from.Map;

            if ( map == null )
                return;

            int count = 1;

            for ( int i = 0; i < count; ++i )
            {
                int x = from.X + Utility.RandomMinMax( -1, 1 );
                int y = from.Y + Utility.RandomMinMax( -1, 1 );
                int z = from.Z;

                if ( !map.CanFit( x, y, z, 16, false, true ) )
                {
                    z = map.GetAverageZ( x, y );

                    if ( z == from.Z || !map.CanFit( x, y, z, 16, false, true ) )
                        continue;
                }

                               switch ( Utility.Random( 3 ) )
                {
                    case 0:
                    DrogonEgg egg1 = new DrogonEgg();
                    egg1.MoveToWorld( from.Location, from.Map );
                    break;
                    case 1:
                    RhaegalEgg egg2 = new RhaegalEgg();
                    egg2.MoveToWorld( from.Location, from.Map );
                    break;
                    case 2:
                    ViserionEgg egg3 = new ViserionEgg();
                    egg3.MoveToWorld( from.Location, from.Map );
                    break;
                }
            }
        }
 
Well, first off, what are you trying to do?
Secondly, is this not compiling, crashing the shard, etc?

If it's causing a crash or not compiling, please post the errors here as well.
 
sorry, running short on sleep so my ability to complete my thoughts is severely lacking atm. lol, its not compiling atm,

Errors:
+ Custom/NEWEST 5-27-15/Game of Thrones Dungeon/DaenerysTargaryen.cs:
CS1501: Line 118: No overload for method 'DoDragonCall' takes 0 arguments

The basics (yes is Game of Thrones themed haha) is the boss will spawn either a drogon egg, rhaegal egg, or viserion egg under the feet of a random player. Everything else works fine, just can't get her to throw the eggs, Sounds simple enough which is why I think it's something im overlooking that's going to make me feel stupid.
 
Check out the code for Demon Knight. That's the Dark Father from Doom. He throws bones at players that turn into "helpers". That's basically what you're doing here.
 
That's essentially the code I have used there, with a random switch involved, the only difference is I'd like it to be activated onactioncombat instead of ondamage, which is I think where the problem is occurring.
 
Hey, easy answer here.

You have a function called "DoDragonCall"

As the error says, you don't have an overload of that function that takes 0 arguments, arguments are the part that go (inside here)
So if I had a command "HelpDesk(Mobile from)" from is the argument I'm passing to the function, it's a type "Mobile". If I tried to just say "HelpDesk()" It would throw an error because it's expecting to know who the mobile value for from.

So. It looks like the code snippet above "From" is refering to the dragon caller. So we'll simply amend the code to the following.

  1. if ( DateTime.Now > m_Delay )
  2. {
  3. DoDragonCall(this);
  4. m_Delay = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 15, 15 ) );
  5. }

Now we're passing "this" to the function. Presuming this code is located inside the mobile "this" will reference the instance of the class that is calling the function.
 
HA, told you it was something stupid I was overlooking, thanks for pointing that out, it's obnoxious how long I can sit here and stare at that section of code and overlook that. Knew it would be something simple. Couldn't place it for the life of me though. Thanks again for taking a look at that. Very complicated encounter with lots of moving parts. I've now planned that encounter out for about 4 days haha.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back