I got those values after dozen hours of tests on real tibia live servers (from @e.e and @Kungenn). e.e even helped setup custom monsters with 100 cast chance. Also some annihilator tibia cams helped to figure out weird stuff (like how monsters spam spells when traped at not ideal range, as demons in annihilator, or any stuff from the other side of a river with no path available). The 4 seconds value I was not sure though, and might be something in the range of 3 to 5 seconds. You guys that have more experience with the 7.7 decompiled code might get the acurate values now that you know what to look for.
I'm amazed how a "perfect replica" totally ignored that aspect and garbage OTHire is being used as resource to fix all those broken features. I would actually advise against that though, it's better to test in the real thing, maybe check OTHire for ideas, but some implementations are estimatives and the code is poorly implemented (because I sux, sorry).
Regarding the video, I would guess it was some weird interaction of fast changing target and changing range. I tested with dragons/hunters for hours and never saw something like that.
Yeah uniform random is very simillar in behaviour to rand(), just more convinent to use. And decompiled binary of Cip's files is using normal rand for spell attack chance.
Code:if ( !(rand() % spellData->Delay) && (this->Master || TSkill::Get(this->tNonPlayer.tCreature.tSkillBase.Skills[HP]) > *(&unk_81C479C + 84 * this->baseclass_0.baseclass_0.Race) // runaway health || random(1, 3) == 1) )
I am not sure if there is anything actually using normalized, would have to dig around, been a while since I've looked into these.
But yeah, with normal_rand looking for 0 to proc. It made any spell in your distro do attack roughly 3-4 times less frequent.
Also you should also perhaps change the 1/3 chance to attack on flee to uniform version as well. As that's also making it way less frequent for additional chance to attack during flee.
Code:normalized_random(1, 3) 1 = 135932 13% 2 = 728048 72% 3 = 136020 13%
and random(int, int) is just a regular rand() with option to min - max
Code:int __cdecl random(int a3, int a4) { signed int v4; // ebx@1 int result; // eax@1 v4 = a4 - a3 + 1; result = a3; if ( v4 > 0 ) result = rand() % v4 + a3; return result; }
So hypothetically if an monster had chance 3. Which should be in fact 25% roughly.
Your monster had around 6% chance to attack with that spell. If it was fleeing, then that chance would be 0.78%.
What should look more like: 25% to attack & when fleeing 8,25%.
would mind you
it's obvious that othire has more accurate formulas, would you mind to share those codes? i want to add them into otx i mean source code would you give me the link to the commits please'?
@Peonso
?! no way ... i didn't know it .. lolis the code not in the github link? TwistedScorpio/OTHire (https://github.com/TwistedScorpio/OTHire)
Where did you get the code from that decompiled binary of Cip's files to be able see the attack formula?
And if you can see more, is there a cooldown or anything on spell casting.
There is no cooldown or anything whatsoever, there is nothing like that on any code generated by any reverse engineering software, there are only 1000 ms interval waits from here and there, but nothing like a spell cast cooldown, with this being said it can be presumed that there's a global cooldown of 1000 ms when a certain action happens because those 1000ms wait calls happen on very specific circumstances, however, I can recall one happening every time the idle stimulus function was called, and at the very end as well.
I'm still testing last fixes, now I cannot use runes on monsters with fields under them, it returns 'there is not enough room'
I can confirm that visual bug too:Thank you for your report, will be fixed now. The issue is caused by the last bug fix of effects appearing on stairs.
They are rolled separetedely, it's easy to spot in Warlock hunt cams 2 or 3 spells combo.Well it seems with the current method. it's possible for monstesr with more than 1 spell to cast 2 or more at once, if they're lucky. Is that right?
There is no cooldown or anything whatsoever, there is nothing like that on any code generated by any reverse engineering software, there are only 1000 ms interval waits from here and there, but nothing like a spell cast cooldown, with this being said it can be presumed that there's a global cooldown of 1000 ms when a certain action happens because those 1000ms wait calls happen on very specific circumstances, however, I can recall one happening every time the idle stimulus function was called, and at the very end as well.
TCreature::ToDoWait(&this->tNonPlayer.tCreature, (int)v34, (TCreature *)v33, (TConnection *)this, 1000);
Yeah that's what I've seen as well. Certain stuff trigers additional 1000ms pause
called in around 6 or so places of IdleStimulus func there is bunch of state switching as well which might also be connected to additional delays of attacks.Code:TCreature::ToDoWait(&this->tNonPlayer.tCreature, (int)v34, (TCreature *)v33, (TConnection *)this, 1000);
I'll re-setup my local 7.72 "official" server to see if I can link remote debugger it up ( wanted to do that long time ago anyway )
But won't be able to check anything until tomorrow.
Thank you for your report, will be fixed now. The issue is caused by the last bug fix of effects appearing on stairs.
What "official" server is it?
how do you see the formulas though?[7.7] RealOTS 7.7 Cipsoft files (virgin)
Community, TL;DR: tibia-game.tarball.tar (https://www.mediafire.com/file/4v8kulk4nfg0hgc/tibia-game.tarball.tar.gz/file) I've uploaded the entire Cipsoft distribution, available at the link below. The tarball is the original tarball that was transferred from the Zanera game world to my Redhat...otland.net
@Ezzz Do those functions use of normal_random need to be changed aswell? :
Now the chance to break a spear or a distance weapon is almost imposible if we use the same logic as the monster attacks.
how do you see the formulas though?