• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Feature Mounts with attackSpeed

Tryller

Member
Joined
Nov 22, 2010
Messages
200
Reaction score
13
Location
Brazil
Hello OTLand.

I've modified OpenTibia mount system to add attackSpeed in mounts.xml
Eemple about it work, if you have in vocations.xml attackspeed="2000" and in mounts.xml you have attackspeed="1900", the attack speed of player is now 100. It's a simple interval. This code I made to OpenTibia SVN Servers, tested on Rev 5948
Let start code :)

In creature.cpp after
PHP:
mountSpeed = 0;

Add this
PHP:
mountAttackSpeed = 0;

After
PHP:
mountSpeed = mount.speed;

Add this
PHP:
mountAttackSpeed = mount.attackSpeed;




In creature.h after
PHP:
const int32_t getMountSpeed() const {return (ridingMount ? mountSpeed : 0);}

Add this
PHP:
const int32_t getMountAttackSpeed() const {return (ridingMount ? mountAttackSpeed : 0);}

After
PHP:
int32_t mountSpeed;

Add this
PHP:
int32_t mountAttackSpeed;



In mount.cpp after
PHP:
						if(readXMLInteger(p, "speed", intValue)){
							mount.speed = intValue;
						}

Add this
PHP:
						if(readXMLInteger(p, "attackspeed", intValue)){
							mount.attackSpeed = intValue;
						}

In mount.h replace it
PHP:
Mount() : mountId(0), lookType(0), speed(0), isPremium(false), isDefault(false), name("") {}

For this
PHP:
Mount() : mountId(0), lookType(0), speed(0), attackSpeed(0), isPremium(false), isDefault(false), name("") {}

After this
PHP:
uint32_t speed;

Add this
PHP:
uint32_t attackSpeed;



In player.cpp in function uint32_t Player::getAttackSpeed() const replace it
PHP:
return vocation->getAttackSpeed();

For this
PHP:
return vocation->getAttackSpeed() - getPlayer()->getMountAttackSpeed();

Compile, and rebuild all
Don't forget to add attackspeed="0" in your mounts.xml


Crédits: Me (Tryller)
 
Last edited:
or just fix it, if no attackspeed= then diff = 0 and no need to edit mounts.xml

but its nice ;d
 
or just fix it, if no attackspeed= then diff = 0 and no need to edit mounts.xml

but its nice ;d
Yes if in mounts.xml attackspeed is = 0, it nor work :) only of vocations, case it is > 0, it will calculate the difference between the two and give the result
 
Back
Top Bottom