Page 1 of 1
Dual Wield
Posted: Wed Dec 27, 2017 4:13 pm
by Gangrenous
What classifies as dual wield? IsDualWield seems to always return false even when something like a Guardian wields two weapons. GetWieldType seems to always return a 2, with one weapon, two weapons or hell even bare fist. If I equip and two handed sword it does return a 4, which is correct. It never equals a 1, which it should for dual wield.
Code: Select all
bool Entity::IsDualWield(){
return melee_combat_data.wield_type == 1;
}
int8 Entity::GetWieldType(){
return melee_combat_data.wield_type;
}
Re: Dual Wield
Posted: Wed Dec 27, 2017 4:25 pm
by Gangrenous
Ahhh, never mind. I never play tank classes, EQ2 is different and has special weapons that are dual wield.
Re: Dual Wield
Posted: Wed Dec 27, 2017 5:04 pm
by Gangrenous
Also, is this correct? GetPrimaryLastAttackTime?
Code: Select all
bool Entity::SecondaryWeaponReady() {
//Can only be ready if no ranged timer
if(IsDualWield() && (GetPrimaryLastAttackTime() == 0 || (Timer::GetCurrentTime2() >= (GetSecondaryLastAttackTime() + GetSecondaryAttackDelay())))) {
if(GetRangeLastAttackTime() == 0 || Timer::GetCurrentTime2() >= (GetRangeLastAttackTime() + GetRangeAttackDelay()))
return true;
}
return false;
}
Re: Dual Wield
Posted: Wed Dec 27, 2017 5:08 pm
by Jabantiz
Yes, the way eq2 dual wield worked is the secondary can only swing with the primary so it would have to wait until the primary is ready as well.
Re: Dual Wield
Posted: Wed Dec 27, 2017 5:12 pm
by tyrbo
The code also currently requires that the item itself has a Dual Wield type.
That's not the case on live anymore, where you can dual wield any 1H type.
I made the change on my server some time back just to not have to worry about differentiating 1H vs DW weapons.
Not sure the "Dual Wield" weapon type is even used on live anymore.
Re: Dual Wield
Posted: Wed Dec 27, 2017 6:16 pm
by Gangrenous
Yeah, I completely changed all of those code blocks and timers just now. I want each independent.
Re: Dual Wield
Posted: Wed Dec 27, 2017 6:31 pm
by Gangrenous
You know, I really do not like the way they did that. I am definitely not going to have items labeled "dual wield". You should just be able to pop another one handed sword in and run with it, that off hand should be recognized. Now to find out how to find the slot and change that function.
Re: Dual Wield
Posted: Wed Dec 27, 2017 6:49 pm
by tyrbo
The IsDualWield() check is the function you'll probably want to look at.
Mine looks like this at the moment:
Code: Select all
bool Entity::IsDualWield() {
if (has_secondary_weapon && (melee_combat_data.wield_type == 1 || melee_combat_data.wield_type == 2))
return true;
return false;
}
Re: Dual Wield
Posted: Wed Dec 27, 2017 8:07 pm
by Gangrenous
Yeah, I like that better. Thanks dude! I have some decent code in there and it appears to be working well. I added some skills like double attack and changed dual wield. I still do not like the timers though, something is quite off. The mob should get an attack, then the player. Maybe it is how the timers are run but I see too many rounds where the mob hits twice and then I hit twice, both are using primary so it should not happen.
I have not checked the mob code for combat, it could be that they are getting a double attack, which I do not want until they hit a much higher level.
Re: Dual Wield
Posted: Wed Dec 27, 2017 9:17 pm
by tyrbo
Only reason they should have double attack is if there's a stat being given to them from an item or something.
Re: Dual Wield
Posted: Wed Dec 27, 2017 9:27 pm
by Gangrenous
I would not so much say double attack, more like dual wield. I do not want them having 100% dual wield, and now they do not, it is now based on level.
Re: Dual Wield
Posted: Thu Dec 28, 2017 8:12 am
by Ememjr
i have never looked at combat yet, but based on what was said abov, is it really turn based
ie mob hits
you hit
mob hits
mob hits again(double attack)
Re: Dual Wield
Posted: Thu Dec 28, 2017 11:03 am
by Gangrenous
Something just seems way off still but I am still troubleshooting. I am doing a log output right after AttackAllowed for player and npc and getting way more iterations for player than npc, over 10 times as many. Both player and NPC are showing the same delay on this test for primary but player is getting way more iterations. It may even out once the WeaponReady is checked, but why so many more iterations for players?
Re: Dual Wield
Posted: Thu Dec 28, 2017 11:26 am
by Gangrenous
I am guessing this is why though. I have altered the entire zone process heavily, but I think even official source will operate the same way. The players are processed more often because their checks are not stored like an NPC's are.
Code: Select all
if (GetHP() > 0 && Timer::GetCurrentTime2() >= (m_brain->LastTick() + m_brain->Tick())) {
Since each NPC can only be processed so often, because the brain tick is stored and can only be processed every so often.
Re: Dual Wield
Posted: Thu Dec 28, 2017 1:42 pm
by tyrbo
I haven't noticed any issues like the ones you're describing and we've been doing combat testing (with ACT running) for a long time now.
I have fixed a lot lot lot of bugs though, so it's possible you're running into an issue that I've already dealt with.