Incorporating IGIPE

I want to incorporate “styzygy & hohos” In-Game Item Properties Editor (Forge) from the Pretty Good Character Creator. However, I would like it to utilize ipe_v1.1 or Community patch expanded iprpfeats.2da files.

I’ve currently got it pulling up 383 of the available 817 feats. But I can’t see the variable that I need to change for it to pull up the rest. I was thinking it was in the line 36-39 range, but clearly, I am mistaken. Any input?

(There are about 58 scripts associated with this thing, but I feel like i’ve narrowed the issue down to this one)

#include "fcb_inc_prot"

//==========================================/
//create all
//==========================================/

//==========================================/
void array_main()
//==========================================/
    {
    //2DA file rows that will be read
    //range: [lower bound 31:16][upper bound 15:0]
    //invalid rows may be included - they are skipped during read.
    SetLocalInt(FCB_HOST, "IPRP_ABILITIES_0", 5);
    SetLocalInt(FCB_HOST, "IPRP_ACMODTYPE_0", 4);
    SetLocalInt(FCB_HOST, "IPRP_ALIGNGRP_0", 5);
    SetLocalInt(FCB_HOST, "IPRP_ALIGNMENT_0", 8);
    SetLocalInt(FCB_HOST, "IPRP_AMMOCOST_0", 15);
    SetLocalInt(FCB_HOST, "IPRP_AMMOTYPE_0", 2);
    SetLocalInt(FCB_HOST, "IPRP_AMOUNT_0", 4);
    SetLocalInt(FCB_HOST, "IPRP_ARCSPELL_0", 19);
    //SetLocalInt(FCB_HOST, "IPRP_BASE1_0", 0);
    SetLocalInt(FCB_HOST, "IPRP_BLADECOST_0", 5);
    SetLocalInt(FCB_HOST, "IPRP_BONUSCOST_0", 12);
    SetLocalInt(FCB_HOST, "IPRP_CHARGECOST_0", 13);
    SetLocalInt(FCB_HOST, "IPRP_COLOR_0", 6);
    SetLocalInt(FCB_HOST, "IPRP_COMBATDAM_0", 2);
    SetLocalInt(FCB_HOST, "IPRP_COSTTABLE_0", 27);

    SetLocalInt(FCB_HOST, "IPRP_DAMAGECOST_0", 30);
    SetLocalInt(FCB_HOST, "IPRP_DAMAGECOST_1", 71 << BITLEN_2DA_RANGE | 80); //PRC

    SetLocalInt(FCB_HOST, "IPRP_DAMAGETYPE_0", 14); //13
    SetLocalInt(FCB_HOST, "IPRP_DAMVULCOST_0", 7);

    SetLocalInt(FCB_HOST, "IPRP_FEATS_0", 39);
    SetLocalInt(FCB_HOST, "IPRP_FEATS_1", 250 << BITLEN_2DA_RANGE | 254); //PRC
    SetLocalInt(FCB_HOST, "IPRP_FEATS_2", 271 << BITLEN_2DA_RANGE | 385); //PRC
    SetLocalInt(FCB_HOST, "IPRP_FEATS_3", 399 << BITLEN_2DA_RANGE | 570); //PRC

    SetLocalInt(FCB_HOST, "IPRP_IMMUNCOST_0", 7);
    SetLocalInt(FCB_HOST, "IPRP_IMMUNITY_0", 9);
    SetLocalInt(FCB_HOST, "IPRP_KITCOST_0", 50);
    SetLocalInt(FCB_HOST, "IPRP_LIGHTCOST_0", 4);
    SetLocalInt(FCB_HOST, "IPRP_MELEECOST_0", 20);
    SetLocalInt(FCB_HOST, "IPRP_MONSTCOST_0", 58);
    SetLocalInt(FCB_HOST, "IPRP_MONSTERHIT_0", 9);
    SetLocalInt(FCB_HOST, "IPRP_NEG10COST_0", 10);
    SetLocalInt(FCB_HOST, "IPRP_NEG5COST_0", 10); //PRC 10
    SetLocalInt(FCB_HOST, "IPRP_ONHIT_0", 25);
    SetLocalInt(FCB_HOST, "IPRP_ONHITCOST_0", 70); //PRC 70

    SetLocalInt(FCB_HOST, "IPRP_ONHITDUR_0", 4); //PRC 20
    SetLocalInt(FCB_HOST, "IPRP_ONHITDUR_1", 20 << BITLEN_2DA_RANGE | 20);

    SetLocalInt(FCB_HOST, "IPRP_ONHITSPELL_0", 140); //PRC 202
    SetLocalInt(FCB_HOST, "IPRP_ONHITSPELL_1", 200 << BITLEN_2DA_RANGE | 202);

    SetLocalInt(FCB_HOST, "IPRP_PARAMTABLE_0", 11);
    SetLocalInt(FCB_HOST, "IPRP_POISON_0", 5);
    SetLocalInt(FCB_HOST, "IPRP_PROTECTION_0", 19);
    SetLocalInt(FCB_HOST, "IPRP_REDCOST_0", 5);

    SetLocalInt(FCB_HOST, "IPRP_RESISTCOST_0", 10); //PRC 20
    SetLocalInt(FCB_HOST, "IPRP_RESISTCOST_1", 20 << BITLEN_2DA_RANGE | 20);

    SetLocalInt(FCB_HOST, "IPRP_SAVEELEMENT_0", 21);
    SetLocalInt(FCB_HOST, "IPRP_SAVINGTHROW_0", 3);
    SetLocalInt(FCB_HOST, "IPRP_SKILLCOST_0", 50);
    //SetLocalInt(FCB_HOST, "IPRP_SLOTSCOST_0", 0);
    SetLocalInt(FCB_HOST, "IPRP_SOAKCOST_0", 13); //PRC 13
    SetLocalInt(FCB_HOST, "IPRP_SPELLCOST_0", 242); //PRC 242
    SetLocalInt(FCB_HOST, "IPRP_SPELLCSTR_0", 39);
    SetLocalInt(FCB_HOST, "IPRP_SPELLLVCOST_0", 9);
    SetLocalInt(FCB_HOST, "IPRP_SPELLLVLIMM_0", 9);

    SetLocalInt(FCB_HOST, "IPRP_SPELLS_0", 500); //PRC 1138
    SetLocalInt(FCB_HOST, "IPRP_SPELLS_1", 511 << BITLEN_2DA_RANGE | 569);
    SetLocalInt(FCB_HOST, "IPRP_SPELLS_2", 600 << BITLEN_2DA_RANGE | 802);

    SetLocalInt(FCB_HOST, "IPRP_SPELLSHL_0", 7);
    SetLocalInt(FCB_HOST, "IPRP_SRCOST_0", 60); //PRC 60

    //SetLocalInt(FCB_HOST, "IPRP_STAMINACOAT_0", 0);
    //SetLocalInt(FCB_HOST, "IPRP_TERRAINTYPE_0", 0);
    SetLocalInt(FCB_HOST, "IPRP_TRAPCOAT_0", 11);
    SetLocalInt(FCB_HOST, "IPRP_TRAPS_0", 4);
    SetLocalInt(FCB_HOST, "IPRP_VISUALFX_0", 6);
    SetLocalInt(FCB_HOST, "IPRP_WALK_0", 1);
    SetLocalInt(FCB_HOST, "IPRP_WEIGHTCOST_0", 5);
    SetLocalInt(FCB_HOST, "IPRP_WEIGHTINC_0", 5);

    //--------------------------------------/
    SetLocalInt(FCB_HOST, "itempropdef_0", 84);
    SetLocalInt(FCB_HOST, "itemprops_0", 84);
    SetLocalInt(FCB_HOST, "itemvalue_0", 59);

    SetLocalInt(FCB_HOST, "Classes_0", 38); //PRC 254
    SetLocalInt(FCB_HOST, "Classes_1", 51 << BITLEN_2DA_RANGE | 56);
    SetLocalInt(FCB_HOST, "Classes_2", 65 << BITLEN_2DA_RANGE | 105);
    SetLocalInt(FCB_HOST, "Classes_3", 113 << BITLEN_2DA_RANGE | 134);
    SetLocalInt(FCB_HOST, "Classes_4", 149 << BITLEN_2DA_RANGE | 181);

    SetLocalInt(FCB_HOST, "racialtypes_0", 253); //CEP+PRC 253
    SetLocalInt(FCB_HOST, "skills_0", 26);
    SetLocalInt(FCB_HOST, "Skills_0", 26);

    SetLocalInt(FCB_HOST, "disease_0", 16);

    SetLocalInt(FCB_HOST, "poison_0", 44); //PRC 114
    SetLocalInt(FCB_HOST, "poison_1", 100 << BITLEN_2DA_RANGE | 114);

    SetLocalInt(FCB_HOST, "gender_0", 4);

    //--------------------------------------/
    //--------------------------------------/
    menu_main();
    chcnt_main();

    DelayCommand(0.0, iprp_main(0, 20));
    DelayCommand(0.0, iprp_main(21, 50));
    DelayCommand(0.0, iprp_main(51, 84));
    }

