Jump to content

[Prob] Respawn of creatures without loot


Guest Janu

Recommended Posts

Hey,

I have got a problem concerning the respawn time of creatures. Some of them needed for quests, should have a very short respawn time.

Example:

http://www.wowhead.com/npc=28834

needed for quest: http://www.wowhead.com/quest=12701

http://www.wowhead.com/npc=31099

needed for quest: http://www.wowhead.com/quest=13166

The problem here is that there are some options in config:

Corpse.Decay.NORMAL = 60
Corpse.Decay.RARE = 300
Corpse.Decay.ELITE = 300
Corpse.Decay.RAREELITE = 300
Corpse.Decay.WORLDBOSS = 3600

So due to that the creatures listed above have a respawn time of 5m / 1h in addition to the DB content what is clearly too long.

They have no loot and should give no experience, so they are only the target of quests. As far as I know fromofficial servers, they have a shorter respawn time than this.

I thought of checking if the creature has some loot entry in the DB. If not you can reduce the respawn time. This code here is only a temp solution, but works fine for me (maybe it is better to add an additional config option for that?):

diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 04f562f..3f47097 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1323,7 +1323,10 @@ void Creature::setDeathState(DeathState s)
{
    if ((s == JUST_DIED && !m_isDeadByDefault) || (s == JUST_ALIVED && m_isDeadByDefault))
    {
-        m_deathTimer = m_corpseDelay*IN_MILLISECONDS;
+        if (GetCreatureInfo()->maxgold > 0 || GetCreatureInfo()->lootid || GetCreatureInfo()->SkinLootId)
+             m_deathTimer = m_corpseDelay*IN_MILLISECONDS;
+        else
+             m_deathTimer = MINUTE*IN_MILLISECONDS;    // one minute despawn for all NPC's without loot

        // always save boss respawn time at death to prevent crash cheating
        if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY) || isWorldBoss())

Can anyone confirm this problem or have further information of official servers about respawn time handling?

Link to comment
Share on other sites

  • 2 weeks later...

1. the default values in .conf are most likely incorrect

2. i think you are mixing up respawn time with corpse decay time :)

3. yes, we do need some changes to the corpse decay / re-spawn time system

From a rather small base of research, I've been messing around with some changes so that the system becomes a bit more like expected, especially for the corpse decay.

The changes are as follows: http://paste2.org/p/976252

It's not too easy to see what will really change, so breaking it down in some examples:

test mob: db spawntimesecs = 180 (3 minutes)

case 1:

kill

loot shortly after

corpse decay after 180/3 (60) seconds

re-spawn 3 minutes after kill

case 2:

kill

wait 4 minutes, then loot

corpse decay instantly at loot release

re-spawn next tick

case 3:

kill

do not take loot

corpse decay after 300 secs (5 minutes)

re-spawns next tick

There are at least two significant changes made:

* Database field creature.spawntimesecs is now defined as the actual time (in seconds) it takes from you kill the creature to the mob re-spawn

(assuming corpse is looted before the corpse decay values from config expire)

* The corpse decay time _after_ you loot the corpse is no longer a multiplier of Corpse.Decay.TYPE -value but creature.spawntimesecs / 3 as the default.

This will have a noticeable impact on the visual, especially for creatures that has a long re-spawn time. As example, the corpse of a creature with 6 hour re-spawn time (spawntimesecs=21600) will decay after about 7200 seconds (2 hours).

Also, the issue you initially report should be corrected. If creature does not have any loot, the proper function is used to update the corpse decay values. In your case where the expected time to re-spawn is always ~1 minute, you simply need a low value in creature.spawntimesecs.

It must be noted that Corpse.Decay.RARE = 900 and Corpse.Decay.RAREELITE = 1200 are guessed values. It is assumed though that the time are static for all/most mobs. The way to get them should be fairly easy i think:

- Kill a mob that you know has loot

- Do not take the loot, but instead take the time from you kill it to the corpse disappear. That is the value to use as Corpse.Decay.TYPE

Have in mind that the test should be done outside instance, as instances may use some different system (yet to be determined)

Overall, i personally think this will improve the system, but i realize it is only a step closer to how it should really work.

Link to comment
Share on other sites

First thanks for your extensive reply and your work :)

It is a bit confusing for me to distinguish between respawn time with corpse decay time, but if get the patch correct it is relly great!

But I have some logical questions:

1. (respawn time in database) /3 < corpse decay in config

Is the corpse delay "(respawn time in database) /3" then?

2. (respawn time in database) /3 > corpse decay in config

Is the corpse delay " corpse decay in config" then?

If my assumptions are correct will this happen for rare, elite and normal mobs? Besides I will test this in the next days and give you some feedback about this :)

Link to comment
Share on other sites

Ok, the two basic definitions we need to deal with:

- Corpse decay: The time it takes from you kill the mob til the corpse disappear.

* The default/max time per type (rank) is set in config file. This is the time used if you do not loot the body

- Re-spawn time: the time it takes from you kill the mob to the mob appear in alive state at his re-spawn position.

* The value are set in creature.spawntimesecs

In most cases, you will loot the mob before the corpse decay time is expired. This is when the corpse decay time change. For a regular mob with low respawntime, the corpse will vanish fairly short after you loot the mob. My goal is to make the creature.spawntimesecs be the actual time it takes from killed to respawning and at the same time have the corpse vanish as close as possible compared with the real thing. As example, the looted corpse of a rare elite may be found in the world several hours later. Similar cases you may find inside instances, the corpse of the looted mob will be around for quite some time.

This is the reason why we, with the current features need to use a modifier of creature.spawntimesecs to determine how long the corpse can remain visible in world after it is looted (remember, the values in config file are the max values, the values used _unless_ the corpse are looted).

As a side note, i left the CONFIG_FLOAT_RATE_CORPSE_DECAY_LOOTED as an option to those who prefer the current way. If not set to 0.0, the corpse (no matter what rank) will disappear at a certain time after looted, no matter how long spawntimesecs it has in database.

Now, this is still a kind of work-in-progress from my side, and the details are still a bit unclear about how to deal with the code in AllLootRemovedFromCorpse() -function. To be honest, I'm still trying to figure out the best way/most proper way, without implementing any new/bigger features, I realize our system will not become fully like it should be without.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use