|
You last visited: Today at 12:56
Advertisement
How do you make a monster spawn with a command?
Discussion on How do you make a monster spawn with a command? within the CO2 Private Server forum part of the Conquer Online 2 category.
01/07/2010, 04:58
|
#1
|
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
|
How do you make a monster spawn with a command?
Is there a way to spawn a monster with a command in game (instantly), maybe like Gano or Titan? Also is it possible to remove that monster after x amount of time? So far I have already gotten the Timer and spawned the monster on server start but I want to be able to command when I want to spawn the monster. Thanks.
|
|
|
01/07/2010, 05:19
|
#2
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
|
I had a command working for tnpcs and stuff but I haven't done it for mobs (although they should be virtually identical)
I'd suggest looking at how it's being imported from the database and then replicate that through a command (it should be fairly simple involving setting the stats for the monster, sending the spawn packet and then updating the clients)
Just look at how it's done in the source already and then replicate that through a command.
Good luck!
|
|
|
01/07/2010, 06:41
|
#3
|
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
|
I tried doing that, I just made a new global var that held the monster/spawn points and tried calling it using an npc but it just barfed exceptions everywhere. So I am not too sure how to go about this. But ill check your command out, thanks.
Edited:
I finally got the monster to spawn. But now the problem is it wont move. Not only that but only the char on screen at that time can see it (if i jump off screen from the spawned monster it disappears). Any suggestions how to integrate it into the current mobs so that the new mobs will move?
|
|
|
01/08/2010, 02:52
|
#4
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
|
Sounds like in the source you are using, spawning the monster is only the first step. You will still have to integrate the actual functionality of the mob (moving, attacking, etc)
You are successfully displaying the monster to clients onscreen by using the spawn packet (basically says to client "this mob is on screen with these stats") but you are not actually creating the monster in the source. You are on the right track but it sounds like you still need to add the monster to the source's monster handling code (again, atk/def/move etc)
|
|
|
01/08/2010, 04:14
|
#5
|
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
|
Oh yeah, im using the 5165 source. Apparently there's a /spawn command but that one writes to file which would defeat the purpose of spawning temporarily so I couldn't use that (in case people were wondering why i didnt use that in the first place).
And as for the packets, I can't seem to find the monster handling code x.x. Actually, I think i know where it is, I just don't know how to implement the method the way i wanted to. Because if I load mobs again I'm pretty sure it will load all the mobs all over again so there will be 2x the number of monsters just to spawn the 1 i wanted. This is so frustrating..
|
|
|
01/08/2010, 04:25
|
#6
|
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
|
I think it would be pointless because it would require the server to restart I believe.
|
|
|
01/08/2010, 04:42
|
#7
|
elite*gold: 20
Join Date: Oct 2009
Posts: 1,009
Received Thanks: 621
|
Quote:
Originally Posted by copz1337
I think it would be pointless because it would require the server to restart I believe.
|
No he could simply make a command that sends a monster spawn packet.
|
|
|
01/08/2010, 04:54
|
#8
|
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
|
Quote:
Originally Posted by copz1337
I think it would be pointless because it would require the server to restart I believe.
|
you only need a server restart if you load it into mobinfo.txt. But doing that will let the monster spawn every time the server starts
Quote:
Originally Posted by spare2
No he could simple make a command that sends a monster spawn packet.
|
Which i cant find. >.>
|
|
|
01/08/2010, 04:57
|
#9
|
elite*gold: 20
Join Date: Oct 2009
Posts: 1,009
Received Thanks: 621
|
Which source are you using?
|
|
|
01/08/2010, 05:48
|
#10
|
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
|
im using 5165. i can make the mob show itself but only if youre on screen at that time.
|
|
|
01/08/2010, 06:12
|
#11
|
elite*gold: 0
Join Date: Dec 2009
Posts: 583
Received Thanks: 119
|
Hey dragon if you'll look right inside the 5165 source and look for this command to add a NPC
So try to configure it to spawn a monster it might help...
Goodluck
, Peace Combat
|
|
|
01/08/2010, 06:42
|
#12
|
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
|
Yep, thats how I was able to make the monster show on screen. It still doesn't move though :/ I'm thinking its along the lines of LoadMobs(); but I'm not too sure how to change it.
|
|
|
01/08/2010, 06:44
|
#13
|
elite*gold: 20
Join Date: Oct 2009
Posts: 1,009
Received Thanks: 621
|
Well either Gano nor Titan is in the original MobInfo.txt.
To spawn a mob I coded this, //needs testing, I never tested it nor compiled it, put this where the commands are.
Code:
if (Cmd[0] == "/spawnmob") //SYNTAX: "/spawnmob 35" This will spawn SnowApe at where you are standing.
{
if (Cmd.Length == 2)
{
string mob_line = null;
StreamReader SR = new StreamReader(@"C:\OldCODB\MobInfos.txt", true);
while (SR.EndOfStream != false)
{
string read = SR.ReadLine();
if (read.StartsWith(Cmd[1]))//MobID
{
mob_line = read;
break;
}
}
if (mob_line != null)
{
Game.Mob mob = new Game.Mob(mob_line);
mob.Loc.X = (ushort)(GC.MyChar.Loc.X - 1);
mob.Loc.Y = (ushort)(GC.MyChar.Loc.Y - 1);
GC.AddSend(Packets.SpawnEntity(mob));
GC.AddSend(Packets.ChatMessage(0, "SYSTEM", GC.MyChar.Name, mob.Name + " has been spawned!", 2001, 0));
}
}
}
To find the MobID, go to MobInfos.txt and find the name of the monster, the number before it is the mob ID. Tell me if it doesn't work I'll try to fix it.
Edit: This should spawn the mob right away without restart.
|
|
|
01/08/2010, 06:55
|
#14
|
elite*gold: 0
Join Date: Dec 2005
Posts: 231
Received Thanks: 85
|
hmm that looks like what i coded x.x but ill try it ill get back to you
edit:
Yep its the same as what I did, the monster spawns but its just there. Once you go off screen it just disappears >.<
|
|
|
01/08/2010, 07:12
|
#15
|
elite*gold: 20
Join Date: Oct 2009
Posts: 1,009
Received Thanks: 621
|
Quote:
Originally Posted by dragon89928
hmm that looks like what i coded x.x but ill try it ill get back to you
edit:
Yep its the same as what I did, the monster spawns but its just there. Once you go off screen it just disappears >.<
|
I know why, you have to add it to the mob hashtable so that way it gets processed through the Mob thread.
I'll do it tomorrow.
P.S. It's my first time working with this source so I don't exactly know it inside out yet.
|
|
|
 |
