Project

General

Profile

Bug #4209

Editor: Faction rank sub-table missing from Faction table

Added by David Billiot 6 months ago. Updated 29 days ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Category:
Editor
Target version:
Start date:
11/12/2017
% Done:

0%

Reproducibility:
Always
Operating system:
Other
Severity:
Normal

Description

I appears that PCRANK editing has not been implemented in the editor yet. OpenCS can not view the list of ranks for a faction, edit rank name, or edit rank requirements. Without this ability, creating new factions using OpenCS, while possible, is useless as there is no way to allow a mod to let the PC join or progress through a faction. It also makes creating mods that would alter the progression in factions that came with the base game impossible.

History

#1 Updated by Randy Davin 6 months ago

Confirmed on Windows

#2 Updated by David Billiot 6 months ago

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

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.mAttribute0)
<< " (" << mData.mData.mAttribute0 << ")" << std::endl;
std::cout << " Attribute2: " << attributeLabel(mData.mData.mAttribute1)
<< " (" << mData.mData.mAttribute1 << ")" << 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:

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.

#3 Updated by David Billiot 6 months ago

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

[code]
struct FADTstruct {
// Which attributes we like
int mAttribute2;

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[/code]

Also; in [b]apps/opencs/model/world/data.cpp[/b] 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]mFactions.addColumn (new StringIdColumn&lt;ESM::Faction&gt;);
mFactions.addColumn (new RecordStateColumn&lt;ESM::Faction&gt;);
mFactions.addColumn (new FixedRecordTypeColumn&lt;ESM::Faction&gt; (UniversalId::Type_Faction));
mFactions.addColumn (new NameColumn&lt;ESM::Faction&gt;);
mFactions.addColumn (new AttributesColumn&lt;ESM::Faction&gt; (0));
mFactions.addColumn (new AttributesColumn&lt;ESM::Faction&gt; (1));
mFactions.addColumn (new HiddenColumn&lt;ESM::Faction&gt;);
for (int i=0; i&lt;7; ++i)
mFactions.addColumn (new SkillsColumn&lt;ESM::Faction&gt; (i));
// Faction Reactions
mFactions.addColumn (new NestedParentColumn&lt;ESM::Faction&gt; (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));[/code]

Finally, as i explored [b]apps/opencs/model/world/columnimp.hpp[/b], 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.

#4 Updated by Marth Crowley 6 months ago

loadfact.hpp line 63


  // Name of faction ranks (may be empty for NPC factions)
    std::string mRanks[10];

looks like its there, might not be setup though

#5 Updated by Marth Crowley 6 months ago

There's a template function setup in Columnimp.hpp titled RankColumn that I'll try to use. the way the rank data is handled in loadfact is a little strange, some of the functions in the cpp aren't used, some are, seems like the loadfact(ion) file might not have been setup with the cs in mind. shouldn't be too hard to fix it if i get hacky, but i'd rather make a clean fix.

#6 Updated by Marth Crowley 6 months ago

sorry, i wasn't really sure what you were saying until i started to dig into it, this is a decent sized feature that needs to be fully implemented. It's not just showing something that is already being read from a plugin. There's alot of work involved.

#7 Updated by Alexei Dobrohotov 4 months ago

  • Subject changed from CS can not view or edit PCRANK for factions to Editor: Faction rank list cannot be modified
  • Operating system changed from Linux to Other

#8 Updated by Alexei Dobrohotov about 2 months ago

  • Status changed from New to Confirmed

#9 Updated by Marc Zinnschlag 29 days ago

  • Subject changed from Editor: Faction rank list cannot be modified to Editor: Faction rank sub-table missing from Faction table
  • Target version set to openmw-cs-1.0

Also available in: Atom PDF