dao::party

The party: who is selected and who the player controls.

Declared in dao/Party.h.

Functions

Controlled()

ObjectId Controlled()

Returns the creature the player controls, the same one the scripts’ GetMainControlled returns.

Call it on the game thread.

Returns its id, or kInvalidObject before a game is loaded

EngineObject()

std::uintptr_t EngineObject()

Returns the engine’s party object, for the library’s own parts that call its functions.

Returns its address, or 0 before a game is loaded

OnControlChanged()

void OnControlChanged(std::function<void(ObjectId before, ObjectId now)> observer)

Registers a callback for when the creature the player controls changes.

It runs on the game thread, in the first frame after the change, whatever caused it. Loading a game reports a change from kInvalidObject to the loaded hero.

Parameter  
observer receives the previously controlled creature and the newly controlled one

ScreenCharacter()

ObjectId ScreenCharacter()

Returns the character the full screens act on, the one their arrows step through: the controlled creature when a screen opens, then whoever its arrows chose.

Call it, and SetScreenCharacter, on the game thread.

Returns its id, or kInvalidObject before a game is loaded

Selected()

std::vector<ObjectId> Selected()

Returns the members selected in the party bar, in the order they were selected.

Call it on the game thread.

Returns the ids, or an empty vector before a game is loaded or if the selection cannot be read

SetScreenCharacter()

bool SetScreenCharacter(ObjectId creature)

Makes a party member the character the full screens act on, as their arrows do, stepping through the members they show.

Control stays where it is. A screen opening chooses the controlled creature again, so set it once the screen is open.

Returns false, with the choice as it was, for a creature the arrows never reach: one not in the party (or, at camp, not among those there), or not one the screens show