OldHero 12 Report post Posted February 5, 2017 Hello may i ask do someone have remove effect stone so example if i put kylin set and this set have bbring eff and if i put this stone in inventory any slot bbring eff remove hm??? Quote Share this post Link to post Share on other sites
Methz 2 Report post Posted February 5, 2017 16 hours ago, OldHero said: Hello may i ask do someone have remove effect stone so example if i put kylin set and this set have bbring eff and if i put this stone in inventory any slot bbring eff remove hm??? Try this: Change all of your Glow 85 function (search for cha_timer in functions.lua) to this: -- Glow 85 with Remove Effect Stone local Dina_xl = GetEquipItemP(role,8) local Dina_xl_ID= GetItemID (Dina_xl) local Dina_x2 = GetEquipItemP(role,2) local Dina_x2_ID= GetItemID (Dina_x2) local check_stone = CheckBagItem(role, xxxx) -- Put the Stone ID if Dina_xl_ID==2577 and Dina_x2_ID==2817 then if check_stone >= 1 then RemoveEffectStone(role) else local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING1 , statelv , statetime ) end elseif Dina_xl_ID==2578 and Dina_x2_ID==2820 then if check_stone >= 1 then RemoveEffectStone(role) else local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING2 , statelv , statetime ) end AddState ( role , role , STATE_BBRING2 , statelv , statetime ) elseif Dina_xl_ID==2579 and Dina_x2_ID==2823 then if check_stone >= 1 then RemoveEffectStone(role) else local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING3 , statelv , statetime ) elseif Dina_xl_ID==2580 and Dina_x2_ID==2826 then if check_stone >= 1 then RemoveEffectStone(role) else local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING4 , statelv , statetime ) elseif Dina_xl_ID==2581 and Dina_x2_ID==2832 then if check_stone >= 1 then RemoveEffectStone(role) else local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING5 , statelv , statetime ) elseif Dina_xl_ID==2582 and Dina_x2_ID==2829 then if check_stone >= 1 then RemoveEffectStone(role) else local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING6 , statelv , statetime ) else local statelv_bbring1 = GetChaStateLv ( role , STATE_BBRING1 ) if statelv_bbring1~=0 then RemoveState ( role , STATE_BBRING1 ) end local statelv_bbring2 = GetChaStateLv ( role , STATE_BBRING2 ) if statelv_bbring2~=0 then RemoveState ( role , STATE_BBRING2 ) end local statelv_bbring3 = GetChaStateLv ( role , STATE_BBRING3 ) if statelv_bbring3~=0 then RemoveState ( role , STATE_BBRING3 ) end local statelv_bbring4 = GetChaStateLv ( role , STATE_BBRING4 ) if statelv_bbring4~=0 then RemoveState ( role , STATE_BBRING4 ) end local statelv_bbring5 = GetChaStateLv ( role , STATE_BBRING5 ) if statelv_bbring5~=0 then RemoveState ( role , STATE_BBRING5 ) end local statelv_bbring6 = GetChaStateLv ( role , STATE_BBRING6 ) if statelv_bbring6~=0 then RemoveState ( role , STATE_BBRING6 ) end end Add in the end of functions.lua: function RemoveEffectStone(role) local statelv_bbring1 = GetChaStateLv ( role , STATE_BBRING1 ) if statelv_bbring1~=0 then RemoveState ( role , STATE_BBRING1 ) end local statelv_bbring2 = GetChaStateLv ( role , STATE_BBRING2 ) if statelv_bbring2~=0 then RemoveState ( role , STATE_BBRING2 ) end local statelv_bbring3 = GetChaStateLv ( role , STATE_BBRING3 ) if statelv_bbring3~=0 then RemoveState ( role , STATE_BBRING3 ) end local statelv_bbring4 = GetChaStateLv ( role , STATE_BBRING4 ) if statelv_bbring4~=0 then RemoveState ( role , STATE_BBRING4 ) end local statelv_bbring5 = GetChaStateLv ( role , STATE_BBRING5 ) if statelv_bbring5~=0 then RemoveState ( role , STATE_BBRING5 ) end local statelv_bbring6 = GetChaStateLv ( role , STATE_BBRING6 ) if statelv_bbring6~=0 then RemoveState ( role , STATE_BBRING6 ) end end Quote “So the problem is not so much to see what nobody has yet seen, as to think what nobody has yet thought concerning that which everybody sees.” ― Arthur Schopenhauer Share this post Link to post Share on other sites
OldHero 12 Report post Posted February 5, 2017 Ty you ill test tomorrow Quote Share this post Link to post Share on other sites
Methz 2 Report post Posted February 6, 2017 4 hours ago, OldHero said: Ty you ill test tomorrow If you don't understand something, let me know Quote “So the problem is not so much to see what nobody has yet seen, as to think what nobody has yet thought concerning that which everybody sees.” ― Arthur Schopenhauer Share this post Link to post Share on other sites
Angelix 374 Report post Posted February 6, 2017 1 hour ago, Methz said: If you don't understand something, let me know You know it was easier to just add two lines of code instead of writing everything and making a new function? Hahah Since I'm in mobile I can't use code tags, but it would be like this: * Check if character has the item. * If the character doesn't, then continue checking for equipment. * If character has all equipment necessary, then apply effects. Quote Share this post Link to post Share on other sites
Methz 2 Report post Posted February 6, 2017 44 minutes ago, Angelix said: You know it was easier to just add two lines of code instead of writing everything and making a new function? Hahah Since I'm in mobile I can't use code tags, but it would be like this: * Check if character has the item. * If the character doesn't, then continue checking for equipment. * If character has all equipment necessary, then apply effects. Did you meant like this? -- Glow 85 with Remove Effect Stone local Dina_xl = GetEquipItemP(role,8) local Dina_xl_ID= GetItemID (Dina_xl) local Dina_x2 = GetEquipItemP(role,2) local Dina_x2_ID= GetItemID (Dina_x2) local check_stone = CheckBagItem(role, xxxx) --- Angelix line 1 if check_stone < 1 then --- Angelix line 2 if Dina_xl_ID==2577 and Dina_x2_ID==2817 then local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING1 , statelv , statetime ) elseif Dina_xl_ID==2578 and Dina_x2_ID==2820 then local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING2 , statelv , statetime ) elseif Dina_xl_ID==2579 and Dina_x2_ID==2823 then local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING3 , statelv , statetime ) elseif Dina_xl_ID==2580 and Dina_x2_ID==2826 then local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING4 , statelv , statetime ) elseif Dina_xl_ID==2581 and Dina_x2_ID==2832 then local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING5 , statelv , statetime ) elseif Dina_xl_ID==2582 and Dina_x2_ID==2829 then local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING6 , statelv , statetime ) end else local statelv_bbring1 = GetChaStateLv ( role , STATE_BBRING1 ) if statelv_bbring1~=0 then RemoveState ( role , STATE_BBRING1 ) end local statelv_bbring2 = GetChaStateLv ( role , STATE_BBRING2 ) if statelv_bbring2~=0 then RemoveState ( role , STATE_BBRING2 ) end local statelv_bbring3 = GetChaStateLv ( role , STATE_BBRING3 ) if statelv_bbring3~=0 then RemoveState ( role , STATE_BBRING3 ) end local statelv_bbring4 = GetChaStateLv ( role , STATE_BBRING4 ) if statelv_bbring4~=0 then RemoveState ( role , STATE_BBRING4 ) end local statelv_bbring5 = GetChaStateLv ( role , STATE_BBRING5 ) if statelv_bbring5~=0 then RemoveState ( role , STATE_BBRING5 ) end local statelv_bbring6 = GetChaStateLv ( role , STATE_BBRING6 ) if statelv_bbring6~=0 then RemoveState ( role , STATE_BBRING6 ) end end ---Glow 85 End If so, there's a bug. When you take out the armor or the ring, the effect will still on (unless you relog or switch the character) If not, show me the code, please. I'm very noob with programming for now, need to practice :x Quote “So the problem is not so much to see what nobody has yet seen, as to think what nobody has yet thought concerning that which everybody sees.” ― Arthur Schopenhauer Share this post Link to post Share on other sites
Angelix 374 Report post Posted February 6, 2017 @Methz in theory, that script should be right because it will always check first if you have the stone, if you do have it then it won't let you go through the rest of the requirements in order to add the effect, but if you don't, it will then proceed to check if you have the necessary equipment to see if it can add the effect or not. Since you're looking to learn and make things a bit nicer looking and easier, some time ago I shared some of my scripts that go hand in hand with the equipment effects and are easier to handle/adjust. Take a look at this thread, I'll someday add those to the "Simple Functions" thread I made, in the meantime, you can PM if have questions about those. An example of using those functions from that thread would be: if Set_KylinEquipment(Player) == 1 then if math.random(1, 100) <= 10 then -- <CODE_HERE> end elseif Set_KylinEquipment(Player) == 0 then -- <CODE_HERE> end Which by removing that randomness, you can add/remove effects. The biggest functions checks to all equipment if stated (are not declared zero) when called by the smaller functions. Looks cleaner and you don't have to repeat yourself every time when trying to add new effects based on equipment. Quote Share this post Link to post Share on other sites
Methz 2 Report post Posted February 6, 2017 @Angelix you're right, but in theory, this should not work, since it is necessary to develop a part of logic. The part necessary to verify if all the equipment is active AFTER entering the initial condition of the effect. Something like this: if check_stone < 1 then -- Checking if the player has the Remove Effect Stone if Dina_xl_ID==2577 and Dina_x2_ID==2817 then local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING1 , statelv , statetime ) else -- Checking if the player has all items local statelv_bbring1 = GetChaStateLv ( role , STATE_BBRING1 ) if statelv_bbring1~=0 then RemoveState ( role , STATE_BBRING1 ) end end I think this happens because we have two situations to remove the effect: player without all the items and player with the Remove Effect Stone. So we need to check these situations as well. Of course the above code is awful and not optimized at all, but it's just to show the logic I'm thinking. Do you have any suggestions optimized and that works? I mean, without adapting the script you created, hahaha. Btw, I really enjoyed your script, thanks for sharing. I just didn't understand the function of math.random at the end. It's only a option? Quote “So the problem is not so much to see what nobody has yet seen, as to think what nobody has yet thought concerning that which everybody sees.” ― Arthur Schopenhauer Share this post Link to post Share on other sites
Angelix 374 Report post Posted February 6, 2017 3 hours ago, Methz said: @Angelix you're right, but in theory, this should not work, since it is necessary to develop a part of logic. The part necessary to verify if all the equipment is active AFTER entering the initial condition of the effect. Something like this: if check_stone < 1 then -- Checking if the player has the Remove Effect Stone if Dina_xl_ID==2577 and Dina_x2_ID==2817 then local statelv = 1 local statetime = 3600 AddState ( role , role , STATE_BBRING1 , statelv , statetime ) else -- Checking if the player has all items local statelv_bbring1 = GetChaStateLv ( role , STATE_BBRING1 ) if statelv_bbring1~=0 then RemoveState ( role , STATE_BBRING1 ) end end I think this happens because we have two situations to remove the effect: player without all the items and player with the Remove Effect Stone. So we need to check these situations as well. Of course the above code is awful and not optimized at all, but it's just to show the logic I'm thinking. Do you have any suggestions optimized and that works? I mean, without adapting the script you created, hahaha. Btw, I really enjoyed your script, thanks for sharing. I just didn't understand the function of math.random at the end. It's only a option? My script were created for that purpose, to simplify the process of creating more effects for equipment. The randomness was place since in that thread they were talking about Kylin effect and it only has a 10% of activating. Quote Share this post Link to post Share on other sites
OldHero 12 Report post Posted February 7, 2017 @Methz Hello bro i tested and i always get on this line error elseif Dina_xl_ID==2579 and Dina_x2_ID==2823 then This----- if check_stone >= 1 then RemoveEffectStone(role) else Quote Share this post Link to post Share on other sites
Methz 2 Report post Posted February 9, 2017 On 06/02/2017 at 11:28 PM, OldHero said: @Methz Hello bro i tested and i always get on this line error elseif Dina_xl_ID==2579 and Dina_x2_ID==2823 then This----- if check_stone >= 1 then RemoveEffectStone(role) else Which code did you used? Show me all the code... Quote “So the problem is not so much to see what nobody has yet seen, as to think what nobody has yet thought concerning that which everybody sees.” ― Arthur Schopenhauer Share this post Link to post Share on other sites
OldHero 12 Report post Posted February 9, 2017 (edited) Bro this error i get when i just put ur script i dont even put some set.. Edited February 9, 2017 by OldHero Quote Share this post Link to post Share on other sites
Vasil 71 Report post Posted February 9, 2017 Try adding one more "end" after the codes and tell me Quote Share this post Link to post Share on other sites