• Sign up for TFS Icon Competition! The prize includes Otland Premium time and a medal, as well as obviously taking part in TFS history.
  • 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 Red square vanish on change target

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
245
Location
Santiago - Chile
Hi! I open this thread to ask the following. My red target square is vanishing (sometimes) when I change the target. I don't know if this error belongs to OTC or server sources. I'm using this OTClient repo and OTX 3.8. To explain me better, I reproduced the bug in a video, and posted in the OTC thread (on the attached post you can see which solutions I tried and failed). Another important thing, I am 90% sure that this only happens if I have battle channel closed.


Hope someone can help me with this, I don't know where the error is comming from so is better to ask, maybe it is related to something simple, or to sources 🤔 Thanks in advance, Regards!
 
Last edited:
Solution
Just a remark, the old battle module was revamped because it sucked and the FPS drop was INSANE.
Honestly it's been a long time since I did this PR and I've been out of the Tibia World for some time now, I doubt I'll have the time or the will to download it all again just to find where is the line to add the updateBattleButton.

Ideally someone else could/should check this, I'm actually disappointed that the first feedback I got in this huge revamp only came now, almost 1 year later.

PS: Found the explanation post I did in OTC 1.0 thread.
OP
ralke

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
245
Location
Santiago - Chile
Using mehah's otc. More red square bugs, searched on various OTC repositories and TFS sources (nekiro and main branch) and I can't find information about this.
Only Removed targets static square fix by theshibbies · Pull Request #36 · otland/otclient (https://github.com/otland/otclient/pull/36/commits/4f2b98de48d6f47ca3bedc78ff0af775bcf0bd29), and didn't work.


I think that is OTC related, would be nice if someone can confirm if this happens on nekiro's tfs 1.3 too while using mehah's otc, or if happens on tfs main branch. Thanks in advance!
 
Last edited:

Evil Puncker

prolonged absenteeism
TFS Developer
Joined
May 30, 2009
Messages
7,645
Solutions
180
Reaction score
3,411
would be nice if someone can confirm if this happens on nekiro's tfs 1.3 too while using mehah's otc
yes I was curious and just tested it with said setting and indeed, the red square doesn't vanish

2021-04-11 05_06_21-OTClient.png

otc fault, not server
 
OP
ralke

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
245
Location
Santiago - Chile
@Night Wolf @Evil Puncker here are the tests.
For the first video ([OTC] Target red square bug) I added this commit to my server but the error can still be triggered with battle channel. If you can trigger the bug too on mehah's otc will be helpfull, because I had not the same behaviour of the first post after applied the commit (now updated same as tfs branch, didn't check if nekiro 8.6 sources got this applied)
For the second video ([OTC] Duplicated red square and bug target lost/invisible) works correctly if battle channel is closed. Didn't test with invisible monsters I'll record and upload if necessary.

Recorded results:

Regards!
 
Last edited:

Night Wolf

I don't bite.
Joined
Feb 10, 2008
Messages
400
Solutions
6
Reaction score
577
@ralke I don't remember Mehah changing anything related to battle, so every difference that there might be between mehah version and v8/edubart otc will be because of my battle update


The thing is that I recall the first bug but I was unable to fix it through the tests I was doing. There were a few lines that I though "hey, this looks very odd" but kept regardless because I didn't knew what would be the colateral effects of applying those changes.

It's probably something in this function, I opted to not deviate much from the original.

Looking at v8 version, it seems it has more complex checks, perhaps that is what is missing:
 
OP
ralke

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
245
Location
Santiago - Chile
@Night Wolf this is a quick test, to get some advances
I switched to the old module
changed reworked lines for deleted old ones, this fix the stair hop bug, but another bug can be triggered now. This is realted to healthChange, it is not triggered necessarily onKill.


Tomorrow i'll check the code with more attention to do a comparision between the old code and the reworked code. Kondrah's battle module seems to work in a different way, it would requiere more time to figure out how it works in parallel to source code changes (if(seq == 0 || m_seq == seq)) but i will check what I find too, and reply here, even though I think the best option is to repair the mehah's module.
 
Last edited:

Night Wolf

I don't bite.
Joined
Feb 10, 2008
Messages
400
Solutions
6
Reaction score
577
honestly it's been quite long since I last touched otc code but I believe an update on battleButton here should do the trick:

Try it like this:


Lua:
    if creature:isLocalPlayer() then
        if oldPos and newPos and newPos.z ~= oldPos.z then
            checkCreatures() -- Changing the z makes easier to just recalculate everything
            updateBattleButton(lastBattleButtonSwitched)
 
Last edited:
OP
ralke

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
245
Location
Santiago - Chile
@Night Wolf Same result. Bug #1 and #2 can be reproduced by opening/closing battle channel while attacking
open_close.png
At the moment the best result has been this post that only have the healthChange bug (attached the .lua file)
Regards!
 

Attachments

Night Wolf

