Help- Can't find Factions ranks in OpenCS

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
User avatar
Grilly
Posts: 36
Joined: 14 Feb 2016, 05:00

Help- Can't find Factions ranks in OpenCS

Post by Grilly »

I need to create a new faction for a mod and I'm using OpenCS exclusively since, to my knowledge, Tes3CS does not work in Linux even under Wine.

I can create the faction and set up the favored attributes and skills and even reaction from other factions. However, I can't name the pcrank for each rank level. I opened some of the factions already in the game to see if there was a way to rename pcrank levels and I can't seem to find it. So since I'm apparently blind could someone please let me know where to look. Also, if it hasn't been implemented yet, let me know so I can put that in a bug report.
User avatar
DestinedToDie
Posts: 1181
Joined: 29 Jun 2015, 09:08

Re: Help- Can't find Factions ranks in OpenCS

Post by DestinedToDie »

Hey yeah, seems like we're missing faction ranks or I can't find them.
User avatar
Grilly
Posts: 36
Joined: 14 Feb 2016, 05:00

Re: Help- Can't find Factions ranks in OpenCS

Post by Grilly »

Thanks for getting back to me. I'll put in the bug report.
User avatar
Grilly
Posts: 36
Joined: 14 Feb 2016, 05:00

Re: Help- Can't find Factions ranks in OpenCS

Post by Grilly »

I did some digging in the source code. There is a file at esmtool/record.cpp

Code: Select all

template<>
void Record<ESM::Faction>::print()
{
    std::cout << "  Name: " << mData.mName << std::endl;
    std::cout << "  Hidden: " << mData.mData.mIsHidden << std::endl;
    std::cout << "  Attribute1: " << attributeLabel(mData.mData.mAttribute[0])
              << " (" << mData.mData.mAttribute[0] << ")" << std::endl;
    std::cout << "  Attribute2: " << attributeLabel(mData.mData.mAttribute[1])
              << " (" << mData.mData.mAttribute[1] << ")" << std::endl;
    for (int i = 0; i < 7; i++)
        if (mData.mData.mSkills[i] != -1)
            std::cout << "  Skill: " << skillLabel(mData.mData.mSkills[i])
                      << " (" << mData.mData.mSkills[i] << ")" << std::endl;
    for (int i = 0; i != 10; i++)
        if (mData.mRanks[i] != "")
        {
            std::cout << "  Rank: " << mData.mRanks[i] << std::endl;
            std::cout << "    Attribute1 Requirement: "
                      << mData.mData.mRankData[i].mAttribute1 << std::endl;
            std::cout << "    Attribute2 Requirement: "
                      << mData.mData.mRankData[i].mAttribute2 << std::endl;
            std::cout << "    One Skill at Level: "
                      << mData.mData.mRankData[i].mSkill1 << std::endl;
            std::cout << "    Two Skills at Level: "
                      << mData.mData.mRankData[i].mSkill2 << std::endl;
            std::cout << "    Faction Reaction: "
                      << mData.mData.mRankData[i].mFactReaction << std::endl;
        }
    std::map<std::string, int>::iterator rit;
    for (rit = mData.mReactions.begin(); rit != mData.mReactions.end(); ++rit)
        std::cout << "  Reaction: " << rit->second << " = " << rit->first << std::endl;
    std::cout << "  Deleted: " << mIsDeleted << std::endl;
}
It looks to me like this is the bit that sets up the window for us to edit the factions but as you can see, there is no PCRANK listed here, which is what the game uses as FACTION RANKS. A bit further down in the code I found:

Code: Select all

