Jump to content

[feature] Spawn/ Despawn Mobs depending on other Mobs or InstanceData


Auntie Mangos

Recommended Posts

  • 40 years later...

Hi folks,

You all know these CoreHounds in MC - which shouldn't respawn any more after the Big-Dog has been killed.

Motivation for the intention to also implement instance-Data Access is Culling of Stratholme, which should event-driven spawn many mobs.

Fresh patch ;)

http://paste2.org/p/960983 For Rev ~10380 (untested in-game)

This here is a start to get this problem done ;)

What is already possible:

- Not Respawning if a boss is dead / Spawning only if a mob is dead

- works with Instance Check, little test: http://paste2.org/p/898550

- Spawn/ Despawn with .debug specialspawn command

- Spawn/ Despawn depending on entry, map

- Spawn/ Despawn of mobs by id and guid

- Spawn/ Despawn of GOs (by id)

The Flag:

There can be 3 flags set:

SPAWN (if boss is dead - only has meaning for boss_id)

IMMIDIATE (that means, despawn if needed by update is forced), only for mobs

FORCE (is for possible (re)spawn - that Ignores remaining respawntime of mobs) (think of boss adds - you wouldn't want them to respawn a few minutes after the boss respawned)

so if we have the entry:

mob, IMMIDIATE, boss then this means, that the mob will immidiate despawn if the boss dies.

mob, SPAWN, boss, then this means, that the mob will spawn if the boss dies (depending on his remaining respawn time)

IMMIDIATE+SPAWN means, that the mob will spawn if the boss dies (depending on his respawn time), and will despawn IMMIDIATE if the boss respawns

FORCE+SPAWN means, that the mob will spawn if the boss dies (independent of his respawn time)

FORCE means, that the mob will spawn, if the boss respawns (independent of his respawn time)

Still TODO:

I am rather finished, I have proof that mobs are needed by guid and entry, for bosses I have none, so it is 'minimal'

Description of momentarily design:

I use 2 main classes and 2 helper classes;

* SpawnSpecialMgr is the main class, containing all the static information (and loads these from DB)

Hold by Singleton.

* SpawnSpecialHolder holds the dynamic spawn information for the mobs

Hold by every Map

* sSpawnSpecialGroup holds the guids of all Mobs/ GOs for one condition

Hold by SpawnSpecialHolder

* sSpawnSpecialCondition is used to check the conditions

Hold by SpawnSpecialMgr, used by Holder

If a Mob/ GO is LoadedFromDB, the static information is used to check, whether it's SpawnSpecial, and if it is, it is added to the Holder of the map.

If a Boss dies or by .debug command or by InstanceUpdate the information in the corresponding Holder is updated and the object is handled depending on its flags.

to speed things up, the shallSpawn Information is only a lookup information in maps, but to check it every tick

--

patch history:

first attempt, not working in instances (by principle) http://paste2.org/p/852915

second: solution to put all the work to SD2: http://paste2.org/p/854342

a bit stupid way: http://paste2.org/p/857081

http://paste2.org/p/871190

http://paste2.org/p/896140

http://paste2.org/p/900399

http://paste2.org/p/900917(for 335, small cleanup)This patch needs the hotfix (initialize Condition Value in Creature and GameObject)

http://paste2.org/p/913476 For Rev 10185

http://paste2.org/p/921297 For Rev 10233

Link to comment
Share on other sites

Good Idea, and there are a few of these instaces that are like this and could use this to help push them, one I can think of is Ulduar, in both side Instances you have special mobs that spawn when your on one of the Quest given at Dalaran and these do have higher percentages(btw this is from memory from a year ago when I last played on live) and also in the Raid Instance this could be usefull to get it running.

Link to comment
Share on other sites

after a bit more thinking whether or not to go for a generic DB - based approach, I rewrote my script completely, and so it is atm working

The code is at many places hard to read, and I am sure someone who knows C will have good suggestions how to improve this

Thanks TGM for the idea with the corpse-table, that infact was a big help for a direction to get something with these instances done

Link to comment
Share on other sites

  • 1 month later...

bump

1) A new version included, don't be afraid of the templates, just think of them as additional parameter

2) I would be glad if anyone is willing to read through it to give suggestions (and perhaps a few 'stress' tests)

3) A few unresolved information, about what is needed:

* mobs by guid or entry? (are there any mobs on blizz who have Boss-Depended spawn behaviour which is not the same for all of them? (Examples!npc-entries)

* boss by guid or entry? (atm it is by entry - change would be somehow smoother for coding problems)

does anyone know a few 'big' mobs (one entry), who have a set of adds whose spawn behaviour is dependend on the 'big' mobs

* the flags

I really think that they are handy, but I haven't the experience to solve what is needed

* the additional GO support, I suspect ie the fishing pool for SSC (lurker below) could use this system, and also it should be possible to use this system for chests, but the more example you can give, the easier it is get the rich overhead acceptable

thanks for your time :P

Link to comment
Share on other sites

Maybe we need it to be both. This patch can certainly find a use outside of instances, so it should be both guid and entry. What about positive value for entry and negative for guid (or positive = guid and negative = entry)?

Just a thought.

Link to comment
Share on other sites

Do you mean like the earth golem(mainly) which spawns "adds" as their health go down ?

No, this system is not a substitution for scripts - and every in-combat action is to be scripted.

I thought about perhaps a leader of a patrol respawning forcing his patrol adds respawning,

or a elites who always have a few adds which respawn with them, etc :)

