Jump to content

Unit::unit() And "m_attacktimer" Var


Guest pabzea
 Share

Recommended Posts

Hi,

I was watching the Unit.cpp file, the constructor Unit(),

Why dont initialize the m_attackTimer (for every type of attack) to BASE_ATTACK_TIME (defined in Unit.h) instead of 0 (zero), to avoid confusing and maybe hacking or cheating. Because the UNIT_FIELD_*ATTACKTIME fields are initialized to 2000.0f or BASE_ATTACK_TIME inside the Player.cpp and Pet.cpp (also if BASE_ATTACK_TIME = 2000.0f, so replace the numeric value for the defined one).

I know there are functions like SetAttackTime, setAttackTimer, resetAttackTimer, etc. But since I dont know exactly how is the core management; I dont know if core uses the var m_attackTimer or the fields UNIT_FIELD_*ATTACKTIME while updating the time (I'd have to read more the code).

Well like the title says, it is just a suggestion.

thx 4 u'r answer.

Regards,

***EDITED***

Some codes (functions) use the "m_*" vars (like m_weaponDamage var) and other ones use the UNIT_FIELD_(MIN|MAX)*DAMAGE... really i get confused, I hope the people who are programming use them in a correct way.

If someone can explain me, how use them in whole core (I mean: what situations I must use m_weaponDamage[bASE_ATTACK][MINDAMAGE] = XXXX; or use SetFloatValue(UNIT_FIELD_MINDAMAGE, XXXX) ), it 'd be appreciated.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use