• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Otclient runes target behaviour in stack (uh trap)

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
219
Solutions
9
Reaction score
67
Location
Santiago, Chile.
I'm working in uh trap for 7.4 mechanics server (7.72 server). I tried with two different otclients on my server and every otclient have different behaviour when hitting creatures or players stacked in the same tile.
The 7.72 otclient hits the whole players in the stack when using hmm i.e, but when i use the Mehah 1.0 otclient i hit only the player on top of the stack.
The behaviour standing in the stack with uh or ih runes is totally different too.
I tried changing the modules for both clients but it maintain the behaviour so it's not a module issue but a source issue. Anyone know where can i modify this behaviour? Thanks.
 
Solution
Well so far nobody answered so here i go:

I couldn't handle things from otclient so i did it in server-side.
In order to fix the problem of hitting the first creature in the stack (on bottom) instead of the last creature on stack (on top, how it is supposed to be in 7.4) i just reversed the result of this iterator in tile.cpp


Code:
Creature* Tile::getTopCreature()
{
    if(CreatureVector* creatures = getCreatures()){
        if(!creatures->empty()){
            return *creatures->rbegin(); // Here i changed "begin()" for "rbegin()".
        }
    }


    return NULL;
}


After this change, you can heal-damage anyone on top of the stack, but only the runes in scripts that have the
setCombatParam(combat...
OP
Terotrificy

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
219
Solutions
9
Reaction score
67
Location
Santiago, Chile.
Thank for the help but thats not what i am asking for, i want to keep my client but edit the sources to the behaviour i want, no clue what file in the sources does the job tho.
 
OP
Terotrificy

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
219
Solutions
9
Reaction score
67
Location
Santiago, Chile.
Well so far nobody answered so here i go:

I couldn't handle things from otclient so i did it in server-side.
In order to fix the problem of hitting the first creature in the stack (on bottom) instead of the last creature on stack (on top, how it is supposed to be in 7.4) i just reversed the result of this iterator in tile.cpp


Code:
Creature* Tile::getTopCreature()
{
    if(CreatureVector* creatures = getCreatures()){
        if(!creatures->empty()){
            return *creatures->rbegin(); // Here i changed "begin()" for "rbegin()".
        }
    }


    return NULL;
}


After this change, you can heal-damage anyone on top of the stack, but only the runes in scripts that have the
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) (any number above 0 enables this feature) makes you heal/damage the creature on top on the stack, the rest of the runes that doesn't have this combat param in the script just hit everyone on the stack.

It works fine if you're not in the stack, but the problem with this feature is regardness of being on bottom or top of the stack, if you're in the stack you heal yourself no matter what. To change this to the 7.4 behaviour (heal yourself only if you're the one in the top), you need commit this lines in combat.cpp:


Lua:
if(params.targetCasterOrTopMost){
/*                         if(caster && caster->getTile() == iter_tile){  -- Commented lines to disable priority of caster in stack for healing purposes.
                            if(*cit == caster){
                                bContinue = false;
                            }
                        } 
                         else  */if(*cit == iter_tile->getTopCreature()){
                            bContinue = false;
                        }

In that way, you have most of your 7.4 uh trap working.

What is left: At the momment you can use any rune that doesn't have that parameter in the script in a stack and you hit everyone, but if you use any other rune without that param, you hit everyone in the stack regardness of your position inside the stack. If you set all runes with that parameter (i.e hmm or sd) you will hit only the person on top of the stack (back then in 7.4 you could hit everyone with 1 shoot, but you couldn't shot if you were on top of the stack).

That's all, i hope someone can help me out with the other parameter or figure out how to fix what is left. I'm using Othire 1.0 and 7.72 client from here:
 
Last edited:
Solution

CipsoftStinks

www.relicaria.com
Joined
Oct 1, 2016
Messages
929
Solutions
3
Reaction score
127
Location
Argentina
Well so far nobody answered so here i go:

I couldn't handle things from otclient so i did it in server-side.
In order to fix the problem of hitting the first creature in the stack (on bottom) instead of the last creature on stack (on top, how it is supposed to be in 7.4) i just reversed the result of this iterator in tile.cpp


Code:
Creature* Tile::getTopCreature()
{
    if(CreatureVector* creatures = getCreatures()){
        if(!creatures->empty()){
            return *creatures->rbegin(); // Here i changed "begin()" for "rbegin()".
        }
    }


    return NULL;
}


After this change, you can heal-damage anyone on top of the stack, but only the runes in scripts that have the
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) (any number above 0 enables this feature) makes you heal/damage the creature on top on the stack, the rest of the runes that doesn't have this combat param in the script just hit everyone on the stack.

It works fine if you're not in the stack, but the problem with this feature is regardness of being on bottom or top of the stack, if you're in the stack you heal yourself no matter what. To change this to the 7.4 behaviour (heal yourself only if you're the one in the top), you need commit this lines in combat.cpp:


Lua:
if(params.targetCasterOrTopMost){
/*                         if(caster && caster->getTile() == iter_tile){  -- Commented lines to disable priority of caster in stack for healing purposes.
                            if(*cit == caster){
                                bContinue = false;
                            }
                        }
                         else  */if(*cit == iter_tile->getTopCreature()){
                            bContinue = false;
                        }

In that way, you have most of your 7.4 uh trap working.

What is left: At the momment you can use any rune that doesn't have that parameter in the script in a stack and you hit everyone, but if you use any other rune without that param, you hit everyone in the stack regardness of your position inside the stack. If you set all runes with that parameter (i.e hmm or sd) you will hit only the person on top of the stack (back then in 7.4 you could hit everyone with 1 shoot, but you couldn't shot if you were on top of the stack).

That's all, i hope someone can help me out with the other parameter or figure out how to fix what is left. I'm using Othire 1.0 and 7.72 client from here:
do you have parcel block height stack block code ( code to block two stacked parcel or boxes etc )
 
Top