Link to comment
Share on other sites

on linux don't build...

/../src/game/SpawnSpecialManager.h:78: error: explicit specialization in non-namespace scope ‘class sSpawnSpecialGroup’

../../../src/game/SpawnSpecialManager.h:80: error: explicit specialization in non-namespace scope ‘class sSpawnSpecialGroup’

Link to comment
Share on other sites

on linux don't build...

hmm, I am not good with these templates, so I am not very sure of the right solution

Possibility 1: Added to makefile? (perhaps stupid question..)

Possibility 2:

Add these 2 lines add end of SpawnSpecialManager.cpp.

template void sSpawnSpecialGroup::AddToGroup<Creature>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 flag);
template void sSpawnSpecialGroup::AddToGroup<GameObject>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 flag);

If these then work, I will repost a freshly rebased version ;)

Link to comment
Share on other sites

If I understand you correctly :)

SpawnSpecialManager.h

       // Helper functions that 'translate' typename into std::map*
       template <typename T>
       IdFlagGUIDMap* GetIdFlagGUIDMap(bool byGUID = false) { return NULL; }
-       template <>
-       IdFlagGUIDMap* GetIdFlagGUIDMap<Creature>(bool byGUID) { return byGUID ? &m_CreatureGUIDFlagMap : &m_CreatureIDFlagMap; }
-       template <>
-       IdFlagGUIDMap* GetIdFlagGUIDMap<GameObject>(bool byGUID) { return byGUID ? &m_GoGUIDFlagMap : NULL; }

SpawnSpecialManager.cpp

// Instantiate template for helper function
template void SpawnSpecialHolder::AddToHolder<Creature>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 MapId);
template void SpawnSpecialHolder::AddToHolder<GameObject>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 MapId);
+template void sSpawnSpecialGroup::AddToGroup<Creature>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 flag);
+template void sSpawnSpecialGroup::AddToGroup<GameObject>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 flag);

then it's work! :)

if SpawnSpecialManager.h not edit error again..

Link to comment
Share on other sites

If I understand you correctly :)

SpawnSpecialManager.h

       // Helper functions that 'translate' typename into std::map*
       template <typename T>
       IdFlagGUIDMap* GetIdFlagGUIDMap(bool byGUID = false) { return NULL; }
-       template <>
-       IdFlagGUIDMap* GetIdFlagGUIDMap<Creature>(bool byGUID) { return byGUID ? &m_CreatureGUIDFlagMap : &m_CreatureIDFlagMap; }
-       template <>
-       IdFlagGUIDMap* GetIdFlagGUIDMap<GameObject>(bool byGUID) { return byGUID ? &m_GoGUIDFlagMap : NULL; }

SpawnSpecialManager.cpp

// Instantiate template for helper function
template void SpawnSpecialHolder::AddToHolder<Creature>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 MapId);
template void SpawnSpecialHolder::AddToHolder<GameObject>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 MapId);
+template void sSpawnSpecialGroup::AddToGroup<Creature>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 flag);
+template void sSpawnSpecialGroup::AddToGroup<GameObject>(uint32 DBGuid, uint32 Entry, uint64 GUID, uint16 flag);

then it's work! :)

if SpawnSpecialManager.h not edit error again..

uh oh, it is getting complicated, your way might compile, but won't work ingame (no specialization there for GetIdFlagGUIDMap, just give me 5min

Link to comment
Share on other sites

sorry, took a little bit longer than exptected ;(

Had to rearrange a few more (tiny) things;

New (full) Version: http://paste2.org/p/913476

(perhaps you need for linux to uncomment the last two lines in SpawnSpecialManager.cpp, but I don't think so (as these explicit forms are called be the explicit Holders)

Edit: might be faster for you: http://paste2.org/p/913489

Link to comment
Share on other sites

you are very welcome (at least I suspect you are the first who really did test this code) ;)

And in my next version your linux-compile notes will be inside, so I think this was worth it - atm the remaining problem is to know what is really needed...

And after this is done, remove the GO hacks and review for all the things I don't understand of C++

Link to comment
Share on other sites

you are very welcome (at least I suspect you are the first who really did test this code) ;)

And in my next version your linux-compile notes will be inside, so I think this was worth it - atm the remaining problem is to know what is really needed...

And after this is done, remove the GO hacks and review for all the things I don't understand of C++

At first glance, the patch works on Linux! Now i parse with flags, and it is not clear - some spawned by killing the boss, some spawn on spawn boss. :)

I forgot to say, your patch works on mangoszero for me!

Link to comment
Share on other sites

  • 1 year later...
Guest
This topic is now closed to further replies.
×
×
  • 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