• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Web [Tut] Overpotting

Status
Not open for further replies.
Newbie Spellweaver
Joined
Apr 4, 2008
Messages
13
Reaction score
0
This is a simple fix for the overpotting bug (if you use a potion that restores more HP than you have, you die).

1). Open Inventory.cpp
2). Find this code:
Code:
if(Drops::consumes[itemid].hp>0){
        player->setHP(player->getHP()+Drops::consumes[itemid].hp);
    }
    if(Drops::consumes[itemid].mp>0){ 
        player->setMP(player->getMP()+Drops::consumes[itemid].mp);
    }
    if(Drops::consumes[itemid].hpr>0){
        player->setHP(player->getHP()+Drops::consumes[itemid].hpr*player->getMHP()/100);
    }
    if(Drops::consumes[itemid].mpr>0){
        player->setMP(player->getMP()+Drops::consumes[itemid].mpr*player->getMMP()/100);
    }
3). Replace it with this code:
Code:
    if(Drops::consumes[itemid].hp>0){
        int o = player->getHP()+Drops::consumes[itemid].hp;
        int h = player->getMHP();
        if(player->getHP() == h)
            player->setHP(player->getMHP());
        else if(o>h)
            player->setHP(player->getMHP());
        else
        player->setHP(player->getHP()+Drops::consumes[itemid].hp);
    }
    if(Drops::consumes[itemid].mp>0){
        int o = player->getMP()+Drops::consumes[itemid].mp;
        int h = player->getMMP();
        if(player->getMP() == h)
            player->setMP(player->getMMP());
        else if(o>h)
            player->setMP(player->getMMP());
        else
        player->setMP(player->getMP()+Drops::consumes[itemid].mp);
    }
    if(Drops::consumes[itemid].hpr>0){
        int o = player->getHP()+Drops::consumes[itemid].hpr*player->getMHP()/100;
        int h = player->getMHP();
        if(player->getHP() == h)
            player->setHP(player->getMHP());
        else if(o>h)
            player->setHP(player->getMHP());
        else
            player->setHP(player->getHP()+Drops::consumes[itemid].hpr*player->getMHP()/100);
    }
    if(Drops::consumes[itemid].mpr>0){
        int o = player->getMP()+Drops::consumes[itemid].mpr*player->getMMP()/100;
        int h = player->getMMP();
        if(player->getMP() == h)
            player->setMP(player->getMMP());
        else if(o>h)
            player->setMP(player->getMMP());
        else
            player->setMP(player->getMP()+Drops::consumes[itemid].mpr*player->getMMP()/100);
    }
4). Re-compile
5). ???
6). PROFIT!

The server should run fine. Post any problems here.
 
Newbie Spellweaver
Joined
Mar 14, 2008
Messages
89
Reaction score
0
Re: [Bug-Fix Guide] Overpotting

Lol!
1)Business
2)???(silence)
3)PROFIT!

The gnomes know what they're doing!
 
Initiate Mage
Joined
Apr 3, 2008
Messages
4
Reaction score
0
Re: [Bug-Fix Guide] Overpotting

Thanks a ton! helps alot with the onyx apples (heals 90%)
 
Experienced Elementalist
Joined
May 28, 2007
Messages
264
Reaction score
2
Re: [Bug-Fix Guide] Overpotting

O_O whoa. big code. Thanks xD.
 
Experienced Elementalist
Joined
Jan 10, 2008
Messages
224
Reaction score
27
Re: [Bug-Fix Guide] Overpotting

There is a better fix for it without changing the code in this part, because sethp is doing this check anyway.
The fix will be in 004
 
Newbie Spellweaver
Joined
Apr 2, 2008
Messages
39
Reaction score
0
Re: [Bug-Fix Guide] Overpotting

I needed that, and i'm sure you helped a lot of people :p
thanks
 
Newbie Spellweaver
Joined
Apr 4, 2008
Messages
13
Reaction score
0
Re: [Bug-Fix Guide] Overpotting

There is a better fix for it without changing the code in this part, because sethp is doing this check anyway.
The fix will be in 004

Alright! That's good, but this is just a quick bug-fix guide for people who hated dying from overpotting.
 
Junior Spellweaver
Joined
Aug 24, 2006
Messages
105
Reaction score
0
Re: [Bug-Fix Guide] Overpotting

I cant manage to find the one to "switch for"....
I mean, this one:

"if(Drops::consumes[itemid].hp>0){
player->setHP(player->getHP()+Drops::consumes[itemid].hp);
}
if(Drops::consumes[itemid].mp>0){
player->setMP(player->getMP()+Drops::consumes[itemid].mp);
}
if(Drops::consumes[itemid].hpr>0){
player->setHP(player->getHP()+Drops::consumes[itemid].hpr*player->getMHP()/100);
}
if(Drops::consumes[itemid].mpr>0){
player->setMP(player->getMP()+Drops::consumes[itemid].mpr*player->getMMP()/100);
}"

Can someone upload a fixed one for me?
 
Newbie Spellweaver
Joined
Jul 18, 2006
Messages
51
Reaction score
0
Re: [Bug-Fix Guide] Overpotting

just search for this line:
if(Drops::consumes[itemid].hp>0){

and replace those line (be sure to leave the las } at the bottom and just paste the code, there were not just "if" but with "else " also but since i didnt find any other matching i replaced them :)
 
Junior Spellweaver
Joined
Aug 24, 2006
Messages
105
Reaction score
0
Re: [Bug-Fix Guide] Overpotting

Cant you just upload the script for me? XD
but I`ll try again...
 
Newbie Spellweaver
Joined
Jun 19, 2007
Messages
11
Reaction score
0
Re: [Bug-Fix Guide] Overpotting

you win :) thanks so much :) died 500 times due to this while killing pap xD
 
Initiate Mage
Joined
Apr 16, 2008
Messages
2
Reaction score
0
Re: [GUIDE] Overpotting

my guy auto heals by himself when damaged is there anyways to stop it from healing by it self?
 
Master Summoner
Joined
Apr 2, 2008
Messages
538
Reaction score
0
Re: [GUIDE] Overpotting

wth @ overpotting bug, never encountered it before o.0
 
Status
Not open for further replies.
Back
Top