crossworld Posted December 15, 2018 Posted December 15, 2018 Hey guys, Can someone help me figure this out... I want to make a consumable, a healing potion only usable between certain levels. For example I only want a character base level 15 - 50 able to use the healing potion. Is this possible if so please tell. Thanks Quote
1 Emistry Posted January 9, 2019 Posted January 9, 2019 501,Red_Potion,Red Potion,0,50,,70,,,,,0xFFFFFFFF,63,2,,,15:50,,,{ itemheal rand(45,65),0; },{},{} // Structure of Database: // ID,AegisName,Name,Type,Buy,Sell,Weight,ATK[:MATK],DEF,Range,Slots,Job,Class,Gender,Loc,wLV,eLV[:maxLevel],Refineable,View,{ Script },{ OnEquip_Script },{ OnUnequip_Script } use the field eLV[:maxLevel] 1 Quote
0 LearningRO Posted December 15, 2018 Posted December 15, 2018 if (BaseLevel <100) { percentheal 25,25; } Quote
0 Rizta Posted December 15, 2018 Posted December 15, 2018 (edited) only usable between those levels i think its impossible, but, following what @melv0 told you can use script to make the effect work between 15-50. In item db you can set a EquipLevel on potion that means you can only can use if are at least on EquipLevel value level. if(BaseLevel >= 15 && BaseLevel <= 50) { percentheal xx,yy; /* this will heal xx(hp) and yy(sp) by %*/ itemheal rand(aa,bb),rand(cc,dd); /*this will heal by a fixed value or rand value between aa and bb for HP and cc and dd for SP */ } Edited December 15, 2018 by Rizta Quote
0 crossworld Posted December 17, 2018 Author Posted December 17, 2018 On 12/15/2018 at 3:54 AM, Rizta said: only usable between those levels i think its impossible, but, following what @melv0 told you can use script to make the effect work between 15-50. In item db you can set a EquipLevel on potion that means you can only can use if are at least on EquipLevel value level. if(BaseLevel >= 15 && BaseLevel <= 50) { percentheal xx,yy; /* this will heal xx(hp) and yy(sp) by %*/ itemheal rand(aa,bb),rand(cc,dd); /*this will heal by a fixed value or rand value between aa and bb for HP and cc and dd for SP */ } Hey rizta, your method works great but one thing we noticed when testing is if you aren't within the the specified level and you try to use the item the item is consumed. Is there a way to make it so it's not consumed when you don't meet the requirements to use the item? Quote
0 Rizta Posted December 18, 2018 Posted December 18, 2018 5 hours ago, crossworld said: Hey rizta, your method works great but one thing we noticed when testing is if you aren't within the the specified level and you try to use the item the item is consumed. Is there a way to make it so it's not consumed when you don't meet the requirements to use the item? as i said, theres some limitations of what you can do... one possible solution is create another conditional(in the example i give above, simple add an ELSE) that restore the item if user dont match the requirements to receive the bonus, using getitem on script. Quote
0 LearningRO Posted December 18, 2018 Posted December 18, 2018 6 hours ago, crossworld said: Hey rizta, your method works great but one thing we noticed when testing is if you aren't within the the specified level and you try to use the item the item is consumed. Is there a way to make it so it's not consumed when you don't meet the requirements to use the item? just add if(BaseLevel >= 15 && BaseLevel <= 50) { percentheal xx,yy;} else { getitem itemid,1; } Quote
-1 AnnieRuru Posted January 9, 2019 Posted January 9, 2019 (edited) let me have some fun do some source coding ~ src/map/pc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 6f651eff3..72b34137b 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -5040,6 +5040,9 @@ int pc_useitem(struct map_session_data *sd,int n) return 0;/* regardless, effect is not run */ } + if ( id->type == IT_HEALING && sd->status.base_level >= 15 && sd->status.base_level <= 50 ) + return 0; + sd->itemid = item.nameid; sd->itemindex = n; if(sd->catch_target_class != PET_CATCH_FAIL) //Abort pet catching. if you mean not restricting for whole item type, but only 1 item ID, then change if ( id->type == IT_HEALING ) into if ( item.nameid == <item ID> ) ========================= EDIT: - Emistry answer is correct Edited January 9, 2019 by AnnieRuru Quote
Question
crossworld
Hey guys,
Can someone help me figure this out... I want to make a consumable, a healing potion only usable between certain levels. For example I only want a character base level 15 - 50 able to use the healing potion. Is this possible if so please tell.
Thanks
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.