FLYFF V21 how awake works?

01/19/2025 13:13 jarovart#1
Hey,

I dont get it how this code works.

i want to change it to


My aim is:
- only positives awakes
-all awakes should get the same chance.

But after changing the code, I only get +1 awakes.
01/19/2025 17:59 M¿dScientist#2
Quote:
Originally Posted by jarovart View Post
Hey,

I dont get it how this code works.
But after changing the code, I only get +1 awakes.
Code:
	const DWORD dwRandomProb = ::xRandom( MAX_RANDOMOPTION_PROB );

	short shPrevAdjValue = 0;
	for( ADJProbVec::const_iterator pos = vecAdjProb.begin(); pos != vecAdjProb.end(); ++pos )
	{
		if( dwRandomProb < pos->dwProb )
		{
			shAdjValue = bDecreaseAdjValue == true ? shPrevAdjValue : pos->shAdjValue;
		}

		if( shAdjValue != 0 )
		{
			break;
		}

		shPrevAdjValue = pos->shAdjValue;
	}
Code:
const DWORD		MAX_RANDOMOPTION_PROB		= 1000000000;
Maybe don't make the chances the same as MAX_RANDOMOPTION_PROB, and you'll pass the first iteration of the loop.
01/20/2025 10:21 netHoxInc#3
Quote:
Originally Posted by jarovart View Post
Hey,

I dont get it how this code works.

i want to change it to


My aim is:
- only positives awakes
-all awakes should get the same chance.

But after changing the code, I only get +1 awakes.

the last 3 params in

SetAdjValueProb( 28, 1000000000 , 1000000000 , 1000000000 )

should vary. Look at the examples beforehand, just offset them a little, in EQUAL distances, and you reach an EQUAL chance for each row to appear.

It appears that the actual 'chance' is the difference between each steps.

You only get the +1 awake as all have the effective same numbers, so the code will simply output the first you have listed, if you put the +28 STR on top of your listing it would be always +28, but as said, make equal steps for an equal chance.

Disclaimer: I have never worked with this code ever before, this is from pure visual code understanding and i might be wrong, but im confident im not.


Example:

SetAdjValueProb( 22, 80000000 , 83330000 , 86660000 )
SetAdjValueProb( 25, 90000000 , 93330000 , 96660000 )
SetAdjValueProb( 28, 100000000 , 103330000 , 106660000 )