//==========================================/
//main/sub menues
//==========================================/

//==========================================/
void menu_main()
//==========================================/
    {
        {
        int file_type_iprp = create_main_file_type_link(MAIN_FOLDER_INDEX_IPRP) | SCRIPT_INDEX_DISP_IPRP;
        create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_IPRP_ENTER, file_type_iprp);
        }

        {
        int file_type_iprpr = create_main_file_type_link(MAIN_FOLDER_INDEX_IPRPR) | SCRIPT_INDEX_DISP_IPRP;
        create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_IPRPR_ENTER, file_type_iprpr);
        }

        {
        int file_type = create_main_file_type_link(MAIN_FOLDER_INDEX_CHARGE) | SCRIPT_INDEX_DISP_HEADER;
        create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_CHARGE_ENTER + UI_TXT_INDENT, file_type);
        }

        //--------------------------------------/
        {
        int file_type = create_main_file_type_link(MAIN_FOLDER_INDEX_DUPE) | SCRIPT_INDEX_DUPE_SEL_0;
        create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_DUPE_ENTER, file_type);
        }

        {
        int file_type = create_main_file_type_link(MAIN_FOLDER_INDEX_SETNAME) | SCRIPT_INDEX_LISTEN_SETNAME;
        create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_SETNAME_ENTER, file_type);
        }

        {
        int file_type = create_main_file_type_link(MAIN_FOLDER_INDEX_COLORGUIDE) | SCRIPT_INDEX_COLORGUIDE;
        create_main_file_int(MAIN_FOLDER_INDEX_MAINMENU, UI_TXT_COLORGUIDE_ENTER, file_type);
        }

        set_main_folder_index_start(MAIN_FOLDER_RESERVE_INDEX);

        //--------------------------------------/
        //--------------------------------------/
        {
        create_main_file_int(MAIN_FOLDER_INDEX_IPRP_MENU, UI_TXT_IPRP_MENU_ADD_NORMAL, SCRIPT_INDEX_IPRP_SEL_1);
        }

        {
        create_main_file_int(MAIN_FOLDER_INDEX_IPRPR_MENU, UI_TXT_IPRPR_MENU_REMOVE, SCRIPT_INDEX_IPRPR_SEL_1);
        }

        //--------------------------------------/
        {
        create_main_file_int(MAIN_FOLDER_INDEX_SETNAME, UI_TXT_SETNAME_MENU_ACCEPT, SCRIPT_INDEX_SETNAME_SEL_1);
        create_main_file_int(MAIN_FOLDER_INDEX_SETNAME, UI_TXT_SETNAME_MENU_REENTER, SCRIPT_INDEX_LISTEN_SETNAME);
        create_main_file_int(MAIN_FOLDER_INDEX_SETNAME, UI_TXT_SETNAME_MENU_DEFAULT, SCRIPT_INDEX_SETNAME_DEFAULT);
        }

        {
        create_main_file_int(MAIN_FOLDER_INDEX_CHARGE_MENU, UI_TXT_CHARGE_MENU_SET, SCRIPT_INDEX_CHARGE_SEL_1);
        }

        {
        create_main_file_int(MAIN_FOLDER_INDEX_DUPE, UI_TXT_DUPE_MENU_ACCEPT, SCRIPT_INDEX_DUPE_SEL_1);
        }
    }

