mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Bug Fix] Fix NPC Reference in EVENT_SPAWN (#2712)
* [Bug Fix] Fix NPC Reference in EVENT_SPAWN
# Notes
- Event parsing was too early and memory wasn't fully allocated, meaning that sometimes you could use the NPC reference and other times you couldn't.
- Most people worked around this by setting timers in `EVENT_SPAWN` then using `EVENT_TIMER` to handle the stuff they wanted to do on spawn.
# Example Code in Perl
```pl
sub EVENT_SPAWN {
quest::shout($npc->GetCleanName() . " just spawned with an ID of " . $npc->GetID() . " and an NPC Type ID of " . $npc->GetNPCTypeID() . ".");
}```
* Update bot.cpp
This commit is contained in:
+4
-4
@@ -8784,14 +8784,14 @@ void EntityList::AddBot(Bot *new_bot, bool send_spawn_packet, bool dont_queue) {
|
||||
AddToSpawnQueue(new_bot->GetID(), &ns);
|
||||
safe_delete(ns);
|
||||
}
|
||||
|
||||
parse->EventBot(EVENT_SPAWN, new_bot, nullptr, "", 0);
|
||||
|
||||
new_bot->DispatchZoneControllerEvent(EVENT_SPAWN_ZONE, new_bot, "", 0, nullptr);
|
||||
}
|
||||
|
||||
bot_list.push_back(new_bot);
|
||||
mob_list.insert(std::pair<uint16, Mob*>(new_bot->GetID(), new_bot));
|
||||
|
||||
parse->EventBot(EVENT_SPAWN, new_bot, nullptr, "", 0);
|
||||
|
||||
new_bot->DispatchZoneControllerEvent(EVENT_SPAWN_ZONE, new_bot, "", 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user