Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 02:38

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Metode to remove a SobNPC

Discussion on Metode to remove a SobNPC within the CO2 Private Server forum part of the Conquer Online 2 category.

Closed Thread
 
Old   #1
 
zakkwilde_17's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 137
Received Thanks: 4
Post Metode to remove a SobNPC

well guys... i'm here again... well... i have a little problem here... I need to do a method to remove a sobnpc when it have no Hitpoints... I have tryed alot of times and do some tests and don't got sucess...

My method to create a sobnpc working fine...

Creating a SobNPC...
Code:
                    SobNpcSpawn agility = new SobNpcSpawn
                    {
                        Name = "FlagTeste",
                        UID = 10105,
                        MapID = 1002,
                        X = 449,
                        Y = 449,
                        MaxHitpoints = 100000,
                        Hitpoints = 100000,
                        Mesh = 11150,
                        Type = Enums.NpcType.Stake
                    };
                    Kernel.Maps[(ushort)1002].AddNpc(agility);
Code:
public void AddNpc(INpc npc)
        {
            if (!this.Npcs.ContainsKey(npc.UID))
            {
                this.Npcs.Add(npc.UID, npc);
                this.Floor[npc.X, npc.Y, MapObjectType.InvalidCast, npc] = false;
                if (((npc.Mesh / 10) != 0x6c) && (npc.Type < ((Enums.NpcType)10)))
                {
                    ushort x = npc.X;
                    ushort y = npc.Y;
                    foreach (Enums.ConquerAngle angle in Angles)
                    {
                        ushort num3 = x;
                        ushort num4 = y;
                        UpdateCoordonatesForAngle(ref num3, ref num4, angle);
                        this.Floor[num3, num4, MapObjectType.InvalidCast, null] = false;
                    }
                }
            }
        }
Remove NPC code
Code:
                if (((attacker.MapID == 1002) && (attacked.UID == 10105)) && (attacked.Hitpoints <= damage))
                {
                    attacked.Hitpoints = 0;
                    SobNpcSpawn agility = new SobNpcSpawn
                    {
                        Name = "FlagTeste",
                        UID = 10105,
                        MapID = 1002,
                        X = 449,
                        Y = 449,
                        MaxHitpoints = 100000,
                        Hitpoints = attacked.Hitpoints,
                        Mesh = 11150,
                        Type = Enums.NpcType.Stake
                    };
                    Kernel.Maps[(ushort)1002].Removenpc(agility);

                }
The remove method is that
Code:
public void Removenpc(INpc npc)
        {
            if (this.Npcs.ContainsKey(npc.UID))
            {
                this.Npcs.Remove(npc.UID);
                this.Floor[npc.X, npc.Y, MapObjectType.InvalidCast, npc] = true;
                if (((npc.Mesh / 10) != 0x6c) && (npc.Type < ((Enums.NpcType)10)))
                {
                    ushort x = npc.X;
                    ushort y = npc.Y;
                    foreach (Enums.ConquerAngle angle in Angles)
                    {
                        ushort num3 = x;
                        ushort num4 = y;
                        UpdateCoordonatesForAngle(ref num3, ref num4, angle);
                        this.Floor[num3, num4, MapObjectType.InvalidCast, null] = true;
                    }
                }
            }
        }
That code to remove work to remove the npc from dictionary... But the sobnpc don't remove from screen... Someone can help here?
zakkwilde_17 is offline  
Old 12/04/2012, 10:34   #2
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Doesn't look like you're sending a removal packet.

It's a general data subtype using the object UID to remove from clients still on the screen.
pro4never is offline  
Old 12/04/2012, 15:31   #3
 
elite*gold: 0
Join Date: Nov 2009
Posts: 342
Received Thanks: 17
Quote:
Originally Posted by pro4never View Post
Doesn't look like you're sending a removal packet.

It's a general data subtype using the object UID to remove from clients still on the screen.
when i use the general data subtype it removes the npc and i go some where and go back to the removal npc it doesn't remove !!
|xabi| is offline  
Old 12/04/2012, 15:55   #4
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
Screen.
_DreadNought_ is offline  
Old 12/04/2012, 16:44   #5
 
zakkwilde_17's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 137
Received Thanks: 4
yep... i do it at screen:

Code:
if ((buffer.UID == 10105) && Crystals.AgilityCrystal == false)
                                        {
                                            foreach (IMapObject obj3 in this.Objects)
                                            {
                                                if ((obj3 != null) && (obj3.MapObjType == MapObjectType.Player))
                                                {
                                                    (obj3 as Entity).Owner.Send(buffer);
                                                    (obj3 as Entity).Owner.Screen.Remove(buffer);
                                                }
                                            }
                                            this.Owner.Map.Floor[buffer.X, buffer.Y, MapObjectType.SobNpc, null] = true;
                                            list.Add(buffer);
                                        }
it do a partial remove... can't attack the npc, and the npc disappears... But when i walk i can see the npc appearing and disappearing... so... the npc does not disappear completely.
zakkwilde_17 is offline  
Old 12/05/2012, 01:23   #6
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
there's 3 stages

