Jump to content

Infer pet after teleporting


Recommended Posts

 

quest spawnpet_after_tp begin
	state start begin
		
		when pet_item_vnum.use begin
			local pet_list = {[pet_item_vnum] = {mobvnum, petname}}
			local mobvnum = pet_list[item.vnum][1]
			local pet_name = pet_list[item.vnum][2]
			pc.setqf('summoned_pet', mobvnum)
			pc.setqf('pet_name', pet_name)
			pet.summon(mobvnum, pet_name, false)
		end
		when login with pc.getqf('summoned') > 0 begin pet.summon(pc.getqf('summoned_pet'), pc.getqf('pet_name'), false) end
	end
end

This is just a basic pet quest example. You need to adapt it to your quest

 

 

 

  • Love 1
Link to comment
Share on other sites

56 minutes ago, Frozen said:

 


quest spawnpet_after_tp begin
	state start begin
		
		when pet_item_vnum.use begin
			local pet_list = {[pet_item_vnum] = {mobvnum, petname}}
			local mobvnum = pet_list[item.vnum][1]
			local pet_name = pet_list[item.vnum][2]
			pc.setqf('summoned_pet', mobvnum)
			pc.setqf('pet_name', pet_name)
			pet.summon(mobvnum, pet_name, false)
		end
		when login with pc.getqf('summoned') > 0 begin pet.summon(pc.getqf('summoned_pet'), pc.getqf('pet_name'), false) end
	end
end

This is just a basic pet quest example. You need to adapt it to your quest

 

 

 

Not working ;/ 

 

Quest: http://pastebin.com/8JG88ZXD

SS: https://metin2.download/picture/k2PaW4wSP1Zo373NfZ99Zf46aj2T3F0m/.png

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

 

when login with pc.getqf("summoned_pet") > 0 begin
            pet.summon(pc.getqf("summoned_pet"), pc.getqf("pet_name"), false)
        end
        when 53001.use or 53002.use or 53003.use or 53005.use or 53006.use or 53007.use or 53008.use or 53009.use or 53010.use or 53011.use or 53012.use or 53013.use or 53014.use or 53016.use begin
            local pet_info = pet_system.get_pet_info(item.vnum)
            if null != pet_info then
                local mobVnum = pet_info[1]
                local petName = pet_info[2]
                local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[3])
                if true == pet.is_summon(mobVnum) then
                    if spawn_effect_file_name != nil then
                        pet.spawn_effect (mobVnum, spawn_effect_file_name)
                    end
                    pet.unsummon(mobVnum)
                else
                    if pet.count_summoned() < 1 or pc.is_gm() then
                        pet.summon(mobVnum, " ".. petName, false)
                        pc.setqf("summoned_pet", mobVnum)
                        pc.setqf("pet_name", petName)
                    else
                        syschat("Too much pets.")
                    end
                    if spawn_effect_file_name != nil then
                        pet.spawn_effect(mobVnum, spawn_effect_file_name)
                    end
                end
            end
        end

 

replace with this

Link to comment
Share on other sites

16 minutes ago, Frozen said:

 


when login with pc.getqf("summoned_pet") > 0 begin
            pet.summon(pc.getqf("summoned_pet"), pc.getqf("pet_name"), false)
        end
        when 53001.use or 53002.use or 53003.use or 53005.use or 53006.use or 53007.use or 53008.use or 53009.use or 53010.use or 53011.use or 53012.use or 53013.use or 53014.use or 53016.use begin
            local pet_info = pet_system.get_pet_info(item.vnum)
            if null != pet_info then
                local mobVnum = pet_info[1]
                local petName = pet_info[2]
                local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[3])
                if true == pet.is_summon(mobVnum) then
                    if spawn_effect_file_name != nil then
                        pet.spawn_effect (mobVnum, spawn_effect_file_name)
                    end
                    pet.unsummon(mobVnum)
                else
                    if pet.count_summoned() < 1 or pc.is_gm() then
                        pet.summon(mobVnum, " ".. petName, false)
                        pc.setqf("summoned_pet", mobVnum)
                        pc.setqf("pet_name", petName)
                    else
                        syschat("Too much pets.")
                    end
                    if spawn_effect_file_name != nil then
                        pet.spawn_effect(mobVnum, spawn_effect_file_name)
                    end
                end
            end
        end


 

