Register for your free account! | Forgot your password?

You last visited: Today at 08:52

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

Advertisement



[HELP]Spawning a NPC

Discussion on [HELP]Spawning a NPC within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
[HELP]Spawning a NPC

Hey guys I was wondering if you can help me to spawn a single NPC like this...
I'm using LOTF 5017...

I'm trying to add Blue Mouse Quest and spawn the Blue Mouses....

What I know:

Spawn the mob(s) at a certain time after click.

What I don't know:

Remove the mob after the click.

Can anybody help me?
Thanks
ryuchetval is offline  
Old 05/22/2010, 20:09   #2
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,377
You will need to write a npc spawn function... There is one for CoEmu in my random treasure hunt quest (both spawning and removal including other checks/random spawn locations) but that was for coemu... still a good example though.

Basically you will need to create a function that has inputs for mesh/id number/name/map/x/y for the npc you want to spawn and then use your npc spawn packet (look at where npcs are being loaded from the database in your source and then use that to find where your actual npc spawn code is.

From what I remember the easiest way to keep track of it would be to create a dictionary or hashtable to store the bluemouse Id/Uid's.. that way they are easier to track how many you have and remove them as needed (cause UID generation is random and that's one of the easy ways to remove the npc)

Then write another one for removal. I think it's just a matter of sending the entity remove packet, removing it from the servers npc dictionary (and bluemouse dictionary if you use that as well) and then update clients that were nearby it when it was removed.

Then just do your normal scripting for the npc and run a little thing on server startup to generate the bluemice where you want them.

Ooh and a random coord system to control where the bluemice can spawn in the mines (I have released that already in both it's own thread (random scrolls) and in my treasure hunt system... again.. coemu though) Or if you want fully random coords just write a random location system using the dmap checker.. those are lots of fun ^^
pro4never is offline  
Old 05/23/2010, 09:17   #3
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
I found a friend that helped me with this and the ideeas are kinda the same

but thanks anyway
ryuchetval is offline  
Old 05/24/2010, 00:14   #4
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
Code:
        public static Game.NPC SpawningNPC;
        public static void SpawnNPC()
        {
            string line = "8005 887 2 0 1036 162 168";
            SpawningNPC = new Game.NPC(line);
            Game.World.H_NPCs.Add(SpawningNPC.EntityID, SpawningNPC);
            Packets.SpawnNamedNPC(SpawningNPC, "SpawnedNPC");
        }
        public static void SendNPC(int x, int y)
        {
            foreach (Game.NPC N in Game.World.H_NPCs.Values)
            {
                if (N.EntityID == Convert.ToUInt16(8005))
                {
                    N.Loc.X = (ushort)x;
                    N.Loc.Y = (ushort)y;
                    Game.World.Spawn(N);
                    foreach (Game.Character C in Game.World.H_Chars)
                    {
                        C.MyClient.AddSend(Packets.SpawnNPC(N));
                        Game.World.Spawns(C, false);
                    }
                }
            }
        }
Here's something that might help.
Arcо is offline  
Reply


Similar Threads Similar Threads
Mob Spawning
01/02/2016 - Cabal Private Server - 5 Replies
Hello communty, Can one tell me how I can create in the game mobs. wenns goes with the id's Thanks in advance than in! MFG: <ZeroCool> GERMAN: Hallo kann mir vielleicht einer sagen wie ich im game mob spawne? und hat vielleicht jemand die idīs Danke als im vorraus."!"
mass spawning
03/20/2010 - Dekaron - 9 Replies
what crespo dungeon r yall mass spawning on a b or c? im lvl 100 now. not sure which one to go to for the fastest kills/exp. also when i play on my laptop gamecrashes in the middle of doing the dungeon idk why..
Need Spawning
12/19/2009 - Dekaron - 13 Replies
Hi Guys I Need Spawning Code :confused:
[Help] Spawning NPC Via Command.
08/26/2009 - CO2 Private Server - 10 Replies
I've been working at this for a bit and I'm at a loss as to why this wont work. I'm essentially trying to make an event NPC that will appear when I type in "/event on" and then disappear when I type "/event off". At the moment nothing will show up unless the type of NPC is a guild gate (I've tried like 5 or 6 different IDs), and it wont disappear if I type "/event off", however if I leave the area and come back the gate is gone. I'm assuming it has something to do with not storing anything...
Db spawning????
03/17/2008 - Conquer Online 2 - 2 Replies
Hi! I have 117 archer on eagle server, and i want to know , when the db spawns and what places ( min maks, thunder apes, sand elfs etc.) When is the server maintenances and how many hours i need to wait for db spawn on the right place:) Waiting for replies. Thank you.



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


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.