How to edit NPC with scrolls (IK3_SCROLL)

Newbie Spellweaver
Joined
Oct 18, 2010
Messages
48
Reaction score
12
Hello again. I am using some v18 (custom) files, and something I can't just finish to learn, it's that, how can I add the different kinds of scrolls to sell, in the old fashion way of course, when you edit like that:

Code:
AddVendorItem( 0, IK3_SCROLL, -1, 1, 1, 100 );
AddVendorItem( 1, IK3_SCROLL, -1, 3, 3, 100 );
AddVendorItem( 2, IK3_SCROLL, -1, 2, 2, 100 );

Some kind soul can explain me how can I put the scrolls in the shops like old v15, not with the "AddShopItem( 0, II_SYS_SYS_SCR_SMELPROT, 10000000 );" formula?

I really think I'm missing the key with the second number (1 or 2 or 3 in this case), or perhaps the last one (100 in this case), I don't know really; perhaps I can see some number or index in the specitem or in propitem? I really appreciate any help, any direction into the right way.
 
Code:
//int nItemKind, int nItemKind2, int nNumMax, int nUniqueMin, int nUniqueMax, int nTotalNum, CAnim* pAnimParent, int nMaterialCount )
void CMover::GenerateVendorItem( ItemProp** apItemProp, int* pcbSize, int nMax, LPVENDOR_ITEM pVendor )
{
    CPtrArray* pItemKindAry        = prj.GetItemKindAry( pVendor->m_nItemkind3 );
    ItemProp* pItemProp        = NULL;
    int cbSizeOld    = *pcbSize;

    ASSERT( pVendor->m_nUniqueMin >= 0 );
    ASSERT( pVendor->m_nUniqueMax >= 0 );
    
    if( *pcbSize >= nMax )
        return;

    int nMinIdx    = -1, nMaxIdx    = -1;

    for( int j = pVendor->m_nUniqueMin; j <= pVendor->m_nUniqueMax; j++ )
    {
        nMinIdx        = prj.GetMinIdx( pVendor->m_nItemkind3, j );
        if( nMinIdx != -1 )
            break;
    }
    for( int j = pVendor->m_nUniqueMax; j >= pVendor->m_nUniqueMin; j-- )
    {
        nMaxIdx        = prj.GetMaxIdx( pVendor->m_nItemkind3, j );
        if( nMaxIdx != -1 )
            break;
    }
    if( nMinIdx < 0 )
    {
        WriteError( "VENDORITEM//%s//%d-%d//%d", GetName(), pVendor->m_nUniqueMin, pVendor->m_nUniqueMax, pVendor->m_nItemkind3 );
        return;
    }

    for( int k = nMinIdx; k <= nMaxIdx; k++ )
    {
        pItemProp    = (ItemProp*)pItemKindAry->GetAt( k );

        if( ( NULL == pItemProp ) ||
            ( pItemProp->dwShopAble == (DWORD)-1 ) ||
            ( pVendor->m_nItemJob != -1 && (DWORD)pItemProp->dwItemJob != pVendor->m_nItemJob ) )
            continue;
        
        if( *pcbSize >= nMax )
            break;

        apItemProp[*pcbSize]    = pItemProp;
        (*pcbSize)++;
    }
}

AddVendorItem(0(NPC tab), IK3_SCROLL(Items to sort), -1((-1 is all classes)<- Job required different vales results will very), dwItemRare(Lowest), dwItemRare(Max I believe 200 is cap), 30 (This shows how many items are displayed in the tab) )


in you're case find the item you want in specitems.txt
Crtl+F II_SYS_SYS_SCR_SMELPROT
now make sure dwShopAble is set to 1, dwItemRare is set to something like 200, make sure you set the dwCost keep in mind I believe there is minimum price you must set or you'll get an error in game when you try to purchase it.
Keep in mind I'm only displaying 199 - 200 dwItemRare items listed under IK3_SCROLL and it should only show you 20 in this Tab
AddVendorItem( 0, IK3_SCROLL, -1, 199, 200, 20 );


I'm kinda just going off old knowledge and a quick jump into the source since it's been ages and I'm not a dev take everything I say with a grain of salt.
Merge your character.inc and specitems, reload the world server and take a look?
 
Code:
//int nItemKind, int nItemKind2, int nNumMax, int nUniqueMin, int nUniqueMax, int nTotalNum, CAnim* pAnimParent, int nMaterialCount )
void CMover::GenerateVendorItem( ItemProp** apItemProp, int* pcbSize, int nMax, LPVENDOR_ITEM pVendor )
{
    CPtrArray* pItemKindAry        = prj.GetItemKindAry( pVendor->m_nItemkind3 );
    ItemProp* pItemProp        = NULL;
    int cbSizeOld    = *pcbSize;

    ASSERT( pVendor->m_nUniqueMin >= 0 );
    ASSERT( pVendor->m_nUniqueMax >= 0 );
   
    if( *pcbSize >= nMax )
        return;

    int nMinIdx    = -1, nMaxIdx    = -1;

    for( int j = pVendor->m_nUniqueMin; j <= pVendor->m_nUniqueMax; j++ )
    {
        nMinIdx        = prj.GetMinIdx( pVendor->m_nItemkind3, j );
        if( nMinIdx != -1 )
            break;
    }
    for( int j = pVendor->m_nUniqueMax; j >= pVendor->m_nUniqueMin; j-- )
    {
        nMaxIdx        = prj.GetMaxIdx( pVendor->m_nItemkind3, j );
        if( nMaxIdx != -1 )
            break;
    }
    if( nMinIdx < 0 )
    {
        WriteError( "VENDORITEM//%s//%d-%d//%d", GetName(), pVendor->m_nUniqueMin, pVendor->m_nUniqueMax, pVendor->m_nItemkind3 );
        return;
    }

    for( int k = nMinIdx; k <= nMaxIdx; k++ )
    {
        pItemProp    = (ItemProp*)pItemKindAry->GetAt( k );

        if( ( NULL == pItemProp ) ||
            ( pItemProp->dwShopAble == (DWORD)-1 ) ||
            ( pVendor->m_nItemJob != -1 && (DWORD)pItemProp->dwItemJob != pVendor->m_nItemJob ) )
            continue;
       
        if( *pcbSize >= nMax )
            break;

        apItemProp[*pcbSize]    = pItemProp;
        (*pcbSize)++;
    }
}

AddVendorItem(0(NPC tab), IK3_SCROLL(Items to sort), -1((-1 is all classes)<- Job required different vales results will very), dwItemRare(Lowest), dwItemRare(Max I believe 200 is cap), 30 (This shows how many items are displayed in the tab) )


in you're case find the item you want in specitems.txt
Crtl+F II_SYS_SYS_SCR_SMELPROT
now make sure dwShopAble is set to 1, dwItemRare is set to something like 200, make sure you set the dwCost keep in mind I believe there is minimum price you must set or you'll get an error in game when you try to purchase it.
Keep in mind I'm only displaying 199 - 200 dwItemRare items listed under IK3_SCROLL and it should only show you 20 in this Tab
AddVendorItem( 0, IK3_SCROLL, -1, 199, 200, 20 );


I'm kinda just going off old knowledge and a quick jump into the source since it's been ages and I'm not a dev take everything I say with a grain of salt.
Merge your character.inc and specitems, reload the world server and take a look?
Thank you again to bring some light into this matter. I think I'll try to edit the rarity then, and see what's the end of it.
 
Back