Denis 1474 Posted May 19, 2014 Share Posted May 19, 2014 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Hello, Like the title says it's a pet system with level effect and experience. Spoiler quest pet_system begin state start begin function give_pet_exp(ammount) local pet_item = pc.getqf("pet_item") local pet_level = pc.getqf("pet_"..pet_item.."_level") local pet_exp = pc.getqf("pet_"..pet_item.."_exp") local exp_table = {100,200,300,400,500,600,700,800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,20000} local mobVnum = pet_system.get_pet_info(pet_item)[1] local MAX_LEVEL = 20 if pet_level <= MAX_LEVEL then if pet_exp > exp_table[pet_level] then pet.spawn_effect(mobVnum, "d:ymir workeffectetclevelup_1level_up.mse") pc.setqf("pet_"..pet_item.."_level",pet_level+1) pc.setqf("pet_"..pet_item.."_exp",1) syschat("Your pet has reached Level "..pet_level) else pc.setqf("pet_"..pet_item.."_exp",pet_exp+ammount) end end end function get_pet_info(itemVnum) pet_info_map = { [53001] = { 34001, gameforge.pet_system._010_say ,0}, [53002] = { 34002, gameforge.pet_system._020_say ,0}, [53003] = { 34003, gameforge.pet_system._040_say ,0}, [53005] = { 34004, gameforge.pet_system._050_say, 1}, [53006] = { 34009, gameforge.pet_system._050_say, 1}, [53010] = { 34008, gameforge.pet_system._060_say, 0}, [53011] = { 34007, gameforge.pet_system._070_say, 0}, [53012] = { 34005, gameforge.pet_system._080_say, 0}, [53013] = { 34006, gameforge.pet_system._090_say, 0}, [53007] = { 34010, gameforge.pet_system._100_say, 0}, [53008] = { 34011, gameforge.pet_system._110_say, 0}, [53009] = { 34012, gameforge.pet_system._120_say, 0}, [38200] = { 34006, gameforge.pet_system._090_say, 0}, [38201] = { 34006, gameforge.pet_system._090_say, 0}, [53014] = { 34013, gameforge.pet_system._130_say, 0}, [53015] = { 34014, gameforge.pet_system._140_say, 0}, [53016] = { 34015, gameforge.pet_system._150_say, 0}, [53017] = { 34016, gameforge.pet_system._160_say, 0}, } itemVnum = tonumber(itemVnum) return pet_info_map[itemVnum] end function get_spawn_effect_file(idx) effect_table = { [0] = nil, [1] = "d:ymir workeffectetcappear_dienpc2_appear.mse", } return effect_table [idx] end when 38200.use or 38201.use or 53007.use or 53013.use or 53012.use or 53011.use or 53010.use or 53006.use or 53005.use or 53002.use or 53001.use or 53003.use or 53008.use or 53009.use or 53014.use or 53015.use or 53016.use or 53017.use begin local pet_info = pet_system.get_pet_info(item.vnum) if pc.getqf("pet_"..item.vnum.."_exp") == 0 then pc.setqf("pet_"..item.vnum.."_exp",1) pc.setqf("pet_"..item.vnum.."_level",1) end pc.setqf("pet_item",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 then pet.summon(mobVnum, petName, false) else syschat(gameforge.pet_system._030_chat) end if spawn_effect_file_name != nil then pet.spawn_effect (mobVnum, spawn_effect_file_name) end end end end when kill with pet.count_summoned() == 1 and not npc.is_pc() begin local exp_give = number(1,40) local finnaly_exp = (pc.get_level() * exp_give / 10) * 2 pet_system.give_pet_exp(finnaly_exp) end end end If you want to change the max level just change this variable: local MAX_LEVEL = 20 But if you change the max level you have to edit the exp table too.For example I set local MAX_LEVEL = 25 so the exp table should looks like this: local exp_table = {100,200,300,400,500,600,700,800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500} for any bugs/problems feel free to ask... 32 1 1 1 14 1 2 36 Link to comment Share on other sites More sharing options...
HITRON 694 Posted May 19, 2014 Share Posted May 19, 2014 Nice system, but i have better:) 1 Link to comment Share on other sites More sharing options...
Denis 1474 Posted May 19, 2014 Author Share Posted May 19, 2014 This is only the base I have my own self made pet system,this is for those who don't know how to make with exp/level effect etc.. 1 Link to comment Share on other sites More sharing options...
HITRON 694 Posted May 19, 2014 Share Posted May 19, 2014 This is only the base I have my own self made pet system,this is for those who don't know how to make with exp/level effect etc.. Ok then:) have fun Link to comment Share on other sites More sharing options...
Sober 37 Posted May 19, 2014 Share Posted May 19, 2014 denic nice but bonus part is missing 1 Link to comment Share on other sites More sharing options...
Denis 1474 Posted May 19, 2014 Author Share Posted May 19, 2014 Just use the affect.add_collect / affct.remove_collect functions 1 Link to comment Share on other sites More sharing options...
Sober 37 Posted May 19, 2014 Share Posted May 19, 2014 yes but a noob can't do it so that as the level increases the bonus to increase, anyway leave it like that it's nice too, let the people that will take your stuff to do some work on their own. 1 Link to comment Share on other sites More sharing options...
Tacticus 73 Posted May 19, 2014 Share Posted May 19, 2014 Just use the affect.add_collect / affct.remove_collect functions where add?? can you do it and put here if is not problem?? thx Link to comment Share on other sites More sharing options...
Denis 1474 Posted May 19, 2014 Author Share Posted May 19, 2014 The affect.add_collect / affect.remove_collect are only the functions..Here is an example: local bonuses = { [1] = {apply.MAX_HP,5000,60*60*24}, [2] = {apply.MAX_HP,5500,60*60*24}, [3] = {apply.MAX_HP,6000,60*60*24}, [4] = {apply.MAX_HP,6500,60*60*24}, [5] = {apply.MAX_HP,7000,60*60*24}, } affect.add_collect(bonuses[pet_level][1],bonuses[pet_level][2],bonuses[pet_level][3]) When i'll have time i'll update the post to update the pet system with bonuses / level etc.. 1 Link to comment Share on other sites More sharing options...
HA MeCa 11 Posted May 19, 2014 Share Posted May 19, 2014 add gui to this and will be nice Link to comment Share on other sites More sharing options...
Tacticus 73 Posted May 19, 2014 Share Posted May 19, 2014 and what is different when is pet lvl1 and lvl 20? Link to comment Share on other sites More sharing options...
Denis 1474 Posted May 19, 2014 Author Share Posted May 19, 2014 There's no difference like I said it's a normal quest with some additions,but if you know lua you can make to receive for each level different bonuses Link to comment Share on other sites More sharing options...
Bot Metin2 Dev 4870 Posted May 19, 2014 Bot Share Posted May 19, 2014 Nice Link to comment Share on other sites More sharing options...
Management Karbust 4881 Posted May 28, 2014 Management Share Posted May 28, 2014 work with game 2089M??? thanks for share Link to comment Share on other sites More sharing options...
Denis 1474 Posted May 28, 2014 Author Share Posted May 28, 2014 No,it's works only with 34k + 1 Link to comment Share on other sites More sharing options...
Sober 37 Posted June 4, 2014 Share Posted June 4, 2014 local finnaly_exp = (pc.get_level() * exp_give / 10) * 2 change it a little bit because this means that as the level of the player increases the exp that the pet will get increases too.This is my expression: local finnaly_exp = math.floor((math.sqrt(npc.get_level()) * exp_give / 10) * 2) Link to comment Share on other sites More sharing options...
icaroquin 4 Posted June 4, 2014 Share Posted June 4, 2014 Someone could make a gui? 2 Link to comment Share on other sites More sharing options...
Premium Galet 509 Posted June 21, 2014 Premium Share Posted June 21, 2014 Work <3 But can you add level of pet before her name ? Link to comment Share on other sites More sharing options...
.iMac 0 Posted July 17, 2014 Share Posted July 17, 2014 Nice ! Link to comment Share on other sites More sharing options...
tristano98 6 Posted July 19, 2014 Share Posted July 19, 2014 work for 40k? Link to comment Share on other sites More sharing options...
Denis 1474 Posted July 19, 2014 Author Share Posted July 19, 2014 It works for 34k & 40k 1 Link to comment Share on other sites More sharing options...
newja 53 Posted August 5, 2014 Share Posted August 5, 2014 Hello @Denis! Your quest gives me no errors although it's not working (pets arent summoning). Any thoughts? Btw, really good job. I would like to use it, if you know what can be wrong please message me. Regards. Link to comment Share on other sites More sharing options...
Premium Juice 518 Posted August 6, 2014 Premium Share Posted August 6, 2014 Thanks for sharing! If you want that the level of the Pet is still the same even if its get a new owner, you can save the level in the socket of the item. 1 Link to comment Share on other sites More sharing options...
newja 53 Posted August 6, 2014 Share Posted August 6, 2014 Hello @Denis! Your quest gives me no errors although it's not working (pets arent summoning). Any thoughts? Btw, really good job. I would like to use it, if you know what can be wrong please message me. Regards. Everything's ok now. Once again thank you for the amazing work, it's really easy to edit which is why I find it very usefull. Link to comment Share on other sites More sharing options...
YukiPowa 5 Posted December 28, 2014 Share Posted December 28, 2014 Hi, I click on the familiar, it does not matter thx Link to comment Share on other sites More sharing options...
Recommended Posts