Jump to content
OldHero

Remove Effect stone

Recommended Posts

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??? 

Share this post


Link to post
Share on other sites
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

 


“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
4 hours ago, OldHero said:

Ty you ill test tomorrow :D

 

If you don't understand something, let me know 


“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
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. 

 

 

Share this post


Link to post
Share on other sites
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


“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

@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.

Share this post


Link to post
Share on other sites

@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?


“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
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. 

Share this post


Link to post
Share on other sites

@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

 

 

 

OVO.png

Share this post


Link to post
Share on other sites
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

 

 

 

OVO.png

 

Which code did you used? Show me all the code...


“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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...