[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:
Alex King
2023-01-08 11:27:17 -05:00
committed by GitHub
parent 2253e43d2c
commit 0c105a2b91
3 changed files with 26 additions and 21 deletions
+1 -1
View File
@@ -278,7 +278,7 @@ public:
bool MakeTrackPacket(Client* client);
void SendTraders(Client* client);
void AddClient(Client*);
void AddNPC(NPC*, bool SendSpawnPacket = true, bool dontqueue = false);
void AddNPC(NPC*, bool send_spawn_packet = true, bool dont_queue = false);
void AddMerc(Merc*, bool SendSpawnPacket = true, bool dontqueue = false);
void AddCorpse(Corpse* pc, uint32 in_id = 0xFFFFFFFF);
void AddObject(Object*, bool SendSpawnPacket = true);