template<>
void Record<ESM::DialInfo>::print()
{
    std::cout << "  Id: " << mData.mId << std::endl;
    if (mData.mPrev != "")
        std::cout << "  Previous ID: " << mData.mPrev << std::endl;
    if (mData.mNext != "")
        std::cout << "  Next ID: " << mData.mNext << std::endl;
    std::cout << "  Text: " << mData.mResponse << std::endl;
    if (mData.mActor != "")
        std::cout << "  Actor: " << mData.mActor << std::endl;
    if (mData.mRace != "")
        std::cout << "  Race: " << mData.mRace << std::endl;
    if (mData.mClass != "")
        std::cout << "  Class: " << mData.mClass << std::endl;
    std::cout << "  Factionless: " << mData.mFactionLess << std::endl;
    if (mData.mFaction != "")
        std::cout << "  NPC Faction: " << mData.mFaction << std::endl;
    if (mData.mData.mRank != -1)
        std::cout << "  NPC Rank: " << (int)mData.mData.mRank << std::endl;
    if (mData.mPcFaction != "")
        std::cout << "  PC Faction: " << mData.mPcFaction << std::endl;
    // CHANGE? non-standard capitalization mPCrank -> mPCRank (mPcRank?)
    if (mData.mData.mPCrank != -1)
        std::cout << "  PC Rank: " << (int)mData.mData.mPCrank << std::endl;
    if (mData.mCell != "")
        std::cout << "  Cell: " << mData.mCell << std::endl;
    if (mData.mData.mDisposition > 0)
        std::cout << "  Disposition/Journal index: " << mData.mData.mDisposition << std::endl;
    if (mData.mData.mGender != ESM::DialInfo::NA)
        std::cout << "  Gender: " << mData.mData.mGender << std::endl;
    if (mData.mSound != "")
        std::cout << "  Sound File: " << mData.mSound << std::endl;
Someone mentioned the capitalization issue but I honestly don't know what this part of the code does and I haven't found "DialInfo" in the editor yet. In any case, it doesn't look like this part of the code actually lets you edit anything. Therefore, it seems that the faction template above is really what needs to be changed since people will want to edit faction ranks in the faction window anyway.
User avatar
Atahualpa
Posts: 1176
Joined: 09 Feb 2016, 20:03

Re: Help- Can't find Factions ranks in OpenCS

Post by Atahualpa »

When I was working on the editor almost a year ago, I also wanted to include faction ranks. However, I didn't have the time to finish the job -- as well as several other content-related tasks. Maybe after the current release phase...

Anyway, I also created a list which contains all the data fields we need and their current status. E.g., there are a bunch of wrong data types / value ranges assigned to certain fields. If need be, I can share the list with you guys.
aesylwinn
Posts: 243
Joined: 14 Dec 2015, 20:30

Re: Help- Can't find Factions ranks in OpenCS

Post by aesylwinn »

For what its worth, all files relevant to the editor will mostly be in apps/opencs/* and components/*. In your case specifically, apps/opencs/model/world/data.cpp and apps/opencs/model/columnimp.hpp are the relevant files. The apps/esmtool directory is for the executable that can be used to examine esm files.

In components/esm/loadfact.hpp there appears to be a field for the Faction struct named mRanks that can hold 10 names. Perhaps that is the field that needs to be added to the editor?
User avatar
Grilly
Posts: 36
Joined: 14 Feb 2016, 05:00

Re: Help- Can't find Factions ranks in OpenCS

Post by Grilly »

@Atahualpa

Thanks for the help. I'd be happy to look at whatever you have; noting of course that I'm not a programmer so it might not mean much to me. I'm really just opening each file of the source code in a text editor and searching for either Faction or PCRANK.

@aesylwinn

Thanks for directing me to the files. I'll take a look at them as I continue to try and find the correct place to add them to the editor.
User avatar
Grilly
Posts: 36
Joined: 14 Feb 2016, 05:00

Re: Help- Can't find Factions ranks in OpenCS

Post by Grilly »

Just for reference, the bug report I files is Bug #4209 "CS can not view or edit PCRANK for factions". I'm sort of double posting on this because I don't know what I'm doing and would very much appreciate any help I can get.
User avatar
Grilly
Posts: 36
Joined: 14 Feb 2016, 05:00

Re: Help- Can't find Factions ranks in OpenCS

Post by Grilly »

Things I've noticed:
In Comoponents/esm/loadfact.hpp Notice how the line RankData mRankData is lacking the "int" that the other lines have.

Code: Select all

 struct FADTstruct
    {
        // Which attributes we like
        int mAttribute[2];

        RankData mRankData[10];

        int mSkills[7]; // IDs of skills this faction require
                        // Each element will either contain an ESM::Skill index, or -1.

        int mIsHidden; // 1 - hidden from player

        int& getSkill (int index, bool ignored = false);
        ///< Throws an exception for invalid values of \a index.

        int getSkill (int index, bool ignored = false) const;
        ///< Throws an exception for invalid values of \a index.
    }; // 240 bytes
Also; in apps/opencs/model/world/data.cpp I think this is the place that either sets up the list of factions or the individual faction edit window. Notice, rank records are not listed.


Code: Select all

mFactions.addColumn (new StringIdColumn<ESM::Faction>);
    mFactions.addColumn (new RecordStateColumn<ESM::Faction>);
    mFactions.addColumn (new FixedRecordTypeColumn<ESM::Faction> (UniversalId::Type_Faction));
    mFactions.addColumn (new NameColumn<ESM::Faction>);
    mFactions.addColumn (new AttributesColumn<ESM::Faction> (0));
    mFactions.addColumn (new AttributesColumn<ESM::Faction> (1));
    mFactions.addColumn (new HiddenColumn<ESM::Faction>);
    for (int i=0; i<7; ++i)
        mFactions.addColumn (new SkillsColumn<ESM::Faction> (i));
    // Faction Reactions
    mFactions.addColumn (new NestedParentColumn<ESM::Faction> (Columns::ColumnId_FactionReactions));
    index = mFactions.getColumns()-1;
    mFactions.addAdapter (std::make_pair(&mFactions.getColumn(index), new FactionReactionsAdapter ()));
    mFactions.getNestableColumn(index)->addColumn(
        new NestedChildColumn (Columns::ColumnId_Faction, ColumnBase::Display_Faction));
    mFactions.getNestableColumn(index)->addColumn(
        new NestedChildColumn (Columns::ColumnId_FactionReaction, ColumnBase::Display_Integer));
Finally, as i explored apps/opencs/model/world/columnimp.hpp, I didn't see a place there it looked to me like the editor was creating either the list of factions or the individual faction window for editing. BUT of course I may be wrong.
User avatar
AnyOldName3
Posts: 2668
Joined: 26 Nov 2015, 03:25

Re: Help- Can't find Factions ranks in OpenCS

Post by AnyOldName3 »

In Components/esm/loadfact.hpp Notice how the line RankData mRankData is lacking the "int" that the other lines have
That's because mRankData has the type RankData* (the asterisk is because it's a pointer, so it points to an array of 10 RankDatas), whereas other fields, such as mSkills have the type int*. When declaring a variable or field in languages like C++, you need to specify the type of the field.
Post Reply