replace with this

Don't work. Error: https://metin2.download/picture/DGotS2uFv0Wym1abUpl9VdAXV4K6UH6X/.png

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

1 hour ago, avertuss said:

There it is: http://pastebin.com/raw/REz4Ni8r

Hope it works now.

@Frozen made a mistake with pc.getqf not pc.setqf (  pc.getqf('summoned', 1) ), and he tried to save pet_name in quest value which storage only INT not STRING.

This is simple quest with constant pet names, you can of course change names by mysql etc.

Link to comment
Share on other sites

5 hours ago, kodepiko said:

There it is: http://pastebin.com/raw/REz4Ni8r

Hope it works now.

@Frozen made a mistake with pc.getqf not pc.setqf (  pc.getqf('summoned', 1) ), and he tried to save pet_name in quest value which storage only INT not STRING.

This is simple quest with constant pet names, you can of course change names by mysql etc.

Not working ;/

Link to comment
Share on other sites

try this, im not sure it will work:

Spoiler



quest pet_system begin
    state start begin
        function get_pet_info(itemVnum)
            pet_info_map = {
                [53001] = {34033, "pet1", 0},
                [53002] = {34031, "pet2", 0},
                [53003] = {34003, "pet3", 0},
                [53005] = {34004, "pet4", 1},
                [53006] = {34009, "pet5", 1},
                [53007] = {34010, "pet6", 0},
                [53008] = {34011, "pet7", 0},
                [53009] = {34012, "pet8", 0},
                [53010] = {34008, "pet9", 0},
                [53011] = {34007, "pet10", 0},
                [53012] = {34005, "pet11", 0},
                [53013] = {34006, "pet12", 0},
                [53014] = {34031, "pet13", 0},
                [53016] = {34033, "pet14", 0},
            }
            itemVnum = tonumber(itemVnum)
            return pet_info_map[itemVnum]
        end
        function get_spawn_effect_file(idx)
            effect_table = {
                [0] = nil,
                [1] = "d:\\\\ymir work\\\\effect\\\\etc\\\\appear_die\\\\npc2_appear.mse",
            }
            return effect_table [idx]
        end
        when login with pc.getqf('summoned') > 0 begin
            timer('pet_time', 15)
        end
        when 53001.use or 53002.use or 53003.use or 53005.use or 53006.use or 53007.use or 53008.use or 53009.use or 53010.use or 53011.use or 53012.use or 53013.use or 53014.use or 53016.use begin
            local pet_info = pet_system.get_pet_info(item.vnum)
            if null != pet_info then
                local mobVnum = pet_info[1]
                local petName = pet_info[2]
                local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[3])
                if true == pet.is_summon(mobVnum) then
                    if spawn_effect_file_name != nil then
                        pet.spawn_effect (mobVnum, spawn_effect_file_name)
                    end
                    pet.unsummon(mobVnum)
                else
                    if pet.count_summoned() < 1 or pc.is_gm() then
                        pet.summon(mobVnum, " ".. petName, false)
                        pc.setqf('summoned_pet', mobVnum)
                        pc.setqf('pet_name', petName)
                        pc.getqf('summoned', 1)
                    else
                        syschat("Too much pets.")
                    end
                    if spawn_effect_file_name != nil then
                        pet.spawn_effect(mobVnum, spawn_effect_file_name)
                    end
                end
            end
        end

        when pet_time.timer begin
            pet.summon(pc.getqf('summoned_pet'), pc.getqf('pet_name'), false)
        end
    end
end

 


 

 

Link to comment
Share on other sites

If I were you I wont do this, why? Think about all possbile scenarios, for expample I call the PET then I give it to my friend, my pet is unsummoned from source, but then when I will teleport, pof my pet is back and I dont even have the seal. If you want to do this I suggest you to make it from source, mabe some ch->SetFlag quest flag to 0 when the pet is unsommoned from source.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / 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.