View Single Post
  #15  
Old 08-14-2008, 12:39 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by trevius View Post
Doesn't it need the brackets around it like this?

Code:
	if (IsEmpty()) {
		corpse_decay_timer.SetTimer(5000); }
Or am I still too much of a coding newbie? :P
If you have only 1 thing to process in an if, else, etc, statement, you don't need brackets. I know this is true for C++ & Perl, pretty sure it's the same for other languages including PHP.

I know there's another weird function using : and ? for a very simple if/else statement, but I never really paid attention to the syntax.

Quote:
Originally Posted by trevius View Post
Oh, and the main reason I think it would be nice to have as a rule would be to have the option to make corpses poof immediately without even starting a timer. This would probably reduce some of the load on servers after a large AE pull is killed. I know when I have 30ish mobs all die at once, it almost always crashes the zone.

One thing I was thinking is that instead of a rule, it might be nice to have the decay timer be an actual setting in the Zones table similar to canbind, accept the number would be the time in seconds of how long the corpse would last. In most zones, I would like the 5 second timer to be set, because I think it would just be a little weird for corpses to disapear immediately. But there are definitely a couple of zones where I would prefer to have them vanish immediately, mostly because there are often AE groups in those zones and the server needs any help it can get to reduce performance issues from AEing.
You could set it up one of many different ways. Unfortunately, I don't know if there's really one "best" way to do it. You could do it on a per-mob basis, per zone basis, per server basis, or a combination of the above. If you really want to add flexibility, I would say all of the above, using mob, zone, then server as the priority using an if, else if, else statement. I'm not sure of the exact code needed, but the idea would be something like this:
Code:
if (mob.empty_corpse_timer != NULL) corpse_decay_timer.SetTimer(mob.empty_corpse_timer)
else if (zone.empty_corpse_timer != NULL) corpse_decay_timer.SetTimer(zone.empty_corpse_timer)
else corpse_decay_timer.SetTimer(RuleI(NPC,EmptyNPCCorpseDecayTimeMS)+1000)
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote