issue with summonguard

11/24/2022 19:21 Woohoo1#1
im getting a "system.nullreferenceexception: object reference not set to an instance of an object." at this line:

Code:
var Pet = Server.GamePoll.Values.Where(p => p.Pet != null  && p.Pet?.monster.UID == aUID).FirstOrDefault();
and heres the reference:

Code:
        public void Dead(ServerSockets.Packet stream, GameClient killer, uint aUID, Role.GameMap GameMap, bool CounterKill = false)
        {
            if (Alive)
            {
                DropStats.AllMonstersInServer--;
                if (IsFloor)
                {
                    FloorPacket.DropType = MsgDropID.RemoveEffect;
                    HitPoints = 0;
                    GameMap.SetMonsterOnTile(X, Y, false);
                    return;
                }

                RespawnStamp = Time32.Now.AddSeconds(8 + Family.RespawnTime);

                ClearFlags(false);
                HitPoints = 0;
                AddFlag(MsgUpdate.Flags.Dead, Role.StatusFlagsBigVector32.PermanentFlag, true);
                DeadStamp = Time32.Now;

                var Pet = Server.GamePoll.Values.Where(p => p.Pet != null  && p.Pet?.monster.UID == aUID).FirstOrDefault();
                if (Pet != null)
                    Pet?.Pet.DeAtach(stream);

                InteractQuery action = new InteractQuery()
                {
                    UID = aUID,
                    KilledMonster = true,
                    X = X,
                    Y = Y,
                    AtkType = MsgAttackPacket.AttackID.Death,
                    OpponentUID = UID
                };
it seems like this is getting thrown when my summoned guard dies?
12/25/2022 16:16 Falcon Hero#2
Call me on discord
KeToS#6270
12/27/2022 19:45 Spirited#3
Quote:
Originally Posted by Falcon Hero View Post
Call me on discord
KeToS#6270
Never do this. Public answers should always be posted to the forum. If you don't have a public answer, then you're attempting to get money from this person. Plain and simple.

Quote:
Originally Posted by Woohoo1 View Post
im getting a "system.nullreferenceexception: object reference not set to an instance of an object." at this line:

Code:
var Pet = Server.GamePoll.Values.Where(p => p.Pet != null  && p.Pet?.monster.UID == aUID).FirstOrDefault();
and heres the reference:

Code:
        public void Dead(ServerSockets.Packet stream, GameClient killer, uint aUID, Role.GameMap GameMap, bool CounterKill = false)
        {
            if (Alive)
            {
                DropStats.AllMonstersInServer--;
                if (IsFloor)
                {
                    FloorPacket.DropType = MsgDropID.RemoveEffect;
                    HitPoints = 0;
                    GameMap.SetMonsterOnTile(X, Y, false);
                    return;
                }

                RespawnStamp = Time32.Now.AddSeconds(8 + Family.RespawnTime);

                ClearFlags(false);
                HitPoints = 0;
                AddFlag(MsgUpdate.Flags.Dead, Role.StatusFlagsBigVector32.PermanentFlag, true);
                DeadStamp = Time32.Now;

                var Pet = Server.GamePoll.Values.Where(p => p.Pet != null  && p.Pet?.monster.UID == aUID).FirstOrDefault();
                if (Pet != null)
                    Pet?.Pet.DeAtach(stream);

                InteractQuery action = new InteractQuery()
                {
                    UID = aUID,
                    KilledMonster = true,
                    X = X,
                    Y = Y,
                    AtkType = MsgAttackPacket.AttackID.Death,
                    OpponentUID = UID
                };
it seems like this is getting thrown when my summoned guard dies?
Have you tried debugging in Visual Studio and setting a breakpoint there with a conditions that an exception is thrown?