LupoSereno 0 Posted August 31, 2023 Share Posted August 31, 2023 Hello, I would like to create a script in python that calls the Pet every time I reconnect. I am already using a program that includes a pythonLoader, so this is not a thing to do. The problem is that this program already have a feature that I would expect to recall the Pet [that basically giving the ID of the item will activate it] but it's not working with the Pet, even tho the value is correct. Did someone already encountered a problem like this? Is there some python script that works? In case is not, is there some other script to take a look in to, in order to start trying making the script? Regards Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted August 31, 2023 Premium Share Posted August 31, 2023 Are you the server's admin and trying to implement this feature, or..? "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
LupoSereno 0 Posted August 31, 2023 Author Share Posted August 31, 2023 No, I'm just a cheater trying to automate what I need as much as possible. I would like to know, as for now, if there's already a python script that does what I described. Link to comment Share on other sites More sharing options...
caanmasu 312 Posted August 31, 2023 Share Posted August 31, 2023 I assume you mean normal pets (not eggs). In any case, the egg ones work in a very similar way in terms of their spawn. I am going to give you a guide to resummon the pet after a warp. It is advisable to store values that persist, since if you save it in the server's cache (a variable on the server), every time you restart it, all the characters when they enter will have to summon their pet. The solution is to save it to the database and the easiest way is to take advantage of the pet_system.quest using flags. If you review the code, to invoke the pet you need an item to be selected (when use), that is, the seal, and then through the pet.summon function you send the vnum of the pet (mob_proto) as a parameter. when [...].use begin pc.setqf("pet_item_id", item.get_id()) --stores the id (it's not vnum, it's the id) of the seal. We will use it when we log in and be able to select the seal again ... --every time you summon the pet, save the vnum of the monster it was summoned with pet.summon(mobVnum, false) pc.setqf("pet_vnum", mobVnum) --here ... --every time you unsummon the pet, don't forget to clear the vnum... pet.unsummon(mobVnum) pc.setqf("pet_vnum", 0) --here end Now we will make that when the character logs in, it invokes the pet: when login with pc.getqf("pet_vnum") != 0 begin --this makes sure we had an active pet last time item.select(pc.getqf("pet_item_id")) --with the seal id flag saved we can select it, it's like executing when use pet.summon(pc.getqf("pet_vnum"), false) --summon the pet with the vnum of the last pet we had active end The quest side is ready Now we need to make sure on the server side that when the pet is uninvoked, the values are cleaned up. PetSystem.cpp In: bool CPetActor::Update(DWORD deltaTime) Find: this->Unsummon(); And adds: m_pkOwner->SetQuestFlag("pet_system.pet_vnum", 0); m_pkOwner->SetQuestFlag("pet_system.pet_item_id", 0); 1 1 1 1 1 1 Link to comment Share on other sites More sharing options...
LupoSereno 0 Posted August 31, 2023 Author Share Posted August 31, 2023 Thank you for the reply @caanmasu . However, from a player's perspective, what I was hoping for was a simple Python script that I could import into my Python loader. This script should allow me to automatically recall the 'seal' of my pet every time I log in or warp. I understand your explanation from a developer's standpoint, but I'm looking for a more user-friendly solution as a player. If you could provide any guidance or a script to achieve this, it would be greatly appreciated. Thanks again! Link to comment Share on other sites More sharing options...
caanmasu 312 Posted August 31, 2023 Share Posted August 31, 2023 35 minutes ago, LupoSereno said: Thank you for the reply @caanmasu . However, from a player's perspective, what I was hoping for was a simple Python script that I could import into my Python loader. This script should allow me to automatically recall the 'seal' of my pet every time I log in or warp. I understand your explanation from a developer's standpoint, but I'm looking for a more user-friendly solution as a player. If you could provide any guidance or a script to achieve this, it would be greatly appreciated. Thanks again! Oh I understand I guess I can't help you this time. Only support in the development of the server. It's okay, I hope you can make it. Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10275 Posted August 31, 2023 Forum Moderator Share Posted August 31, 2023 Hello, we do not support cheating or hacking. Hacking / Cheating / Usebug M2Dev isn't a cheat and / or hack platform. We don't tolerate any messages about hacking, cheating on Metin2 and / or decrypting Metin2 clients from Metin2 private servers. Explaining how a bug works (Bug allowing you to have an advantage over other players within a game server...) is only tolerated if a fix and / or patch is associated with it. 1 2 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Recommended Posts