PDA

View Full Version : Force Repop ?


sotonin
08-02-2004, 07:52 AM
Anybody have a command to force a zone to repop?

#repop
Only repops mobs who have their timer up. But if a named was killed it wont repop until its normal timer is up.

I would like a *full* repop to occur on reboot of server, and a seperate command to *fully* repop a zone.

Also, i'm quite unsatified with the #spawn command.

Does anybody have any more advanced spawn commands?
As it is right now #spawn'ed creatures have run and walkspeed of 0 and thus are perma rooted.

I would like to either A) specify run and walk in the command. or B) have it hardcoded to give them some runspeed and walkspeed.

Honestly a full revamp of the #spawn command would be great, to include AC hp regen mana regen. pretty much most of the npcedit commands.

I use #spawn for gm events, but i don't want to save these creations in the database since they are just for that one event, so #npcedit is out of the question.

Also i have an idea for a command that would make gm events much more interesting. It could tie into this spawn command. make an argument "direct_id" or something. You set this value to an identifying integer.

Imagine an invisible gm. spawning an army or small group of mobs. Then the gm walks around the zone in front of these mobs and has a macro for his command #directnpcs 1 1, the npcs then walk to his current location.

There could be some more arguements to this.

Example: Team 1 of orces has direct_id 1, team of dervs has direct_id of 2

So to summon both teams to walk to you. #directnpcs 1 1, then #directnpcs 2 1

The second arguement would be 1=walk 2=run

#directnpcs [direct_id] [1=walk 2=run 3=attack]

The 3 would send the specified team to attack the gms current target. (or a third arguement could be a player or npcs name)

Some system like this would be awesome for making detailed gm events!

Thanks )

Derision
08-02-2004, 08:26 AM
I would like a *full* repop to occur on reboot of server,


Adding this to the batch file you run to boot your server (before starting world or zones):

echo update spawn2 set timeleft=0 | mysql -u root <your db name>

should force all mobs to repop I think.

sotonin
08-02-2004, 08:35 AM
hmm but is there a way to tie that to the #repop command though?

fathernitwit
08-02-2004, 10:34 AM
change command.cpp, line 287 ish:

command_add("repop","[force] [delay] - Repop the zone with optional force (reset spawn timers) and delay",100,command_repop) ||


replace the body of command_repop() (line 3526ish) with:


//Hacked by Father Nitwit to support a 'force' argument, which resets respawn times
int timearg = 1;
if (sep->arg[1] && strcasecmp(sep->arg[1], "force") == 0) {
timearg++;

char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
if (database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET timeleft=0 WHERE zone='%s'",zone->GetShortName()), errbuf))
safe_delete_array(query);

c->Message(0, "Zone depop: Force resetting spawn timers.");
}
if (sep->IsNumber(timearg)) {
c->Message(0, "Zone depoped. Repop in %i seconds", atoi(sep->arg[timearg]));
zone->Repop(atoi(sep->arg[timearg])*1000);
}
else {
c->Message(0, "Zone depoped. Repoping now.");
zone->Repop();
}



This is untested, but it compiles, and makes perfect sense to me
assuming that that is in fact the correct table to update.
let me know if it helps, or dosent work...

sotonin
08-02-2004, 11:49 AM
I incorporated this code. it compiled. ill let you know after i reboot )

sotonin
08-02-2004, 02:04 PM
Eeek!

i type in game

#repop 1 1

it says repoping zone in 1 sec.

then my client completely locks up and i have to ctrl alt delete to close it.

after a few more tests. it doesnt crash if i only do this.

#repop 1

and i tested a little more. #repop 10 results in the message repopping zone in 10 seconds.

so i am guessing its only reading the first argument still as the timer and crashing if i specify a second

killspree
08-02-2004, 03:05 PM
You could also implement a command to reset the timeleft field to 0 and use that prior to using #repop.

fathernitwit
08-02-2004, 04:01 PM
Sorry, I guess my doc wasnt clear.

the actual command would be:
repop force
or
repop force n
to delay it n seconds

Im not sure why it would have crash your client if you give it wrong args like that though, as it wouldent even run my new code unless you put the word "force" in there..

sotonin
08-09-2004, 05:33 AM
Anybody out there know if my idea for a #directnpcs command would be feasible? (As explained in original post)

fathernitwit
08-09-2004, 05:47 AM
Did you get my code working?
I have tested it on my server with up-to-live client, and it works fine for me, so i would like to know if you are still experiencing problems.

I havent touched the spawn system, so im not going to be any use on your other stuff.

sotonin
08-09-2004, 05:50 AM
i havent tried it again yet. i probably will after we upgrade to next cvs )