Lua Function doPlayerSetExtraAttackSpeed(cid, speed)

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Joined
Mar 16, 2017
Messages
332
Reaction score
157
Location
London
for TFS 0.4 go to player.h
Code:
uint32_t getVocAttackSpeed() const {return vocation->getAttackSpeed();}
change to
Code:
uint32_t getVocAttackSpeed() const {
            return vocation->getAttackSpeed() - getPlayer()->getExtraAttackSpeed();
        }
 

thief

Excellent OT User
Joined
Sep 23, 2008
Messages
335
Reaction score
12
Location
Canada
It didn't work... I got a huge list of compiling errors.

did i still needed to add

void Player::setPlayerExtraAttackSpeed(uint32_t speed)
{
extraAttackSpeed = speed;
}


somewhere
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Joined
Mar 16, 2017
Messages
332
Reaction score
157
Location
London
It didn't work... I got a huge list of compiling errors.

did i still needed to add

void Player::setPlayerExtraAttackSpeed(uint32_t speed)
{
extraAttackSpeed = speed;
}


somewhere
I answered correctly the question you asked, you must follow the tutorial correctly so you do not have any other type of errors.
 

changos

Well-Known Member
Joined
Feb 13, 2012
Messages
51
Reaction score
11
void Player::setPlayerExtraAttackSpeed(uint32_t speed)
{
extraAtt
find uint32_t Player::getAttackSpeed() const
16-18 lines below find

return (((_weapon && _weapon->getAttackSpeed() != 0) ? _weapon->getAttackSpeed() : (vocation->getAttackSpeed() / std::max((size_t)1, getWeapons().size()))) + modifiers);

and replace for this

return (((_weapon && _weapon->getAttackSpeed() != 0) ? _weapon->getAttackSpeed() : (vocation->getAttackSpeed() - getPlayer()->getExtraAttackSpeed() / std::max((size_t)1, getWeapons().size()))) + modifiers);
 

thief

Excellent OT User
Joined
Sep 23, 2008
Messages
335
Reaction score
12
Location
Canada
#@sarah Wesker


I followed your steps exactly , this is what i got :/

1> Creating library C:\Server\3777-master\src\vc10\x64\Release\theforgottenserver.lib and object C:\Server\3777-master\src\vc10\x64\Release\theforgottenserver.exp
1>luascript.obj : error LNK2001: unresolved external symbol "public: void __cdecl Player::setPlayerExtraAttackSpeed(unsigned int)" ([email protected]@@[email protected])
1>C:\Server\3777-master\src\vc10\x64\Release\theforgottenserver.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
 

thief

Excellent OT User
Joined
Sep 23, 2008
Messages
335
Reaction score
12
Location
Canada
find uint32_t Player::getAttackSpeed() const
16-18 lines below find

return (((_weapon && _weapon->getAttackSpeed() != 0) ? _weapon->getAttackSpeed() : (vocation->getAttackSpeed() / std::max((size_t)1, getWeapons().size()))) + modifiers);

and replace for this

return (((_weapon && _weapon->getAttackSpeed() != 0) ? _weapon->getAttackSpeed() : (vocation->getAttackSpeed() - getPlayer()->getExtraAttackSpeed() / std::max((size_t)1, getWeapons().size()))) + modifiers);

I replaced the weapon line with the one you just given me , but I its saying syntax error

im using rev 3777
 

Attachments

Last edited:

changos

Well-Known Member
Joined
Feb 13, 2012
Messages
51
Reaction score
11
return ((weapon && weapon->getAttackSpeed() != 0) ? weapon->getAttackSpeed() : (vocation->getAttackSpeed() - getPlayer()->getExtraAttackSpeed() / std::max((size_t)1, getWeapons().size())));
 

thief

Excellent OT User
Joined
Sep 23, 2008
Messages
335
Reaction score
12
Location
Canada
return ((weapon && weapon->getAttackSpeed() != 0) ? weapon->getAttackSpeed() : (vocation->getAttackSpeed() - getPlayer()->getExtraAttackSpeed() / std::max((size_t)1, getWeapons().size())));

.\player.cpp(4405): error C2143: syntax error : missing ';' before 'return'
1>..\player.cpp(4405): error C2761: 'uint32_t Player::getAttackSpeed(void) const' : member function redeclaration not allowed
1>..\player.cpp(4405): error C2143: syntax error : missing ')' before '->'
1>..\player.cpp(4405): error C2143: syntax error : missing ';' before '->'
1>..\player.cpp(4405): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\player.cpp(4405): error C2059: syntax error : ')'
1>..\player.cpp(4405): error C2059: syntax error : ')'
1>..\player.cpp(4405): error C2059: syntax error : ')'
 

changos

Well-Known Member
Joined
Feb 13, 2012
Messages
51
Reaction score
11
I replaced the weapon line with the one you just given me , but I its saying syntax error

im using rev 3777
ok try with that once but copy it correctly because that message said u delete " ; "
 

changos

Well-Known Member
Joined
Feb 13, 2012
Messages
51
Reaction score
11
idk why bro, try with this
C++:
int32_t modifiers = 0;
Item* _weapon = weapon;
return (((_weapon && _weapon->getAttackSpeed() != 0) ? _weapon->getAttackSpeed() : (vocation->getAttackSpeed() - getPlayer()->getExtraAttackSpeed() / std::max((size_t)1, getWeapons().size()))) + modifiers);
 

thief

Excellent OT User
Joined
Sep 23, 2008
Messages
335
Reaction score
12
Location
Canada
well before I try this new code here the problem previously

Creating library C:\Server\3777-master\src\vc10\x64\Release\theforgottenserver.lib and object C:\Server\3777-master\src\vc10\x64\Release\theforgottenserver.exp
1>luascript.obj : error LNK2001: unresolved external symbol "public: void __cdecl Player::setPlayerExtraAttackSpeed(unsigned int)" ([email protected]@@[email protected])
1>C:\Server\3777-master\src\vc10\x64\Release\theforgottenserver.exe : fatal error LNK1120: 1 unresolved externals
What does this mean..?
 
Last edited:

changos

Well-Known Member
Joined
Feb 13, 2012
Messages
51
Reaction score
11
bro i think the problem is on luascript not on player.cpp, send me a pm and ill try to solve it
 
Top