//==========================================/
//item properties
//==========================================/

//==========================================/
void iprp_main(int iprp_main_row, int iprp_main_endrow)
//==========================================/
    {
    int folder_index = MAIN_FOLDER_INDEX_IPRP;
    int file_type_menu = create_main_file_type_link(SCRIPT_INDEX_IPRP_SEL_0 | MAIN_FOLDER_INDEX_IPRP_MENU);

    while(iprp_main_row <= iprp_main_endrow)
        {
        string subtype_strref = Get2DAString("itempropdef", "Name", iprp_main_row);
        string subtype_resref = Get2DAString("itempropdef", "SubTypeResRef", iprp_main_row);

        string costtable_resref = "";
        string costtable_row = Get2DAString("itempropdef", "CostTableResRef", iprp_main_row);
        if(costtable_row != "" && costtable_row != "0")
            {
            costtable_resref = Get2DAString("IPRP_COSTTABLE", "Name", StringToInt(costtable_row));
            }

        string paramtable_resref = "";
        string paramtable_row = Get2DAString("itempropdef", "Param1ResRef", iprp_main_row);
        if(paramtable_row != "")
            {
            paramtable_resref = Get2DAString("IPRP_PARAMTABLE", "TableResRef", StringToInt(paramtable_row));
            }

        int folder_target = 0;
        if(subtype_resref != "")
            {
            folder_target = iprp_subtype_file(subtype_resref, costtable_resref, paramtable_resref, file_type_menu);
            }
        else if(costtable_resref != "" || paramtable_resref != "")
            {
            folder_target = iprp_cost_param1_file(costtable_resref, paramtable_resref, file_type_menu);
            }

        int file_type = create_main_file_type_link(folder_target, file_type_menu);
        create_main_file_int(folder_index, GetStringByStrRef(StringToInt(subtype_strref)), file_type, iprp_main_row);

        iprp_main_row++;
        }
    }

