• 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!

AttackSpeed limit?

NeL

New Member
Joined
Jan 14, 2008
Messages
11
Reaction score
0
Location
Spain
First of all: distro OTserv 0.6.3 rev 6052

Attackspeeds of lower than 1 second won't work, tried to change on vocations.xml and then found this on sources but should work since attackspeed is the one at the xml:

Code:
void Player::doAttacking(uint32_t interval)
{
	if(lastAttack == 0){
		// - 1 to compensate for timer resolution etc.
		lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
	}

	// Can't attack while pacified
	if(hasCondition(CONDITION_PACIFIED))
	{
		return;
	}

	if((OTSYS_TIME() - lastAttack) >= getAttackSpeed()){
		Item* tool;
		tool = getWeapon();
		bool result = false;
		const Weapon* weapon = g_weapons->getWeapon(tool);
		if(weapon){
			if(!weapon->interruptSwing()){
				result = weapon->useWeapon(this, tool, attackedCreature);
			}
			else if(!canDoAction()){
				uint32_t delay = getNextActionTime();
				SchedulerTask* task = createSchedulerTask(0, boost::bind(&Game::checkCreatureAttack,
					&g_game, getID()));
				setNextActionTask(task);
			}
			else {
				// If the player is not exhausted OR if the player's weapon
				// does not have hasExhaust, use the weapon.
				if(!hasCondition(CONDITION_EXHAUST_COMBAT))
				{
					result = weapon->useWeapon(this, tool, attackedCreature);
				}
			}
		}
		else{
			result = Weapon::useFist(this, attackedCreature);
		}

		if(result){
			lastAttack = OTSYS_TIME();
		}
	}
}

Am I missing something in the code above or it is set somewhere else that you can't attack faster than 1 second?

PS: Also noticed that if you move around the mob you are attacking, you will attack faster.

Thanks in advance.
 
Are you sure you changed it correctly in vocations.xml
attackspeed="2000"
2000=2s
If you wan't less than 1 second you are going to have to use number below 1000.
 
Yea I know that's the thing, if I put 1000 it will work fine x2 faster, but if you put 500 it will still be x2 faster, cause limit is 1 second somehow.

Just now I changed this line on creature.h:

Code:
#define EVENT_CREATURE_THINK_INTERVAL 1000

to

Code:
#define EVENT_CREATURE_THINK_INTERVAL 500

and setting an attackspeed of 500 will work now. Although I don't really know what overall changes can produce changing that value.

Any idea for a better fix or is this good enough?
 
Sorry Four Magic, I don't quite understand what did you mean by that, tried commenting those lines and even commeting only the "if" and the result is the same, limit will be still 500ms.

As far as I can understand from the code that part just initilalizes the "lastAttack" time incase it is 0 which happens after loggin in I guess(?).

Any help is appreciated.
 
Back
Top Bottom