dao::Command

class

A command queued on an object (CCObject::QueueCommand).

This is the scripts’ command type, which CommandAttack, CommandWait and the other Command* functions create.

The parameters each type of command carries, as kind and index (int, float, flag, object, string or vector) followed by what the value means:

Attack             object 0 target, int 2 forced result (COMBAT_RESULT_*)
JumpToObject       object 0 target
JumpToLocation     vector 0 position, vector 1 orientation, object 0 area
Wait               int 0 milliseconds (the seconds times 1000, at least 0)
PlayAnimation      int 0 animation, int 2 loops, int 7 blend (0 to blend in,
                   otherwise 2), flag 4 play next
StartConversation  object 0 target, string 0 dialog file
MoveToLocation     vector 0 position, vector 1 orientation, flag 1 run,
                   flag 10 deactivate at end
MoveToObject       object 0 target, float 0 max range (at least the min),
                   float 1 min range, flag 1 run, flag 5 use original
                   position. CommandMoveAwayFromObject makes this type
                   too, with float 4 the distance
UseAbility         int 0 ability, object 0 target (OBJECT_INVALID for a
                   point), vector 0 target point, float 0 conjure time,
                   string 0 ability source, object 1 OBJECT_INVALID
EquipItem          object 0 item, int 0 slot, int 1 weapon set
UnequipItem        object 0 item
UseObject          object 0 target, int 0 action
Deathblow          object 0 target, int 0 death type
SheatheWeapons     int 0 draw (1) or sheathe (0)
SwitchWeaponSets   int 0 weapon set
Turn               vector 0 facing
Fly                vector 0 position, vector 1 orientation

Declared in dao/Objects.h.

Functions

Ability()

std::optional<std::int32_t> Ability() const

Returns the ability of a UseAbility command: an ABILITY_* id, which is its row in the ABI_base table.

Returns the ability, or nullopt for other types and for a command with no parameters

Parameters()

CDataArrays * Parameters()

Returns the command’s parameters, so you can change them before the command starts.

Returns the parameters, or null only for a command the command pool failed to fill

Parameters()

const CDataArrays * Parameters() const

Returns the command’s parameters (see the table above).

Returns the parameters, or null only for a command the command pool failed to fill

PlayerIssued()

bool PlayerIssued() const

Returns whether the player issued the command, the same as GetCommandIsPlayerIssued.

Position()

std::optional<Vector> Position() const

Returns the point the command moves to or aims at: the position of a move, a jump or a flight, or the target point of an ability.

Returns the point, or nullopt for other types and for a command with no parameters

Sequence()

std::uint16_t Sequence() const

Returns the command’s sequence number. Each new command in the game gets the next number.

Static()

bool Static() const

Returns whether the command is static, the bStatic argument of AddCommand.

Target()

std::optional<ObjectId> Target() const

Returns the object the command acts on.

This is object 0 of an attack, a jump to an object, a conversation, a move to an object, an ability, a use or a deathblow.

Returns the target, or nullopt for other types and for a command with no parameters

Type()

core::CommandType Type() const

Returns the command’s type.

WaitMilliseconds()

std::optional<std::int32_t> WaitMilliseconds() const

Returns how long a Wait command waits, in milliseconds.

Returns the time, or nullopt for other types and for a command with no parameters

Word()

std::uint32_t Word() const

Returns the command’s first word, which holds its sequence number and type (dao/core/CommandWord.h).