First of all I want to say I have seen this codes in some places but not on this forum (OTServ Codes), so thats why I add it here. I didn't search for this on the forums and adding it here just to get credits, I don't care of it. I'm just here to help perople.
What is this code?
I think you already know what this code does but I will tell for those who doesn't.
You can choose the base speed insice vocations.xml, and this will enable you to have different base speed on different vocations.
Note that you have to change in your database too, so I hope you know a bit of SQL before adding this.
Start of the code:
iologindata.cpp
Add...
...above
Add...
...above
player.h
Change...
...to
vocation.cpp
Add...
...under
Add...
...under
vocation.h
Add...
...under
Add...
...under
End of the code:
Rebuild all and now you can add:
Don't mind my vocation, its my custom vocation, concentrate on the red parts.
Explanation
220 is the normal speed in real tibia. You can change this to whatever, but as soon as you put something over 900 it will be 900.
Please leave a comment
And if there is a better way to do this, please tell me then. Still learning
Yours,
Kadj
What is this code?
I think you already know what this code does but I will tell for those who doesn't.
You can choose the base speed insice vocations.xml, and this will enable you to have different base speed on different vocations.
Note that you have to change in your database too, so I hope you know a bit of SQL before adding this.
Start of the code:
iologindata.cpp
Add...
Code:
player->updateBaseSpeed();
...above
Code:
player->updateInventoryWeigth();
Add...
Code:
query << "`speed` = " << player->getBaseSpeed() << ", ";
...above
Code:
query << "`cap` = " << player->getCapacity() << ", ";
player.h
Change...
Code:
baseSpeed = 220 + (2* (level - 1));
...to
Code:
baseSpeed = vocation->getBaseSpeed() + (2* (level - 1));
vocation.cpp
Add...
Code:
if(readXMLInteger(p, "basespeed", intVal)){
voc->baseSpeed = intVal;
}
...under
Code:
if(readXMLInteger(p, "fromvoc", intVal)){
voc->fromVocation = intVal;
}
Add...
Code:
baseSpeed = 220;
...under
Code:
fromVocation = 0;
vocation.h
Add...
Code:
uint32_t getBaseSpeed() const {return baseSpeed;};
...under
Code:
uint32_t getFromVocation() const {return fromVocation;}
Add...
Code:
uint32_t baseSpeed;
...under
Code:
uint32_t attackSpeed;
Rebuild all and now you can add:
Don't mind my vocation, its my custom vocation, concentrate on the red parts.
Code:
<vocation id="125" name="Lycanthropy (Braindeath)" description="a lycanthropy transformed into a braindeath" gaincap="10" gainhp="5" gainmana="30" gainhpticks="5" gainhpamount="15" gainmanaticks="2" gainmanaamount="15" manamultiplier="2.1" attackspeed="1800" soulmax="200" gainsoulticks="6000" fromvoc="12" [COLOR="Red"]basespeed="220"[/COLOR] physicalDamage="130" energyDamage="80" fireDamage="90" poisonDamage="90" drownDamage="110">
Explanation
220 is the normal speed in real tibia. You can change this to whatever, but as soon as you put something over 900 it will be 900.
Please leave a comment
And if there is a better way to do this, please tell me then. Still learning
Yours,
Kadj
Last edited: