Natta 2 Report post Posted May 6, 2018 Hello! I have 2 questions which i hope someone can help me with. The first issue is that my HP/SP recovery is bugged so if the character dies it doesn't recover by sitting or standing, does anyone know which files to look at so i can fix this issue? The second issue is that i can't make PvP invites for my map, i guess its under teampk map in rescources either under ctrl.lua or entry but it doesn't matter how much i try to change in these files it just doesn't work so maybe im missing something Thanks Quote Share this post Link to post Share on other sites
AlGhoul 66 Report post Posted May 6, 2018 scripts related to hp/sp recovery are cha_timer / resume. while cha_timer inside functions.lua & resume inside AttrCalculate.lua you may have messed up with cha_timer. and for pvp invitations, you have to define invitations areas with yammi tool. check out this guide: function cha_timer(role, freq, time) local resume_freq = 5 local now_tick = GetChaParam(role, 1) local is_role_living = -1 SetChaParam(role, 1, now_tick + freq * time) if math.mod(now_tick, resume_freq) == 0 and now_tick > 0 then JianYuKa(role ,now_tick) ZhongShenTaoZhuang(role,now_tick) if is_role_living == -1 then is_role_living = IsChaLiving(role) end if is_role_living == 1 then Resume(role) end end function Resume ( role ) local role_type = ChaIsBoat ( role ) local srec = GetChaAttr ( role , ATTR_SREC ) local sp = GetChaAttr ( role , ATTR_SP ) local mxsp = GetChaAttr ( role , ATTR_MXSP ) local hrec = GetChaAttr ( role , ATTR_HREC ) if hrec < 0 then LG ( "resume_err" , "role = " , GetChaName (role) , "HP recovery rate lower than 0" ) LG ( "resume_err" , "role_hrec_statec = " , GetChaAttr ( role , ATTR_STATEC_HREC) , "role_hrec_statev = ", GetChaAttr ( role , ATTR_STATEV_HREC) ) LG ( "luascript_err" , "function Resume: character HP recovery rate less than 0" ) return end local hp = GetChaAttr ( role , ATTR_HP ) local mxhp = GetChaAttr ( role , ATTR_MXHP ) if role_type == 1 then --船只resume --Rem_State_NOSEA ( role ) -- SystemNotice (role,"enter ship recover") if hp <= 0 then LG ( "luascript_err" , "function Resume: Character in dead status" ) return end cha_role = GetMainCha ( role ) if sp <= 0 then BickerNotice ( role , "No more fuel! The ship is being damaged every moment! Get to the nearest Harbor now!" ) hrec = hrec - 0.025 * mxhp srec = 0 end sp = math.max ( 0 , sp - srec ) hp = math.min ( mxhp , hp + hrec ) local ship_lv = GetChaAttr ( role , ATTR_LV ) local ship_exp = GetChaAttr ( role , ATTR_CEXP ) local boatexpup_count = GetBoatCtrlTick ( role ) if ( boatexpup_count - math.floor ( boatexpup_count / 5 ) * 5 ) == 4 then a = 1 else a = 0 end boatexpup_count = boatexpup_count + 1 if boatexpup_count >= 500 then boatexpup_count = 0 end SetBoatCtrlTick ( role , boatexpup_count ) -- SetAttrChangeFlag( role) if ship_lv <= 30 and ship_exp <= 1000 then -- if ship_lv <= 50 and ship_exp <= 1000 then -- SystemNotice (role,"enter ship expup") if a == 1 then -- SystemNotice (role,"ship_expadd = " ..ship_expadd) -- SystemNotice (role,"ship_exp = " ..ship_exp) local ship_expadd = math.floor ( math.random ( 1, 3 ) + math.max ( 0 , ( 2 - ship_lv /10 ) ) ) -- local ship_expadd = math.floor ( math.random ( 50, 150 ) ) ship_exp = ship_exp + ship_expadd -- SystemNotice (role,"after resume ship_exp = " ..ship_exp) SystemNotice (role,"Ship EXP gained:" ..ship_expadd) SetCharaAttr (ship_exp ,role , ATTR_CEXP ) -- ship_exp = GetChaAttr ( role , ATTR_CEXP ) -- SystemNotice (role,"1 after resume ship_exp = " ..ship_exp) end end -- cha_hp = math.min ( Mxhp ( cha_role ) , Hp ( cha_role ) + Hrec ( cha_role ) ) cha_sp = math.min ( Mxsp ( cha_role ) , Sp ( cha_role ) + Srec ( cha_role ) ) SetCharaAttr ( sp , role , ATTR_SP ) SetCharaAttr ( hp , role , ATTR_HP ) -- SetCharaAttr ( cha_hp , cha_role , ATTR_HP ) SetCharaAttr ( cha_sp , cha_role , ATTR_SP ) -- SyncBoat ( role, 4 ) else if hp <= 0 then LG ( "luascript_err" , "function Resume: Character in dead status" ) return end local Elf_SkillHpResume = 0 local Elf_SkillSpResume = 0 if mxhp ~= hp then Elf_SkillHpResume = ElfSkill_HpResume ( role ) end if mxsp ~= sp then Elf_SkillSpResume = ElfSkill_SpResume ( role ) end hrec = hrec + Elf_SkillHpResume srec = srec + Elf_SkillSpResume sp = math.min ( mxsp , sp + srec ) hp = math.min ( mxhp , hp + hrec ) SetCharaAttr ( hp , role , ATTR_HP ) SetCharaAttr ( sp , role , ATTR_SP ) end end Quote Kind regards, AG. Share this post Link to post Share on other sites
Natta 2 Report post Posted May 6, 2018 @J0k3r Thank you for your reply! I will fix my HP/SP recovery that way. Regarding the PvP invites I did use the YAMMI tool aswell before, and I marked the whole city with the tool but when I saved it and restarted everything it didn't work so I thought it could be the scripts in the teampk map. Quote Share this post Link to post Share on other sites
Natta 2 Report post Posted May 6, 2018 Hmm and about the cha_timer / function resume scripts everything seems to look as it should there so I have no clue why it didn't fix the issue. Quote Share this post Link to post Share on other sites
x3w0r 33 Report post Posted May 6, 2018 47 minutes ago, Natta said: Hmm and about the cha_timer / function resume scripts everything seems to look as it should there so I have no clue why it didn't fix the issue. There's an error at your cha_timer, please provide us with your full codes + the error log. Quote Share this post Link to post Share on other sites
Natta 2 Report post Posted May 6, 2018 @x3w0r I can send them here as soon as I get home, but what I did was that I took the scripts @J0k3r wrote here and replaced them to see if it would make any difference. Quote Share this post Link to post Share on other sites
V3ct0r 2,117 Report post Posted May 6, 2018 3 hours ago, Natta said: @J0k3r Thank you for your reply! I will fix my HP/SP recovery that way. Regarding the PvP invites I did use the YAMMI tool aswell before, and I marked the whole city with the tool but when I saved it and restarted everything it didn't work so I thought it could be the scripts in the teampk map. Did you update map files (.ATR) on the server side? Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites
Natta 2 Report post Posted May 6, 2018 @V3ct0r Not instantly but when I changed some other stuff in my map I updated the blk and atr but I'm gonna do it again in case since I'm not sure, thank you for your reply! Quote Share this post Link to post Share on other sites
Natta 2 Report post Posted May 6, 2018 @V3ct0r I re-marked the PvP spot on the map and updated the atr file and it worked! Thank you alot Quote Share this post Link to post Share on other sites
Natta 2 Report post Posted May 6, 2018 @x3w0r Regarding my cha_timer and function resume this is how it looks like: function cha_timer(role, freq, time) local resume_freq = 5 local now_tick = GetChaParam(role, 1) local is_role_living = -1 SetChaParam(role, 1, now_tick + freq * time) if math.mod(now_tick, resume_freq) == 0 and now_tick > 0 then JianYuKa(role ,now_tick) ZhongShenTaoZhuang(role,now_tick) if is_role_living == -1 then is_role_living = IsChaLiving(role) end if is_role_living == 1 then Resume(role) end end --------------------------------------------------------------------------------------------------------- function Resume ( role ) local role_type = ChaIsBoat ( role ) local srec = GetChaAttr ( role , ATTR_SREC ) local sp = GetChaAttr ( role , ATTR_SP ) local mxsp = GetChaAttr ( role , ATTR_MXSP ) local hrec = GetChaAttr ( role , ATTR_HREC ) if hrec < 0 then LG ( "resume_err" , "role = " , GetChaName (role) , "HP recovery rate lower than 0" ) LG ( "resume_err" , "role_hrec_statec = " , GetChaAttr ( role , ATTR_STATEC_HREC) , "role_hrec_statev = ", GetChaAttr ( role , ATTR_STATEV_HREC) ) LG ( "luascript_err" , "function Resume: character HP recovery rate less than 0" ) return end local hp = GetChaAttr ( role , ATTR_HP ) local mxhp = GetChaAttr ( role , ATTR_MXHP ) if role_type == 1 then --船只resume --Rem_State_NOSEA ( role ) -- SystemNotice (role,"enter ship recover") if hp <= 0 then LG ( "luascript_err" , "function Resume: Character in dead status" ) return end cha_role = GetMainCha ( role ) if sp <= 0 then BickerNotice ( role , "No more fuel! The ship is being damaged every moment! Get to the nearest Harbor now!" ) hrec = hrec - 0.025 * mxhp srec = 0 end sp = math.max ( 0 , sp - srec ) hp = math.min ( mxhp , hp + hrec ) local ship_lv = GetChaAttr ( role , ATTR_LV ) local ship_exp = GetChaAttr ( role , ATTR_CEXP ) local boatexpup_count = GetBoatCtrlTick ( role ) if ( boatexpup_count - math.floor ( boatexpup_count / 5 ) * 5 ) == 4 then a = 1 else a = 0 end boatexpup_count = boatexpup_count + 1 if boatexpup_count >= 500 then boatexpup_count = 0 end SetBoatCtrlTick ( role , boatexpup_count ) -- SetAttrChangeFlag( role) if ship_lv <= 30 and ship_exp <= 1000 then -- if ship_lv <= 50 and ship_exp <= 1000 then -- SystemNotice (role,"enter ship expup") if a == 1 then -- SystemNotice (role,"ship_expadd = " ..ship_expadd) -- SystemNotice (role,"ship_exp = " ..ship_exp) local ship_expadd = math.floor ( math.random ( 1, 3 ) + math.max ( 0 , ( 2 - ship_lv /10 ) ) ) -- local ship_expadd = math.floor ( math.random ( 50, 150 ) ) ship_exp = ship_exp + ship_expadd -- SystemNotice (role,"after resume ship_exp = " ..ship_exp) SystemNotice (role,"Ship EXP gained:" ..ship_expadd) SetCharaAttr (ship_exp ,role , ATTR_CEXP ) -- ship_exp = GetChaAttr ( role , ATTR_CEXP ) -- SystemNotice (role,"1 after resume ship_exp = " ..ship_exp) end end -- cha_hp = math.min ( Mxhp ( cha_role ) , Hp ( cha_role ) + Hrec ( cha_role ) ) cha_sp = math.min ( Mxsp ( cha_role ) , Sp ( cha_role ) + Srec ( cha_role ) ) SetCharaAttr ( sp , role , ATTR_SP ) SetCharaAttr ( hp , role , ATTR_HP ) -- SetCharaAttr ( cha_hp , cha_role , ATTR_HP ) SetCharaAttr ( cha_sp , cha_role , ATTR_SP ) -- SyncBoat ( role, 4 ) else if hp <= 0 then LG ( "luascript_err" , "function Resume: Character in dead status" ) return end local Elf_SkillHpResume = 0 local Elf_SkillSpResume = 0 if mxhp ~= hp then Elf_SkillHpResume = ElfSkill_HpResume ( role ) end if mxsp ~= sp then Elf_SkillSpResume = ElfSkill_SpResume ( role ) end hrec = hrec + Elf_SkillHpResume srec = srec + Elf_SkillSpResume sp = math.min ( mxsp , sp + srec ) hp = math.min ( mxhp , hp + hrec ) SetCharaAttr ( hp , role , ATTR_HP ) SetCharaAttr ( sp , role , ATTR_SP ) end end Quote Share this post Link to post Share on other sites
x3w0r 33 Report post Posted May 6, 2018 I need the error from lua_err log file if something happened on it. Quote Share this post Link to post Share on other sites