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

Solved Randomize in monster

Hindori

New Member
Joined
Jan 24, 2009
Messages
157
Reaction score
2
Hello!
Let's start:
I want to monster with random number running like this:
pnr= random number betwen "pmin" and "pmax"

Pmin and pmax will be reading from monster file for example:
pmin="10" pmax="100" so:
pnr=randomize(10;100)

I know I need it do in c++ but i dont know how to start :(
For now i have only pnr, pmax and pmin in monster files.

Any sugesstion?
 
Last edited:
What do you want to randomize? Monster health points or chance to summon a monster? I couldn't determine that from your post.
 
Its just a 2 number. For every monster i decided 2 number (pmax and pmin). And i want to pnr= randomize betwen they.

Hm also i have a php in monster and this runing like this
monster hp= hpmax + php*pnr
(this is done, i only need this randomization) maybe now i will be know what i want to do.
 
I understand you want to choose one value between those two and thats called randomizing, but what those numbers will be used for? I mean, what is pmax and pmin and what should they be used for?

@edit
Thats what I meant, understood it now and can give you some tip.
 
Last edited:
The whole procedure would look like:

monster.cpp
change:
Code:
	healthMax = (int32_t)(mType->healthMax * multiplier);

to:
Code:
	healthMin = mType->healthMin, healthMax = mType->healthMax;
	if(healthMin > 0)
		healthMax = random_range(healthMin, healthMax);

	healthMax = (int32_t)healthMax * multiplier);

monsters.cpp
above:
Code:
maxSummons = -1

add:
Code:
healthMin = 0;

above:
Code:
if(!readXMLInteger(p, "max", intValue))

add:
Code:
if(readXMLInteger(p, "min", intValue))
	mType->healthMin = intValue;

monsters.h
in line saying:
Code:
int32_t defense, armor, health, healthMax, baseSpeed, lookCorpse, corpseUnique, corpseAction,

add ", healthMin' before "healthMax"

Usage is simple:
just set additional "min" parameter same as you did with "max" and value will be randomized.

(already commited into TFS svn)
 
But Slaw i'm using it also to exp and hits i have done hp and other think to do only what i need is this nr randomize ;s
 
Hits are already working the same way, only experience is not done, but I will add it too cause its not such a big deal.
 
But i need all this think(exp, hp, hits) are dependent on pnr so I need only pnr randomization to good working. I write to you pm with better explanation becouse my english is not as good as i want.
 
Back
Top