overcloak 0 Report post Posted February 26, 2019 Anyone could help me, I would like a npc script that at a certain level the jogardor can reset the char to level 1, so he can climb to the maximum level again to gain more points. If anyone has this script and can pass me I thank. Quote Share this post Link to post Share on other sites
mkhzaleh 132 Report post Posted February 27, 2019 (edited) try this function res(cha) local ap = GetChaAttr( cha , ATTR_AP ) ap = 4 --- points local lvl = Lv(cha) if lvl == 85 then --level who can reset local cha_lv = GetChaAttr(cha, ATTR_LV) local cha_str = GetChaAttr(cha, ATTR_BSTR ) local cha_dex = GetChaAttr(cha, ATTR_BDEX ) local cha_agi = GetChaAttr(cha, ATTR_BAGI ) local cha_con = GetChaAttr(cha, ATTR_BCON ) local cha_sta = GetChaAttr(cha, ATTR_BSTA ) for i,v in pairs({ATTR_BSTR ,ATTR_BDEX ,ATTR_BAGI ,ATTR_BCON ,ATTR_BSTA}) do SyncChar(cha,4) SetChaAttr(cha, v ,5 ) end SyncChar(cha,4) SetChaAttr(cha, ATTR_CEXP,0 ) SyncChar(cha,4) SetChaAttr(cha, ATTR_LV,1 ) --reset lvl to 1 SyncChar(cha,4) ---reset hp/sp-- hp = GetChaAttr( cha, ATTR_MXHP ) SyncChar(cha,4) sp = GetChaAttr( cha, ATTR_MXSP ) SyncChar(cha,4) SetCharaAttr( hp, cha, ATTR_HP ) SyncChar(cha,4) SetCharaAttr( sp, cha, ATTR_SP ) SyncChar(cha,4) SetCharaAttr( ap, cha, ATTR_AP ) SyncChar(cha,4) ---reset skills point--- SkillReset(cha) SetChaAttr(cha, ATTR_TP, 0) SetChaAttr(cha, ATTR_JOB, 0) RefreshCha( cha ) else SystemNotice(role,"Your level too low for reset you need lv ["..lvl.."] ") return end end Edited February 27, 2019 by mkhzaleh Quote Share this post Link to post Share on other sites
iZae 55 Report post Posted February 27, 2019 That function doesn't add bonus ap per reset and doesn't take in consideration if the character has rebirth skills (just reset all skills). My suggestions: Save somewhere how many resets the char has done (luasql, unused attrs, serialize) Reset to lv 1 and give the starting 4 attribute points + bonus per reset Set a condition to check if the player has nothing equipped before the reset (otherwise imagine a lv 1 newbie with forged death set) Check if the player has Rebirthed before the reset, and add a "rebirth skill book" that checks the class once is lv 41+ and adds the correct rebirth skill and rebirth lvl. Quote Share this post Link to post Share on other sites
mkhzaleh 132 Report post Posted February 27, 2019 35 minutes ago, iZae said: That function doesn't add bonus ap per reset and doesn't take in consideration if the character has rebirth skills (just reset all skills). My suggestions: Save somewhere how many resets the char has done (luasql, unused attrs, serialize) Reset to lv 1 and give the starting 4 attribute points + bonus per reset Set a condition to check if the player has nothing equipped before the reset (otherwise imagine a lv 1 newbie with forged death set) Check if the player has Rebirthed before the reset, and add a "rebirth skill book" that checks the class once is lv 41+ and adds the correct rebirth skill and rebirth lvl. hey!~ i just gave the main idea , Check if the player has Rebirthed before the reset, and add a "rebirth skill book" u have to put this inside ur function . lua function SkillReset(Player) local Skills = {{0453, 0}, {0454, 0}, {0455, 0}, {0456, 0}, {0457, 0}, {0458, 0}, {0459, 0}, {0256, 0}, {0255,0}, {0467,0} } local Points = 0 for A = 1, table.getn(Skills), 1 do Skills[A][2] = GetSkillLv(Player, Skills[A][1]) Points = Points - Skills[A][2] end Points = Points + GetChaAttr(Player, ATTR_TP) Points = Points + ClearFightSkill(Player) if Points >= 200 then Points = 200 end for B = 1, table.getn(Skills), 1 do if Skills[B][2] ~= 0 then AddChaSkill(Player, Skills[B][1], Skills[B][2], Skills[B][2], 0) end end SetChaAttr(Player, ATTR_TP, Points) RefreshCha(Player) end Quote Set a condition to check if the player has nothing equipped before the reset (otherwise imagine a lv 1 newbie with forged death set) use something like this if IsEquip(role) == LUA_TRUE then SystemNotice(role, "You must remove your equipment!") return end Quote Save somewhere how many resets the char has done (luasql, unused attrs, serialize) you can use table.save /table.load after player use this function and check if he did it before or not Quote Reset to lv 1 and give the starting 4 attribute points + bonus per reset u can put rule for "ap = 4 --- points " + how many charterer done it Quote Share this post Link to post Share on other sites
iZae 55 Report post Posted February 27, 2019 Amazing! I just like the idea of giving suggestions instead of making it for other people. Thanks for your effort 1 Quote Share this post Link to post Share on other sites