//==========================================/
int iprp_subtype_file(string subtype_resref, string costtable_resref, string paramtable_resref, int file_type_menu)
//==========================================/
    {
    int folder_index = GetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX_LINK_ + subtype_resref + costtable_resref + paramtable_resref);
    if(folder_index < 1)
        {
        folder_index = create_main_folder(subtype_resref + costtable_resref + paramtable_resref);

        int folder_target = iprp_cost_param1_file(costtable_resref, paramtable_resref, file_type_menu);
        //----------------------------------------//
        int block = 0;
        int subtype_range = GetLocalInt(FCB_HOST, subtype_resref + UI_TXT_UNDERSCORE + "0");

        while(subtype_range > 0)
            {
            int subtype_endrow = FILTER_R1 & subtype_range;
            int subtype_row = subtype_range >>> BITLEN_2DA_RANGE;

            while(subtype_row <= subtype_endrow)
                {
                string subtype_strref = Get2DAString(subtype_resref, "Name", subtype_row);
                if(subtype_strref != "")
                    {
                    int file_type = 0;
                    //param1 override
                    //----------------------------------------//
                    string paramtable_row = Get2DAString(subtype_resref, "Param1ResRef", subtype_row);
                    if(paramtable_row != "")
                        {
                        string paramtable_resref_override = Get2DAString("IPRP_PARAMTABLE", "TableResRef", StringToInt(paramtable_row));
                        int folder_target_override = iprp_cost_param1_file(costtable_resref, paramtable_resref_override, file_type_menu);

                        file_type = create_main_file_type_link(folder_target_override, file_type_menu);
                        }
                    //----------------------------------------//
                    else
                        {
                        file_type = create_main_file_type_link(folder_target, file_type_menu);
                        }

                    create_main_file_int(folder_index, GetStringByStrRef(StringToInt(subtype_strref)), file_type, subtype_row);
                    }
                subtype_row++;
                }

            block++;
            subtype_range = GetLocalInt(FCB_HOST, subtype_resref + UI_TXT_UNDERSCORE + IntToString(block));
            }
        }

    return folder_index;
    }

