Jump to content

[SOLVED] AntiExp Button


Recommended Posts

Hi all!

I followed the guide at that link about the connection between client and quest:

https://metin2dev.org/board/index.php?/topic/1698-howtooldquest-client-communicationfor-any-version/

But when I press the button in game, nothing happens in the quest! If I do it only on a graphical point of view, the button reacts to the click, but it doesn't get the anti exp active.
This is my code added for the quest:

  • game.py:

def OnClickBlockExp(self):
        event.QuestButtonClick(int(constInfo.BLOCK_EXP))

----------------------------------------------------------------------------------------------------------------

def __ServerCommand_Build(self):
        serverCommandList={

"blocco_exp"                            : self.blocco_exp,

----------------------------------------------------------------------------------------------------------------

def blocco_exp(self,value):
        constInfo.BLOCK_EXP = int(value)

 

  • quest:

quest anti_exp begin
    state start begin
        when login begin
            cmdchat("blocco_exp "..q.getcurrentquestindex())
            
            if pc.getqf("blocco_exp") == 1 then
                pc.setqf("exp_pc",pc.get_exp())
                chat("[Blocco Esperienza] - Attivato!")
            
            elseif pc.getqf("blocco_exp") == 0 then
                chat("[Blocco Esperienza] - Disattivato!")
            end
        end
        
        when button or info begin
            if pc.getqf("blocco_exp") == 0 then
                pc.setqf("blocco_exp", 1)
                pc.setqf("exp_pc",pc.get_exp())
                chat("[Blocco Esperienza] - Attivato!")
                
            elseif pc.getqf("blocco_exp") == 1 then
                pc.setqf("blocco_exp", 0)
                chat("[Blocco Esperienza] - Disattivato!")
            end
        end
        
        when kill with not npc.is_pc() begin
            if pc.getqf("blocco_exp") == 1 then
                pc.give_exp2(pc.getqf("exp_pc")-pc.get_exp())
            end
        end
    end
end

 

Could someone tell me why it doesn't work please?

Link to comment
Share on other sites

  • Premium

Exp function is in INT if you upp your level over 2kkk exp you will get terrible errors.


        function format_exp()
            local expp = pc.get_exp()
            if expp < 1999999999 then --Do it thinking how many exp is required
                pc.give_exp2(-pc.get_exp())
            else
                pc.give_exp2(-1999999999)
                pc.give_exp2(-pc.get_exp())
            end
        end

        quest.format_exp()
        pc.block_exp() --I hope that you have it

 

 

If you can't use LUA or PY is better doing a LETTER for this system or item with  .use

 

Regards WeedHex

  • Love 1
Link to comment
Share on other sites

8 hours ago, WeedHex said:

I cant see this things....

Exp function is in INT if you upp your level over 2kkk exp you will get fucking errors.


        function format_exp()
            local expp = pc.get_exp()
            if expp < 1999999999 then --Do it thinking how many exp is required
                pc.give_exp2(-pc.get_exp())
            else
                pc.give_exp2(-1999999999)
                pc.give_exp2(-pc.get_exp())
            end
        end

        quest.format_exp()
        pc.block_exp() --I hope that you have it........

Thanks for your reply! I will apply that to the quest but the problem was about the switching of the quest flag between 0 and 1.
I don't see nothing in chat when I press the button.

 

8 hours ago, WeedHex said:

If you can't use LUA or PY is better doing a LETTER for this system or item with  .use

I don't think that this is the best advice. I don't mean me but all. I think everyone has to make his experience and you can learn also by making mistakes.
Don't judge people. Help them if you really want to be usefull and you will be respected. Take that like a friend advice :)

P.s.: I have already do that by Letter but I decided to do it by button

  • Sad 1
Link to comment
Share on other sites

  • Premium

Don't do those stuff using -exp.

Example why:

You need 600exp to level up, you kill a mob that gives 650 exp, you will level up first and then the remove exp will take place.

 

Use those setqf to turn on/off exp blockage and then at the case point_exp of game add a check. If the qf is 1, do a return.

That way you will really block exp gain, instead of working around like in those examples.

  • Love 1
Link to comment
Share on other sites

  • Premium
17 hours ago, tierrilopes said:

Don't do those stuff using -exp.

Example why:

You need 600exp to level up, you kill a mob that gives 650 exp, you will level up first and then the remove exp will take place.

True story.

Make this system in source is very easy if you have unknolegde... or google can help you "metin2 anti exp c++" ;)

  • Love 1
Link to comment
Share on other sites

  • 2 weeks later...
  • Premium
On 27/2/2018 at 4:23 PM, tierrilopes said:

Don't do those stuff using -exp.

Example why:

You need 600exp to level up, you kill a mob that gives 650 exp, you will level up first and then the remove exp will take place.

 

Use those setqf to turn on/off exp blockage and then at the case point_exp of game add a check. If the qf is 1, do a return.

That way you will really block exp gain, instead of working around like in those examples.

WTH You're telling??

If you dont know   pc.block_exp() shhhush!

Link to comment
Share on other sites

  • Premium
2 hours ago, WeedHex said:

WTH You're telling??

If you dont know   pc.block_exp() shhhush!

I was adressing to the thread opener and what he showed there. If you can read, your issue. Next time I will explain it better so simple brains like yours can process it.

You're no one to tell me to shut up, specially due to your cancerous topics showing nothing but lack of knowledge, so please, crawl back to your cave.

  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.