awakening problem

Status
Not open for further replies.
I'm not so sure why you try to create a new randomopitonkind. At the bottom of randomoption.cpp are the DST's for the overal awakens. At the bottm the configuration for the gaunts. I've once changed attack to attack% and this worked by editting it there and in the randomoption.inc.

I will give you a quick lesson about those.
Code:
void CRandomOptionProperty::AwakeningExtension( void )
{
 int anDst[eAwakeningExtension][6] = 
 {
  [COLOR=#ff0000]DST_CHR_CHANCECRITICAL, DST_ATKPOWER, DST_SPELL_RATE, DST_ATTACKSPEED, DST_MP_MAX, DST_FP_MAX[/COLOR],
[COLOR=#008000]  DST_CRITICAL_BONUS, DST_SPEED, DST_ADJDEF, DST_HP_MAX, DST_MP_MAX, DST_FP_MAX,[/COLOR]
  [COLOR=#0000cd]DST_STR, DST_DEX, DST_INT, DST_STA, DST_MP_MAX, DST_FP_MAX[/COLOR] 
 };
 int anTotal[eAwakeningExtension];
 memset( anTotal, 0, sizeof(int) * eAwakeningExtension );
 for( DWORD i = 0; i < m_aRandomOption[eAwakening].size(); i++ )
 {
  RANDOM_OPTION* pRandomOption = &m_aRandomOption[eAwakening][i];
  int nProb = ( i == 0?
   m_aRandomOption[eAwakening][i].nProb:
   m_aRandomOption[eAwakening][i].nProb - m_aRandomOption[eAwakening][i-1].nProb );
  for( int j = 0; j < eAwakeningExtension; j++ )
  {
   int iRandomOptionKindIndex = GetRandomOptionKindIndex( eAwakening, PARTS_HAND + j );
   for( int k = 0;[COLOR=#ff0000] k < 6[/COLOR]; k++ )
    if( pRandomOption->nDst == anDst[j][k] )
    {
     RANDOM_OPTION ro( pRandomOption );
     ro.nProb = anTotal[j] + nProb;
     anTotal[j] = ro.nProb;
     m_aRandomOption[iRandomOptionKindIndex].push_back( ro );

You see the info about the PARTS_HAND. int k is adjusted to <6 meet the first 6 DST's as i give em the color red. Well, Blue is the row with the helmet awakes, Green is the row for the boots, and green and blue are the other parts. It's made in this way to keep it overseeable.

It's way more eassier changing the stats you want per set part now right?

No difficult things with new functions, just edit the line(s) you want to change according to the Part.

EDIT: don't forget changing the DST's in the lua accordingly.

I wish you luck,

Have a good day,
Worf.
 
oh wow.. thanks for the info man.. so if i add like 3 new awakening at the last line.. the helm and the suit will also get that awake?
 
oh wow.. thanks for the info man.. so if i add like 3 new awakening at the last line.. the helm and the suit will also get that awake?

No, if you want to change the Hand awakes, edit the red line, if you want to edit the boots awakens, change the green awakens. I would however recommend that you first replace a DST for another and test, and afterwards try to add a DST. If you do, dun forget to change it likewise in the .lua and change the AwakeningExtension index (wich is [6] default).
I think you can better change a dst for another as add a new DST, since than, you need to add 1 on every line (from 6 to 7). Becuz as i understand it, if you make it [7] you will most likely need to add a DST to every of the 3 lines. Not sure how this works out since i've never tried it out.

Look at the colors.

Worf.
 
i got it.. yeah.. i think there's no way to separate the awakes of weapons and suits.. that was my goal.. to separate the awakes of weapons and shields from suits.. cause if i add a new DST.. suits will get that DST too.. right? thanks for the info man. learned a lot about awakening from that one.. :)
 
Don't listen to Worf... He doesn't understand what you're trying to do.

You had everything right, except you made a mistake in CRandomOptionProperty::GetRandomOptionKind, which is because you don't understand how a switch statement works.

change this:
Code:
int CRandomOptionProperty::GetRandomOptionKind( CItemElem* pItemElem )
{
	ItemProp* pProp		= pItemElem->GetProp();
	switch( pProp->dwParts )
	{
		case PARTS_UPPER_BODY:
		//case PARTS_RWEAPON:
		//case PARTS_SHIELD:

#ifdef __WEAP_OWN_AWAKE
			{
				if( pProp->dwItemKind1 == IK1_WEAPON || pProp->dwItemKind3 == IK3_SHIELD )
					return static_cast<int>( eWeapAwakening );
			}
#endif // __WEAP_OWN_AWAKE

to this:
Code:
int CRandomOptionProperty::GetRandomOptionKind( CItemElem* pItemElem )
{
	ItemProp* pProp		= pItemElem->GetProp();
	switch( pProp->dwParts )
	{
		case PARTS_RWEAPON:
		case PARTS_SHIELD:
#ifdef __WEAP_OWN_AWAKE
			return static_cast<int>( eWeapAwakening );
#endif // __WEAP_OWN_AWAKE
		case PARTS_UPPER_BODY:
 
thanks guys.. i'll try both ways.. :)


ok.. i tried both of them..

EDIT:

@Worf: i added the custom awakes.. but the suit can also get that custom awake.. I only want the custom awake to be on the weapons and shields.

@ShadowDragon: i did the:
Code:
int CRandomOptionProperty::GetRandomOptionKind( CItemElem* pItemElem )
{
	ItemProp* pProp		= pItemElem->GetProp();
	switch( pProp->dwParts )
	{
		case PARTS_RWEAPON:
		case PARTS_SHIELD:
#ifdef __WEAP_OWN_AWAKE
			return static_cast<int>( eWeapAwakening );
#endif // __WEAP_OWN_AWAKE
		case PARTS_UPPER_BODY:

but it says "cannot be done." when i awake a weapon or a shield..
 
Last edited:
Maybe something like this could work without adding a new function.

Code:
void CRandomOptionProperty::AwakeningExtension( void )
{
 int anDst[eAwakeningExtension][6] = 
 {
  [COLOR=#ff0000]DST_CHR_CHANCECRITICAL, DST_ATKPOWER, DST_SPELL_RATE, DST_ATTACKSPEED, DST_MP_MAX, DST_FP_MAX[/COLOR],
[COLOR=#008000]  DST_CRITICAL_BONUS, DST_SPEED, DST_ADJDEF, DST_HP_MAX, DST_MP_MAX, DST_FP_MAX,[/COLOR]
  [COLOR=#0000cd]DST_STR, DST_DEX, DST_INT, DST_STA, DST_MP_MAX, DST_FP_MAX[/COLOR] 
 };

int anDst[eAwakeningExtensionEx][6] = 
 {
[COLOR=#008000]DST_CRITICAL_BONUS, DST_SPEED, DST_ADJDEF, DST_HP_MAX, DST_MP_MAX, DST_FP_MAX, //<-- Make this the shield[/COLOR]
  [COLOR=#0000cd]DST_STR, DST_DEX, DST_INT, DST_STA, DST_MP_MAX, DST_FP_MAX //<-- Make this the weapon[/COLOR]
 };

int combination = eAwakeningExtension + eAwakeningExtensionEx;
 int anTotal[combination];
 memset( anTotal, 0, sizeof(int) * combination );
 for( DWORD i = 0; i < m_aRandomOption[eAwakening].size(); i++ )
 {
  RANDOM_OPTION* pRandomOption = &m_aRandomOption[eAwakening][i];
  int nProb = ( i == 0?
   m_aRandomOption[eAwakening][i].nProb:
   m_aRandomOption[eAwakening][i].nProb - m_aRandomOption[eAwakening][i-1].nProb );
  for( int j = 0; j < eAwakeningExtension; j++ )
  {
   int iRandomOptionKindIndex = GetRandomOptionKindIndex( eAwakening, PARTS_HAND + j );
   for( int k = 0;[COLOR=#ff0000] k < 6[/COLOR]; k++ )
if( GetRandomOptionKindIndex( eAwakening, PARTS_RWEAPON || PARTS_SHIELD) )
return;
   if( pRandomOption->nDst == anDst[i][l] )
    {
     RANDOM_OPTION ro( pRandomOption );
     ro.nProb = anTotal[i] + nProb;
     anTotal[i] = ro.nProb;
     m_aRandomOption[iRandomOptionKindIndex].push_back( ro );
}

  for( int i = 0; i < eAwakeningExtensionEx; i++ )
  {
   int iRandomOptionKindIndex = GetRandomOptionKindIndex( eAwakening, PARTS_RWEAPON || PARTS_SHIELD + i );
   for( int l = 0;[COLOR=#ff0000] l < 6[/COLOR]; l++ )
    if( pRandomOption->nDst == anDst[i][l] )
    {
     RANDOM_OPTION ro( pRandomOption );
     ro.nProb = anTotal[i] + nProb;
     anTotal[i] = ro.nProb;
     m_aRandomOption[iRandomOptionKindIndex].push_back( ro );
}

Not sure through but this should make a bigger chance to succeed than the other method wich i thought allready could be difficult.
 
@Worf: Stop referring him to that function. AwakeningExtension is something added in Version 12. Before that, awakens were only possible on weapons, shields, and suits. That function, applies certain awake stats to Helmets, Gauntlets, and Boots. It has nothing to do with what he wants.

Ok, I've done a bit of extra searching and I've discovered the problem. Only 1 more piece of coding needs to be changed to get this working like kamote wants.

Open WorldServer/DPSrvr.cpp and search for this:
PHP:
			case II_SYS_SYS_SCR_AWAKE:
				{
					b	= DoUseItemTarget_GenRandomOption( pUser, pTarget, CRandomOptionProperty::eAwakening, 
						0, TID_GAME_INVALID_TARGET_ITEM, TID_GAME_AWAKE_OR_BLESSEDNESS01,
						"r", "::Awake" );
				}
				break;

Change that to look like this:
PHP:
			case II_SYS_SYS_SCR_AWAKE:
				{
#ifdef __WEAP_OWN_AWAKE
					if( pTarget->GetProp()->dwParts == PARTS_RWEAPON || pTarget->GetProp()->dwParts == PARTS_SHIELD )
						b	= DoUseItemTarget_GenRandomOption( pUser, pTarget, CRandomOptionProperty::eWeapAwakening, 
							0, TID_GAME_INVALID_TARGET_ITEM, TID_GAME_AWAKE_OR_BLESSEDNESS01,
							"r", "::Awake" );
					else
#endif
						b	= DoUseItemTarget_GenRandomOption( pUser, pTarget, CRandomOptionProperty::eAwakening, 
							0, TID_GAME_INVALID_TARGET_ITEM, TID_GAME_AWAKE_OR_BLESSEDNESS01,
							"r", "::Awake" );
				}
				break;

Put that in, and I guarantee it will work.

(Ignore that it's a PHP block. That was just for the coloring to make it easier to read)
 
Last edited:
HOLY ****!! hahahaha.. sorry bout that.. It did work.. :w00t:
Thank you guys.. can I remove the first post?
Again, thank you so much guys..

Edit:

oh I forgot to tell.. I tweaked the:
Code:
#ifdef __WEAP_OWN_AWAKE
                    if( pTarget->GetProp()->dwParts == PARTS_RWEAPON || pTarget->GetProp()->dwParts == PARTS_SHIELD )
                        b    = DoUseItemTarget_GenRandomOption( pUser, pTarget, CRandomOptionProperty::eWeapAwakening, 
                            0, TID_GAME_INVALID_TARGET_ITEM, TID_GAME_AWAKE_OR_BLESSEDNESS01,
                            "r", "::Awake" );
                    else
#endif

cause I have the baruna awakening.. and I added eWeapAwakening to the II_SYS_SYS_SCR_AWAKECANCEL so I can remove the awakenings..

Thanks again guys..
 
HOLY ****!! hahahaha.. sorry bout that.. It did work.. :w00t:
Thank you guys.. can I remove the first post?
Again, thank you so much guys..

Edit:

oh I forgot to tell.. I tweaked the:
Code:
#ifdef __WEAP_OWN_AWAKE
                    if( pTarget->GetProp()->dwParts == PARTS_RWEAPON || pTarget->GetProp()->dwParts == PARTS_SHIELD )
                        b    = DoUseItemTarget_GenRandomOption( pUser, pTarget, CRandomOptionProperty::eWeapAwakening, 
                            0, TID_GAME_INVALID_TARGET_ITEM, TID_GAME_AWAKE_OR_BLESSEDNESS01,
                            "r", "::Awake" );
                    else
#endif

cause I have the baruna awakening.. and I added eWeapAwakening to the II_SYS_SYS_SCR_AWAKECANCEL so I can remove the awakenings..

Thanks again guys..

We can better make this a tutorial for a lil source edit as result, dun you agree Shadow?
Who is willing to make a lil tut about this? If none do i will within the next 24hours.
 
yeah.. maybe i'll do one.. i'm kinda new in RZ.. so.. yeah.. maybe tomorrow i'll post one.. :) in the release section right?
 
Status
Not open for further replies.
Back