//==========================================/
int iprp_cost_param1_file(string costtable_resref, string paramtable_resref, int file_type_menu)
//==========================================/
    {
    int folder_index = GetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX_LINK_ + costtable_resref + paramtable_resref);
    if(folder_index < 1)
        {
        int folder_index_cost = 0;
        int folder_index_param1 = 0;

        //----------------------------------------//
        if(paramtable_resref != "")
            {
            folder_index_param1 = GetLocalInt(FCB_HOST, MAIN_FOLDER_INDEX_LINK_ + paramtable_resref);

            if(folder_index_param1 < 1)
                {
                folder_index_param1 = create_main_folder(paramtable_resref);

                int block = 0;
                int param1_range = GetLocalInt(FCB_HOST, paramtable_resref + UI_TXT_UNDERSCORE + "0");

                while(param1_range > 0)
                    {
                    int param1_endrow = FILTER_R1 & param1_range;
                    int param1_row = param1_range >>> BITLEN_2DA_RANGE;

                    while(param1_row <= param1_endrow)
                        {
                        string param1_strref = Get2DAString(paramtable_resref , "Name", param1_row);
                        if(param1_strref != "")
                            {
                            create_main_file_int(folder_index_param1, GetStringByStrRef(StringToInt(param1_strref)), file_type_menu, param1_row);
                            }
                        param1_row++;
                        }

                    block++;
                    param1_range = GetLocalInt(FCB_HOST, paramtable_resref + UI_TXT_UNDERSCORE + IntToString(block));
                    }
                }

            folder_index = folder_index_param1;
            }

        //----------------------------------------//
        if(costtable_resref != "")
            {
            folder_index_cost = create_main_folder(costtable_resref + paramtable_resref);

            int block = 0;
            int cost_range = GetLocalInt(FCB_HOST, costtable_resref + UI_TXT_UNDERSCORE + "0");

            while(cost_range > 0)
                {
                int cost_endrow = FILTER_R1 & cost_range;
                int cost_row = cost_range >>> BITLEN_2DA_RANGE;

                while(cost_row <= cost_endrow)
                    {
                    string costtable_strref = Get2DAString(costtable_resref, "Name", cost_row);
                    if(costtable_strref != "")
                        {
                        int file_type = create_main_file_type_link(folder_index_param1, file_type_menu);
                        create_main_file_int(folder_index_cost, GetStringByStrRef(StringToInt(costtable_strref)), file_type, cost_row);
                        }
                    cost_row++;
                    }

                block++;
                cost_range = GetLocalInt(FCB_HOST, costtable_resref + UI_TXT_UNDERSCORE + IntToString(block));
                }

            folder_index = folder_index_cost;
            }
        }

    return folder_index;
    }

//==========================================/
//charge count
//==========================================/

//==========================================/
void chcnt_main()
//==========================================/
    {
    int file_type_menu = create_main_file_type_link(SCRIPT_INDEX_CHARGE_SEL_0 | MAIN_FOLDER_INDEX_CHARGE_MENU);

    //make folders
    //----------------------------------------//
    int n = 1;
    while(n <= ITEM_CHARGE_CNT_MAX)
        {
        create_main_file_int(MAIN_FOLDER_INDEX_CHARGE, IntToString(n) + UI_TXT_UNIT_CHARGE, file_type_menu, n);

        n++;
        }
    }

this part of code will probably allow it, not exactly sure how to modify it though, i would try…

SetLocalInt(FCB_HOST, “IPRP_FEATS”, 1195); (last line in cpp version of iprp_feats)

if that won’t work then

SetLocalInt(FCB_HOST, “IPRP_FEATS_0”, 62); (last vanilla line)
SetLocalInt(FCB_HOST, “IPRP_FEATS_1”, 105 << BITLEN_2DA_RANGE | 1195);

and then recompile all scripts of course

2 Likes

Note that if the ingame ip editor works the way I assume, then CPP is not going to work very well with it as there will be many empty gaps between feats to add since I designed the IDs in a way that each feat can be granted easily using ItempropertyBonusFeat(FEAT_*constant+100); thus the lines in iprp_feats.2da doesn’t follow after and contains multiple empty lines. So either try ipe_v1.1 using same method to make it work as I shown above, or a major rewrite of the IGIPE convo would be needed.

@Shadooow You are a rockstar. Because your CPP and the ipe have different line numbers I used the below.

    SetLocalInt(FCB_HOST, "IPRP_FEATS_0", 43);
    SetLocalInt(FCB_HOST, "IPRP_FEATS_1", 62 << BITLEN_2DA_RANGE | 817); //PRC

Lines 44 to 61 are Mounted feats, DMTools and PlayerTools. It SEEMS to be working perfectly (40 “pages” of 20 feats in conversation).

Thank you so very much!

Ok,
I got the scripts to work in the parent Mod perfectly. However, I am now having problems exporting all the requisite scripts and stuff to get it to work in our Mod. I’ve exported the UTC, placeable, conversation and .nss files that I can tell are associated with this. Imported them into my Mod (in a seperate area). The “there’s no item in the anvil” script fires perfectly. But when i put an item in the anvil then talk to the “helper”, he describes the item in the anvil and only gives the the Done option.

Am I exporting this incorrectly?