|
Similar Threads
|
csv monster spawn
01/06/2010 - Dekaron - 2 Replies
Never mind lol problem solved :D
|
[Request] Mob Spawn command
06/28/2009 - CO2 Private Server - 0 Replies
#Request close! found it hehe sorry
|
[help]Need Spawn Nps/Mobs command
04/04/2009 - CO2 Private Server - 3 Replies
heya guys infact i need command spawn for nps and mobs i have it in my source and it's powersource but i cant write it there is wrong thing
so can anyone tell me how to write it like this
/spawn ..... or things like this and thanks =]
and i searched already for 3 hours in the wepsite about it and i cant find it too.
|
Monster Spawn Rate
12/05/2008 - Dekaron - 36 Replies
I have succesfully been able to adjust the AI as most for the mobs to not attack, then I traced the Monster follow distance, agro Number, avoid rates, etc. Now I can pull just about every monster on the map and have them nicely pile on top of each other for a few quick aoe attacks and watch the XP flow in. The problem is I then have to wait for new mobs to spawn. Has anyone had any success in increasing the Monster Spawn rate?
I noticed at one point that there is a limit of 200 monsters per...
|
spawn command?
09/05/2008 - CO2 Private Server - 6 Replies
In the LOFT source and shadow source how does the spawn command work, can someone give me an example so they dont come out invincible
|
All times are GMT +1. The time now is 12:58.
|
|