Author Topic: Marrok/Silverblade Item Creation Limit  (Read 359 times)

Legacy_SVKnight

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Marrok/Silverblade Item Creation Limit
« on: August 15, 2012, 03:29:49 am »


               Are there any ways to increase the amount of times you can create a specific item for those two forgers? I imagine it has something to do with the itemmaker script but I can't really pinpoint what limits the creation of a specific item to only one.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Marrok/Silverblade Item Creation Limit
« Reply #1 on: August 16, 2012, 01:17:14 am »


               Well I have no Idea what Marrok/Silverblade is, So I am going to make an assumption and throw a wild guess,

Assumption: The crafting is being done via a conversation.

It sounds like you are looking at the Action Tacken Script when you should be looking at the Text appears when script.
               
               

               


                     Modifié par Lightfoot8, 16 août 2012 - 12:17 .
                     
                  


            

Legacy_SVKnight

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Marrok/Silverblade Item Creation Limit
« Reply #2 on: August 16, 2012, 03:38:10 am »


               Marrok is the forger inside the Shining Knights Arms and Armour in chapter 1 of the OC. Silverblade is Barun Silverblade, he's the forger in chapter 3.

Yes, the crafting is done through conversation. After checking if there are items in the forge, the guy will then check if a valid item can be made. However, after creating an item once, if you try to create the same item again, it puts you through the conversation where he can't make an item.

This is the script for the valid item:

//::///////////////////////////////////////////////
//:: Valid Item
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Returns true if a valid item can be made.
*/
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: November 2001
//:://////////////////////////////////////////////
#include "NW_O0_ITEMMAKER"

int StartingConditional()
{
    int iResult;

    iResult = GetIsValidCombination(FALSE) == TRUE;
    return iResult;
}

The invalid script is the same except 'GetIsValidCombination(FALSE) == TRUE' is 'GetIsValidCombination(FALSE) == FALSE'.

This is probably the part in itemmaker script where the GetIsValidCombination thing is:

//::///////////////////////////////////////////////
//:: GetCombo
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Returns -1 if an invalid combination otherwise
    returns the index into the array

*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////

int GetIsValidCombination(int bDeleteItem, object oContainer=OBJECT_INVALID)
{
    string sReagent1, sReagent2;
    // * if not container specified then assume the
    // * forge
    if (GetIsObjectValid(oContainer) == FALSE)
    {
        oContainer = GetObjectByTag(GetLocalString(OBJECT_SELF,"NW_L_MYFORGE"));
    }

    object oItem =  GetFirstItemInInventory(oContainer);
    int bValid = GetIsObjectValid(oItem);
    int i = 0;
    int nArrayPosition = -1;
    object oDeleteItem1, oDeleteItem2;

    while (bValid == TRUE)
    {
       i = i + 1;
       if (i == 1)
       {
        sReagent1 = GetTag(oItem);
        oDeleteItem1 = oItem;
       }
       if (i == 2)
       {
        sReagent2 = GetTag(oItem);
        oDeleteItem2 = oItem;
       }
       oItem =  GetNextItemInInventory(oContainer);
       bValid = GetIsObjectValid(oItem);
       if (i > 2)
         bValid = FALSE;

    }

     object oMagicalItem = OBJECT_INVALID;
     object oReagent = OBJECT_INVALID;


     if (IsMisc(oDeleteItem1) == TRUE)
     {
        // * assume other item must be 'magical item'
        oMagicalItem = oDeleteItem2;
        oReagent = oDeleteItem1;
     }
     else
     {
        // * assume first item is the magical item
        oMagicalItem = oDeleteItem1;
        oReagent = oDeleteItem2;
     }

        dbSpeak("reagent " + GetTag(oReagent));
        dbSpeak("magicitem " + GetTag(oMagicalItem));

    // * not enough or too many items
    if ( (i <=0) || (i >= 3) )
    {
        nArrayPosition = -1;
    }
    else
    {
        nArrayPosition = GetItemPosition(oMagicalItem);
       // dbSpeak("armor value : " + IntToString(GetItemACValue(oMagicalItem)));

       // dbSpeak("224 : " + IntToString(nArrayPosition));
        if (nArrayPosition != -1)
        {
            string sArrayReagent1 = GetLocalArrayString(OBJECT_SELF,"NW_COMBO_REAGENT_1", nArrayPosition);
           dbSpeak("Array Reagent1 = " + sArrayReagent1);

            // * Is one of the items the proper BaseItemType
            // * Is one of the items the proper reagent
            if ( (sArrayReagent1 == GetTag(oReagent)) && (IsValidBaseItem(oMagicalItem, nArrayPosition)) )
            {
               // * set the VALIDITEM local
               SetValidItem(nArrayPosition);
               SetValidItemCost(nArrayPosition);
               SetValidItemCostToken(nArrayPosition);


               if (bDeleteItem == TRUE)
               {
                // * blanks out the reward
                    SetLocalArrayString(OBJECT_SELF,"NW_COMBO_REWARD",nArrayPosition,"");
                    // * clear the basetype as well
                    SetLocalArrayInt(OBJECT_SELF,"NW_COMBO_BASETYPE",nArrayPosition,BASE_ITEM_INVALID);
                    //dbSpeak("AFTER DELETE BASE IN ARRAY: " + IntToString(GetLocalArrayInt(OBJECT_SELF,"NW_COMBO_BASETYPE", nArrayPosition)));
                    // * found a match
                    DestroyObject(oDeleteItem1);
                    DestroyObject(oDeleteItem2);
               }
               return TRUE;
            }
            else
            {
                nArrayPosition = -1;
                dbSpeak("DEBUG: Reagent + Basetype not a match");
            }
        }
    }


    // * if there is a valid item then return true
    if (nArrayPosition != -1)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}


               
               

               


                     Modifié par SVKnight, 16 août 2012 - 02:38 .
                     
                  


            

Legacy_SVKnight

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Marrok/Silverblade Item Creation Limit
« Reply #3 on: August 16, 2012, 07:48:27 am »


               Okay, so I think I have a lead on what causes my dilemma.

If I'm correct, this part of the nw_o0_itemmaker script "stores" and/or "retrieves" the information from previously created items

void SetValidItem(int nPos)
{
   SetLocalString(OBJECT_SELF, "M3Q1_VALIDITEM",GetLocalArrayString(OBJECT_SELF,"NW_COMBO_REWARD",nPos));
}
void    SetValidItemCost(int nPos)
{
   SetLocalInt(OBJECT_SELF, "M3Q1_VALIDITEMCOST",GetLocalArrayInt(OBJECT_SELF,"NW_COMBO_REWARD_GOLD",nPos));
}
void  SetValidItemCostToken(int nPos)
{
   SetCustomToken(777, IntToString(GetLocalArrayInt(OBJECT_SELF,"NW_COMBO_REWARD_GOLD",nPos)));
}

string GetValidItem()
{
   return GetLocalString(OBJECT_SELF, "M3Q1_VALIDITEM");
}
int GetValidItemCost()
{
   return GetLocalInt(OBJECT_SELF, "M3Q1_VALIDITEMCOST");
}


And this part compares the above mentioned and check whether or not it is the same item.

//::///////////////////////////////////////////////
//:: GetForgeMatch
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
   Checks to see if the nPos item matches the current
   reward
   USE: For the conversation scripts that tell you
   *which* item can succesfully be made from the forge
*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////

int GetForgeMatch(int nPos)
{
    return GetValidItem() == GetLocalArrayString(OBJECT_SELF,"NW_COMBO_REWARD",nPos);
}


Please correct me if I'm wrong and please tell me what should I do.. I'm not really that good with scripts. >_<