tuduras
Well-Known Member
- Joined
- Jun 4, 2017
- Messages
- 351
- Solutions
- 2
- Reaction score
- 59
Hello Otland!
I ve got on server Fast Attack system based on fist fighting. I followed this Tfs 0.4 0.4.6 & Otx Fast Attack by 2 Steps (Actualizado) (https://otland.net/threads/tfs-0-4-0-4-6-otx-fast-attack-by-2-steps-actualizado.258761/)
and with AI i create
and when I login to the server, it crashes after few moments. What do I wrong?
Best Regards!
I ve got on server Fast Attack system based on fist fighting. I followed this Tfs 0.4 0.4.6 & Otx Fast Attack by 2 Steps (Actualizado) (https://otland.net/threads/tfs-0-4-0-4-6-otx-fast-attack-by-2-steps-actualizado.258761/)
and with AI i create
LUA:
uint32_t Player::getAttackSpeed() const
{
// 1. Critical safeguard: TFS 1.5 calls this function during object creation.
// If there is no vocation or skill structure, return a safe default.
if (!vocation || !skills) {
return 1000;
}
// 2. Get base speed from vocation (vocation->getAttackSpeed() returns uint32_t)
int32_t baseSpeed = static_cast<int32_t>(vocation->getAttackSpeed());
// 3. Get skill level in a safe way for TFS 1.x
// getSkillLevel returns the raw skill level (e.g., 10, 50, 100)
int32_t fistLevel = static_cast<int32_t>(getSkillLevel(SKILL_FIST));
// 4. Calculate the new interval
int32_t calculatedSpeed = baseSpeed - (fistLevel * 10);
// 5. Hardcap at 200 ms
// Using std::max for better readability and safety
return static_cast<uint32_t>(std::max<int32_t>(200, calculatedSpeed));
}
and when I login to the server, it crashes after few moments. What do I wrong?
Best Regards!