I don't bite.
Joined
Feb 10, 2008
Messages
400
Solutions
6
Reaction score
577
that's pretty strange, the health must be something done in the sources because in the battle module we only have:

battleButton:setLifeBarPercent(healthPercent)

and it happens every trigger of the callback onCreatureHealthPercentChange, unless for some reason it is not finding the battlebutton.

If I have a spare time I'll try to take a look
 
OP
ralke

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
245
Location
Santiago - Chile
that's pretty strange, the health must be something done in the sources because in the battle module we only have:

battleButton:setLifeBarPercent(healthPercent)

and it happens every trigger of the callback onCreatureHealthPercentChange, unless for some reason it is not finding the battlebutton.

If I have a spare time I'll try to take a look

Thanks a lot! @Night Wolf I will mark this thread as solved, you gave me the best possible answers. Since the issue remain on onCreatureHealthPercentChange after applying the old battle module, I will check on sources to see if I can fix it, but that bug is less notorious that the one that opened this thread, from what i can tell, it works for now.

However, I would like you to continue this thread until we find a definitive solution, so I will answer in case I find something. I'll be waiting for your fix too 😁 Regards!
 

Night Wolf

I don't bite.
Joined
Feb 10, 2008
Messages
400
Solutions
6
Reaction score
577
Just a remark, the old battle module was revamped because it sucked and the FPS drop was INSANE.
Honestly it's been a long time since I did this PR and I've been out of the Tibia World for some time now, I doubt I'll have the time or the will to download it all again just to find where is the line to add the updateBattleButton.

Ideally someone else could/should check this, I'm actually disappointed that the first feedback I got in this huge revamp only came now, almost 1 year later.

PS: Found the explanation post I did in OTC 1.0 thread.
 
Last edited:
Solution
OP
ralke

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
245
Location
Santiago - Chile
Just a remark, the old battle module was revamped because it sucked and the FPS drop was INSANE.
Ideally someone else could/should check this, I'm actually disappointed that the first feedback I got in this huge revamp only came now, almost 1 year later.

I wish I had been before to test :( Here is the outcome, with old module, you're right.

I'm avaible for any tests you need, here is my discord felipe23#1113. Or just PM me, if possible, let me know who's currently developing OTC and I'll try to contact. The video for the reworked battle module, and test, is on debt. I'll try to update this post with it.

#Edit
Here is mehah's battle module test. It does not have FPS drops, but it has an unexpected render behaviour
 
Last edited:

Night Wolf

I don't bite.
Joined
Feb 10, 2008
Messages
400
Solutions
6
Reaction score
577
Ok, this is definetely something new because I tested this exhaustively back then. I'd need to download it all again and see what's happening.
SortType couldn't be nil as this is set by default as distance and updated everytime you change the sorting. It seems that someone changed my code or that the client is not receiving this information anymore due other changes. Can you please open an issue in Mehah's github? I'm pretty sure he'll take a look.
 
OP
ralke

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
695
Solutions
16
Reaction score
245
Location
Santiago - Chile
Ok, this is definetely something new because I tested this exhaustively back then. I'd need to download it all again and see what's happening.
SortType couldn't be nil as this is set by default as distance and updated everytime you change the sorting. It seems that someone changed my code or that the client is not receiving this information anymore due other changes. Can you please open an issue in Mehah's github? I'm pretty sure he'll take a look.
Sure, here is the issue on git The creature attacking red square does not vanish when changing floor, and sometimes doesn't appear while changing target · Issue #75 · mehah/otclient (https://github.com/mehah/otclient/issues/75)
I want to share my client with you so you can compare and test it with all the changes I made, how can I send it? I can PM you with mediafire link if you wish.
 

Night Wolf

I don't bite.
Joined
Feb 10, 2008
Messages
400
Solutions
6
Reaction score
577
Sure, here is the issue on git The creature attacking red square does not vanish when changing floor, and sometimes doesn't appear while changing target · Issue #75 · mehah/otclient (https://github.com/mehah/otclient/issues/75)
I want to share my client with you so you can compare and test it with all the changes I made, how can I send it? I can PM you with mediafire link if you wish.
I'll test the main repo with tfs 1.3, it the issue is not happening (it shouldn't because I've tested prior to PR) then I won't be able to help you in the conflicts you may have created with your changes, but if it does have the issue I'll try to see if I can solve it (and I'll also take a look at the health one)
 

Mehah

Excellent OT User
Joined
Jun 25, 2015
Messages
101
Reaction score
529
I wish I had been before to test :( Here is the outcome, with old module, you're right.

I'm avaible for any tests you need, here is my discord felipe23#1113. Or just PM me, if possible, let me know who's currently developing OTC and I'll try to contact. The video for the reworked battle module, and test, is on debt. I'll try to update this post with it.

#Edit
Here is mehah's battle module test. It does not have FPS drops, but it has an unexpected render behaviour

this is a bug that occurs when there are many actions on the screen with a 200% render scale
 
Top