You know that you don't need any .cpp part to do this, right? It can be easily done by adding 8 lines in the quest, and without any bugs whatsoever.
This is for the default YMIR quest.
Add this trigger:
- when login with pc.getqf("pet_vnum") ~= 0 and item.select(pc.getqf("pet_item_id")) begin
- local mob_vnum = pc.getqf("pet_vnum");
- pet.summon(mob_vnum, string.format(" - %s", mob_name(mob_vnum)));
- end
Now, add the flag reset before pet.unsummon calls, like this:
- pc.setqf("pet_vnum", 0);
- pc.setqf("pet_item_id", 0);
And set them up before pet.summon calls, like this:
- pc.setqf("pet_vnum", mobVnum);
- pc.setqf("pet_item_id", item.get_id());
That's it, you're done.
I don't understand why would he just copypaste other people's code without using his brain and not even checking the code itself, I mean..the answer is simple: gaining free likes, but is it even possible to not notice the gigantic falls in the things he wrote?
He is setting up pet_item_id in the quest like this
- pc.setqf("pet_item_id", item.get_id());
He's using setqf, which means the qf takes the quest's name as the main flag. So the full name to call that qf is now pet_system.pet_item_id (pet_system being the quest's name).
It's the same as:
- pc.setf("pet_system", "pet_item_id", item.get_id());
But then he tries to call it in the source like this..?
- m_pkOwner->SetQuestFlag("pet_item_id.pet_vnum", 0);
How does this even make any sense? How is this even supposed to remotely work?
What he tried to do here is what I did via quest, resetting the flags. But this is wrong, it should've been written like this:
- m_pkOwner->SetQuestFlag("pet_system.pet_item_id", 0);
Which doesn't make it right still, because the whole .cpp modification he did is completely pointless.
Guys please stop copypasting nonsense, use your brain or seek professional help.
Cheers.