Register for your free account! | Forgot your password?

Go Back   elitepvpers › MMORPGs › Conquer Online 2 › CO2 Private Server
You last visited: Today at 08:30

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

Advertisement



Need help with Richard Type NPC with random teleport

Discussion on Need help with Richard Type NPC with random teleport within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2006
Posts: 41
Received Thanks: 2
Need help with Richard Type NPC with random teleport

Been trying to make an NPC like the Richard Quest where when you click him he will teleport to a random position on the map.
So far i have got it so that when you click the NPC he gives you a prize and then respawns in a new random position, The previous NPC is no longer active but never dissapears from the map, This happens for all new NPCs that it spawns.
The code im using is below, Can anyone help as to why the NPCs never dissapear?

Code:
                case 5012:
                    if (npcRequest.OptionID == 0)
                    {
                        INpc npc3;
                        if (Kernel.Rate(9))
                        {
                            client.Inventory.Add(0xb2396, 6, 1);
                            Kernel.SendWorldMessage(new Message(" " + client.Entity.Name + " as found the Box 1!!", System.Drawing.Color.White, 0x7e5), Kernel.GamePool.Values);
                            npc3 = new NpcSpawn
                            {
                                UID = 5012,
                                Mesh = 9307,
                                Type = Enums.NpcType.Talker,
                                X = (ushort)Program.BoxX,
                                Y = (ushort)Program.BoxY,
                                MapID = 1002
                            };
                            Kernel.Maps[(ushort)1002].RemoveEntity(npc3);
                            npc2 = new NpcSpawn
                            {
                                UID = 5012,
                                Mesh = 9307,
                                Type = Enums.NpcType.Talker,
                                X = 558,
                                Y = 325,
                            };
                            Program.BoxX = npc2.X;
                            Program.BoxY = npc2.Y;
                            npc2.MapID = 1002;
                            Kernel.Maps[(ushort)1002].AddNpc(npc2);
                        }
                        else if (Kernel.Rate(9))
                        {
                            client.Inventory.Add(0xb2396, 6, 1);
                            Kernel.SendWorldMessage(new Message("Congratulations, " + client.Entity.Name + " has found the Box 2!", System.Drawing.Color.White, 0x7e5), Kernel.GamePool.Values);
                            npc3 = new NpcSpawn
                            {
                                UID = 5012,
                                Mesh = 9307,
                                Type = Enums.NpcType.Talker,
                                X = (ushort)Program.BoxX,
                                Y = (ushort)Program.BoxY,
                                MapID = 1002
                            };
                            Kernel.Maps[(ushort)1002].RemoveEntity(npc3);
                            npc2 = new NpcSpawn
                            {
                                UID = 5012,
                                Mesh = 9307,
                                Type = Enums.NpcType.Talker,
                                X = 570,
                                Y = 267,
                            };
                            Program.BoxX = npc2.X;
                            Program.BoxY = npc2.Y;
                            npc2.MapID = 1002;
                            Kernel.Maps[(ushort)1002].AddNpc(npc2);
                        }
                        else if (Kernel.Rate(9))
                        {
                            client.Inventory.Add(0xb2396, 6, 1);
                            Kernel.SendWorldMessage(new Message("Congratulations, " + client.Entity.Name + " has found the Box 3!", System.Drawing.Color.White, 0x7e5), Kernel.GamePool.Values);
                            npc3 = new NpcSpawn
                            {
                                UID = 5012,
                                Mesh = 9307,
                                Type = Enums.NpcType.Talker,
                                X = (ushort)Program.BoxX,
                                Y = (ushort)Program.BoxY,
                                MapID = 1002
                            };
                            Kernel.Maps[(ushort)1002].RemoveEntity(npc3);
                            npc2 = new NpcSpawn
                            {
                                UID = 5012,
                                Mesh = 9307,
                                Type = Enums.NpcType.Talker,
                                X = 518,
                                Y = 320,
                            };
                            Program.BoxX = npc2.X;
                            Program.BoxY = npc2.Y;
                            npc2.MapID = 1002;
                            Kernel.Maps[(ushort)1002].AddNpc(npc2);
                        }
                    }
                    break;

Code:
        public void RemoveEntity(INpc npc)
        {
            if (this.Npcs.ContainsKey(npc.UID))
            {
                this.Npcs.Remove(npc.UID);
                this.Floor[npc.X, npc.Y, MapObjectType.Npc, npc] = true;
            }
        }
hacksaw is offline  
Old   #2
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,386
If you go offscreen and then back onto it is the old npc gone? if so then you are removing it server side and just need to inform local clients by sending a remove entity subtype of the general action packet (10010 I think subtype was 127 or something?) and that should solve your problem.

Check that this.Npcs.Remove is locating, removing and updating all local clients to the removal. That's prob where the issue lays.
pro4never is offline  
Old   #3
 
elite*gold: 0
Join Date: Feb 2006
Posts: 41
Received Thanks: 2
No the NPC's never dissapear at all, They all stay untill the server is restarted.
hacksaw is offline  
Reply


Similar Threads Similar Threads
Random Teleport ....
06/12/2010 - S4 League - 15 Replies
Öh also ich weiß es immer noch nich und wills gerne wissen was bringt der Random Teleport hack :S ich kapiere den nich ! Antwort pls :s
Random Teleport?
05/20/2010 - S4 League - 3 Replies
Da ich auf Antworten in Threads keine Antworten bekommen habe, mache ich das jetz als Thread. Kann mir wer genau erklären was die Adresse macht und wie man sie verändern kann, damit sie was bringt?
[Release] Random teleport via database
01/17/2010 - CO2 PServer Guides & Releases - 8 Replies
Ok so I had a similar system on my oooolldd coemu server but seeing as I have no backup of it I figured I'd re-code it. This has proven a very useful learning experience for me. Data structures are not something I've ever been comfortable using and so I've always avoided them like the plague xD. Huge thanks to Korvacs: Your advice is always appreciated. This is for Co1 CoFuture but seeing as it's a database system you can convert it for CoEmu with virtually NO hassle. If people can't...
Random Teleport
05/14/2005 - Conquer Online 2 - 12 Replies
Okay.. well I was wandering through the ini and dat files and i stumbled across something that looks VERY VERY usefull It's called RandomTeleport Take a look for yourselves.. ---------------------------------- 1080 10 RandomTeleport 0 0 0 2 0 0 0 0 100 0 0 14 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 903 Fixed ¿É³ÖÐø60Ãë²»±»¹ÖÎïÖ÷¶¯¹¥»÷ NULL NULL NULL NULL 0 SuperXp sound\Health.wav NULL NULL 0 1 0 ---------------------------------- So.. This means.. the skill is there, but how do we use...



All times are GMT +2. The time now is 08:32.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

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