So I want to exactly know the various ways on how to point to a unit or an item’s stat or specifications defined on (bm)item.h and (bm)unit.h in the CLib. There’s the “unit.something” way, but I can’t use that method on everything. What are the ways I can do it?
Like referencing a unit’s available ranks so that later I can give that unit a skill that allows more than two weapon types outside of unit’s ranks
You wouldn’t usually use . unless you’re access the unit’s struct from inside the battle struct. E.g bu->unit.index.
GetUnit is your friend if you want to target a specific unit and don’t have immediate access to the unit struct you need.
You give it a unit index and then it will resolve to that unit’s struct. From there you can just do the usual -> to deference the pointer and access the ranks e.g
Struct Unit * unit = GetUnit(gActionData.targetIndex);
if (unit->ranks[ITYPE_AXE] >= 181) {
SetSkill(unit->index, SKILL_NAME)
}
I’m sort of riffing with the actual code inside the if statement for the setters and getters for skills, you can find the actual code defined somewhere in the buildfile. But that’s generally what you’d do.