18,700
edits
(removed instructions on function usage, as this is covered better by BSL:Manual; rewrote legend and gave it its own section; added note on dump_docs) |
m (→About chr_index: copy-edit) |
||
Line 3: | Line 3: | ||
==About chr_index== | ==About chr_index== | ||
"chr_index" is a means of identifying a character in a level, required by some functions like <tt>chr_focus</tt>. Each character including the player-character has a chr_index associated with him/her. Typically the chr_index is determined by the spawn order of the characters. Characters can be spawned either by scripting or by the engine itself (if the character doesn't have the "NotInitiallyPresent" flag in the [[OBD:BINA/OBJC/CHAR|BINACJBOCharacter]] file). | |||
For example, if this was run after loading the level with no one spawned except Konoko… | |||
<pre> | <pre> | ||
ai2_spawn Muro | ai2_spawn Muro | ||
Line 14: | Line 12: | ||
</pre> | </pre> | ||
…then Muro will receive chr_index 1, Mukade will have index 2 and the Bomber index 3. Konoko always has a chr_index of 0 because she's the first character to be spawned. As the game runs, however, things become more complicated. Once a character is deleted, either by being killed (after which the engine deletes them automatically) or by calling <tt>chr_delete</tt> directly, any characters spawned subsequently will fill in the holes left by the deleted characters. | |||
For example, if this is done… | |||
<pre> | <pre> | ||
ai2_spawn Muro | ai2_spawn Muro | ||
Line 26: | Line 22: | ||
</pre> | </pre> | ||
…Mukade will have index 2, but once he's deleted, his index will be freed up. When Bomber is spawned, he will receive index 2 in order to fill the hole left behind. If you are desperate to reset chr_index assignments for the sake of your scripting, you may want to use <tt>ai2_reset</tt>, which resets all characters to the level's initial state. | |||
{{clearall}} | |||
==Legend== | ==Legend== | ||
{{Fmbox | {{Fmbox |