Skip to content

0x17 — battle_character_entry

Battle/acquisition character-entry command. It resolves a character id, builds a 0x14-byte record from an optional character selector plus three entry words, and inserts it into the same global buffer used by Command_16.

proven— handler traced, and exercised by at least one shipped script.

At a glance

Opcode0x17 (23)
HandlerCRadiScript::Command_17
SignatureCRadiScript::Command_17(int,SCR_DATA*,unsigned int,unsigned int)
Translation unitr_script_run0.cpp
Address— debug build; click for all 3
Handler size0x258 (600 bytes)
Engine namebattle_character_entry
FamilyScript control, flags and values
Command size4 + extra_words * 4 bytes

Handler behaviour

Battle/acquisition character-entry command. It resolves a character id, builds a 0x14-byte record from an optional character selector plus three entry words, and inserts it into the same global buffer used by Command_16.

Encoding

The command header is one 32-bit word, as described in §3 Instruction encoding:

 31            24 23            16 15             8 7              0
+----------------+----------------+----------------+----------------+
|  flags         |  argument byte |  extra words   |  0x17          |
+----------------+----------------+----------------+----------------+

Bits 8–15 give the number of 32-bit operand words that follow. Bits 16–23 are handed to the handler as a bitfield; on character commands bit 0 normally says whether a character selector word is present. Bit 31 is the keep-going bit.

Operand fields

13 documented fields. input fields are read from the command's operand words; derived fields are computed from other fields rather than stored separately.

FieldRoleMeaning
characterinputThe packed 32-bit character selector word. Its low half is the character id and byte 2 is a secondary class/variant input; see character_number and character_variant.
character_numberderivedLow 16 bits of the character selector: the character/actor id.
character_typederivedByte 2 of the character selector, where the handler treats it as a type selector rather than a variant.
entry_byte3derivedByte 2 of entry_word1; record +0x0E.
entry_half0derivedLow half of entry_word0; record +0x08.
entry_half1derivedHigh half of entry_word0; record +0x0A, read back as a signed value.
entry_half2derivedLow half of entry_word1; record +0x0C.
entry_word0inputFirst payload word of the battle order (RADI_BTL_ORDER): its low half lands at record +0x08 and its high half at +0x0A, which the battle character reads back as a signed value.
entry_word1inputSecond payload word: low half to record +0x0C, byte 2 to +0x0E, byte 3 to +0x0F.
entry_word2_highinputThe upper three bytes of the third payload word, which have no reader specific enough to name yet.
leaderinputWhether this character leads its team. It is bits 4-7 of record +0x10, which CBtlCharacter::ChangeLeader extracts and tests for non-zero.
teaminputWhich side this character fights on. It is the low nibble of record +0x10, which CBtlCharacter::ChangeTeamID reads with & 0x0F. Shipped battles use 0 and 1.
yieldderivedPause the script here for one game frame; the next command runs on the following update. Lines without it keep running immediately.

Engine calls

Engine functions this handler was observed calling:

  • CRadiScript::GetCharacterID(unsigned int&,unsigned int&,unsigned int*,SCR_DATA*,unsigned int)
  • memset

Bit masks

Masks the handler applies to its argument byte or operand words:

0x0001