• 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!

[C++] - Monster Defense

Oskar1121

Excellent OT User
Joined
Jul 15, 2009
Messages
634
Reaction score
537
Location
Poland
Hello,
Where can I change monster defense? I have found in monsters.cpp this line:
PHP:
if(readXMLInteger(p, "defense", intValue))
				mType->defense = intValue;

And where I change intValue on any number then monster have always to same defense (from XML file). Why?


Sorry for my English.
 
You not understand me. I want to value retrieved from the XML lent a random number between.
Example:
PHP:
defense = (int32_t)(mType->defense + random_range(1,15));
 
Find this in monster.cpp:
[cpp]
Monster::Monster(MonsterType* _mType):
Creature()
{
[/cpp]

and at the middle of this constructor add (it will look like this):
[cpp]
double multiplier = g_config.getDouble(ConfigManager::RATE_MONSTER_HEALTH);
health = (int32_t)(mType->health * multiplier);
healthMax = (int32_t)(mType->healthMax * multiplier);

mType->defense = (int32_t)(mType->defense + random_range(1,15));
[/cpp]
 
Back
Top