#1: Send any packets relating to the npc (damage packets, etc)
#2: Remove/move the npc in your map code (so new users don't have it added to their screen)
#3: Remove it from users currently on the screen

You're obviously not doing #2 if it shows up again when you leave and come back. The ONLY way that can happen is if you're re sending the spawn packet to the client. That would be handled by your map code.
pro4never is offline  
Old 12/05/2012, 16:35   #7
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
If it's going then coming back you're not removing it from somewhere...
_DreadNought_ is offline  
Old 12/06/2012, 04:57   #8
 
zakkwilde_17's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 137
Received Thanks: 4
Quote:
Originally Posted by _DreadNought_ View Post
If it's going then coming back you're not removing it from somewhere...
The NPC is being removed from the dictionary of NPC ... That's right ... most of the screen, it refuses to leave ... I tested many things ... I'm already discouraged x.x

you have no idea what can be added for this to work?
zakkwilde_17 is offline  
Old 12/06/2012, 06:31   #9
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
It's literally not possible that the npc is not being referenced by your map code and yet when you come back on the screen it re-appears.

That's like saying "I moved my car out of my driveway but when I look in my driveway it's still there".
pro4never is offline  
Old 12/06/2012, 16:42   #10
 
zakkwilde_17's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 137
Received Thanks: 4
Quote:
Originally Posted by pro4never View Post
It's literally not possible that the npc is not being referenced by your map code and yet when you come back on the screen it re-appears.

That's like saying "I moved my car out of my driveway but when I look in my driveway it's still there".
That's the class to remove from screen... Can u check if something is wrong?

Code:
        
public bool Remove(IMapObject _object)
        {
            try
            {
                try
                {
                    if (this._objects.ContainsKey(_object.UID))
                    {
                        if (_object.MapObjType == MapObjectType.Item)
                        {
                            FloorItem item = _object as FloorItem;
                            item.Type = 2;
                            item.SendSpawn(this.Owner, false);
                            item.Type = 1;
                        }
                        else if (_object.MapObjType == MapObjectType.Player)
                        {
                            Data buffer = new Data(true)
                            {
                                UID = _object.UID,
                                ID = 0x87
                            };
                            this.Owner.Send(buffer);
                        }
                        else if (_object.MapObjType == MapObjectType.SobNpc)
                        {
                            Data data2 = new Data(true)
                            {
                                UID = _object.UID,
                                ID = 0x87
                            };
                            this.Owner.Send(data2);
                        }
                        this._objects.Remove(_object.UID);
                        this.UpdateArray();
                        return true;
                    }
                }
                catch
                {
                }
            }
            finally
            {
            }
            return false;
        }
zakkwilde_17 is offline  
Old 12/06/2012, 23:57   #11
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
That looks fine, but I bet you there's a dictionary that still contains it and therefor your screen system read that and throw it back into your screen.

--Also I noticed that method is a bool, Tried doing if (Remove(obh)) { Console.Write("removed"); else { console.write("yoo no work"); }

hm?

Also... Breakpointing will solve your ENTIRE issue, it's not coding so you have no excuse such as "I don't know how to use it..." It's literally a few clicks ...

Everything you need to know, figure it out (should take a good 30 minutes to learn the basics and solve ur issue)... As I said it's no coding so you have no excuse to come back and say help i dont know how.
_DreadNought_ is offline  
Old 12/24/2012, 02:51   #12
 
zakkwilde_17's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 137
Received Thanks: 4
it can be closed... i have fixed it. tnx alot
zakkwilde_17 is offline  
Old 12/24/2012, 04:07   #13
 
JohnHeatz's Avatar
 
elite*gold: 150
Join Date: Apr 2010
Posts: 9,739
Received Thanks: 8,977
#Closed as requested
JohnHeatz is offline  
Closed Thread


Similar Threads Similar Threads
PASSWORD CHANGE METODE
03/19/2012 - Combat Arms Trading - 2 Replies
Hi leute weiss ein password change metod unfixed Ih braucht nur id und pw dann mach ich fur euch add on skype: script-taha
SSP +9 server 25 zahl metode psc bis 150 euro
12/25/2011 - Metin2 Trading - 0 Replies
Hallo ich suche ein ssp +9 auf server 25 zahle mit psc 150 euro oder 175 kommt drauf an welche bonis pn me auf skype : metin2acc2
Suche nohide metode
09/27/2010 - Diablo 2 - 2 Replies
Möchte ladder rest 2 cahrs spielen mit sandy box und brauche ne möglich kein das sich das fenster sich nicht immer minimiert :D
! ! ! One Realy ''Working'' Metode To Login No Dc
03/11/2008 - SRO Private Server - 17 Replies
Hi,I have metode to login Pserver : Download Sockscap v.2 40 Link : SocksCap 2.38 - PCHome.de | Download (Kostenlos runterladen) IP : 202.134.80.34 Port : 1010



All times are GMT +2. The time now is 02:38.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.