Opcodes: Difference between revisions
No edit summary |
No edit summary |
||
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Opcodes are the commands used in LIN scripts to make things happen in the game. | Opcodes are the commands used in LIN scripts to make things happen in the game. In the native LIN format of the game, opcodes are hexadecimal bytes. SPIRAL converts these to a more human readable format. | ||
==Change UI== | |||
See: [[UI Elements]] | |||
==Restart Script== | |||
LIN Hex Opcode: <code>0x1C</code> | |||
This opcode will restart the current script file from the beginning. | |||
===Notes=== | |||
* SPIRAL currently does not support this opcode and it must be used via its hexadecimal. | |||
==Screen Flash== | |||
LIN Hex Opcode: <code>0x1F</code> | |||
This opcode is used to make the screen flash with a certain colour. It takes seven arguments. | |||
{| class="wikitable" | |||
!Argument | |||
!Purpose | |||
|- | |||
|1 | |||
|Red Component (0-255) | |||
|- | |||
|2 | |||
|Green Component (0-255) | |||
|- | |||
|3 | |||
|Blue Component (0-255) | |||
|- | |||
|4 | |||
|Fade in duration | |||
|- | |||
|5 | |||
|Hold duration | |||
|- | |||
|6 | |||
|Fade out duration | |||
|- | |||
|7 | |||
|Opacity | |||
|- | |||
|} | |||
===Examples=== | |||
<pre>0x1F|255, 0, 0, 4, 60, 10, 255</pre> | |||
This code would make the screen completely fade to red over a period of 4 frames, stay that way for 60 frames, and then fade back to normal over a period of 10 frames. | |||
<pre>0x1F|255, 255, 255, 4, 0, 30, 255</pre> | |||
This code would cause the screen to very quickly flash white. | |||
<pre>SFX A|0, 26, 100 | |||
0x1F|255, 255, 255, 4, 0, 30, 255</pre> | |||
This code would cause a "realisation" screen flash with a sound effect. | |||
===Notes=== | |||
* SPIRAL currently does not support this opcode and it must be used via its hexadecimal. | |||
==Set Flag== | |||
Used to enable or disable flags. | |||
See: [[Flag IDs]] | |||
==Set Game State== | |||
Used to change the value of game state variables. | |||
See: [[Set Game State]] | |||
== Set Title == | == Set Title == | ||
LIN Hex Opcode: <code>0x0F</code> | LIN Hex Opcode: <code>0x0F</code> | ||
This opcode is used in scripts to change the Special Ability entry in the report card of a given character. | |||
{| class="wikitable" | {| class="wikitable" | ||
!Argument | !Argument | ||
Line 19: | Line 86: | ||
|Special Ability Variation | |Special Ability Variation | ||
|} | |} | ||
The used arguments are then placed into the equation <code>arg1 + (arg3 * 15)</code>, and the code finds the file in 10_Special.pak with the corresponding number | The used arguments are then placed into the equation <code>arg1 + (arg3 * 15)</code>, and the code finds the file in 10_Special.pak with the corresponding number. | ||
=== Examples === | === Examples === | ||
Line 27: | Line 94: | ||
* This opcode should be called for every character at trial preparation screens in order to ensure that all the characters have the correct ability set at the start of trials. | * This opcode should be called for every character at trial preparation screens in order to ensure that all the characters have the correct ability set at the start of trials. | ||
* Near the end of Trial 6 in Danganronpa 1, Makoto (Character 0) is supposed to have their special set to "Ultimate Hope". The game reads from file 15, which mistakenly contains "Ultimate Despair" instead. So, be warned that in DR1 character 15 DOES NOT use the 10_Special PAK as they do not have a report card page and thus their Special should not be included. | * Near the end of Trial 6 in Danganronpa 1, Makoto (Character 0) is supposed to have their special set to "Ultimate Hope". The game reads from file 15, which mistakenly contains "Ultimate Despair" instead. So, be warned that in DR1 character 15 DOES NOT use the 10_Special PAK as they do not have a report card page and thus their Special should not be included. | ||
== SFX A == | |||
{{todo|Make a list of useful common SFX for DR1 and DR2}} | |||
LIN Hex Opcode: <code>0x0A</code> | |||
This opcode is used in scripts to play sound effects. Sound effect IDs correspond to the sound effect filenames found in <code>/data/all/se/</code>. It takes three arguments. | |||
{| class="wikitable" | |||
!Argument | |||
!Purpose | |||
|- | |||
|1 | |||
|Short | |||
|- | |||
|2 | |||
|Sound ID | |||
|- | |||
|3 | |||
|Volume Percentage | |||
|} | |||
As this opcode uses a short, the final ID is calculated by finding <code>(argument1 * 256) + argument2</code> | |||
=== Examples === | |||
<pre>SFX A|0, 109, 100</pre> | |||
This code would play sound effect number 109 at max volume. | |||
<pre>SFX A|1, 109, 50</pre> | |||
This code would play sound effect number 365 ((1 * 256) + 109) at half volume. | |||
=== Notes === | |||
* Any sound effect with a corresponding [[loop file]] will loop. | |||
[[Category:Danganronpa: Trigger Happy Havoc]] [[Category: Opcodes]] | [[Category:Danganronpa: Trigger Happy Havoc]] [[Category: Opcodes]] |
Latest revision as of 02:02, 11 October 2018
Opcodes are the commands used in LIN scripts to make things happen in the game. In the native LIN format of the game, opcodes are hexadecimal bytes. SPIRAL converts these to a more human readable format.
Change UI
See: UI Elements
Restart Script
LIN Hex Opcode: 0x1C
This opcode will restart the current script file from the beginning.
Notes
- SPIRAL currently does not support this opcode and it must be used via its hexadecimal.
Screen Flash
LIN Hex Opcode: 0x1F
This opcode is used to make the screen flash with a certain colour. It takes seven arguments.
Argument | Purpose |
---|---|
1 | Red Component (0-255) |
2 | Green Component (0-255) |
3 | Blue Component (0-255) |
4 | Fade in duration |
5 | Hold duration |
6 | Fade out duration |
7 | Opacity |
Examples
0x1F|255, 0, 0, 4, 60, 10, 255
This code would make the screen completely fade to red over a period of 4 frames, stay that way for 60 frames, and then fade back to normal over a period of 10 frames.
0x1F|255, 255, 255, 4, 0, 30, 255
This code would cause the screen to very quickly flash white.
SFX A|0, 26, 100 0x1F|255, 255, 255, 4, 0, 30, 255
This code would cause a "realisation" screen flash with a sound effect.
Notes
- SPIRAL currently does not support this opcode and it must be used via its hexadecimal.
Set Flag
Used to enable or disable flags.
See: Flag IDs
Set Game State
Used to change the value of game state variables.
See: Set Game State
Set Title
LIN Hex Opcode: 0x0F
This opcode is used in scripts to change the Special Ability entry in the report card of a given character.
Argument | Purpose |
---|---|
1 | Character ID |
2 | Seemingly unused |
3 | Special Ability Variation |
The used arguments are then placed into the equation arg1 + (arg3 * 15)
, and the code finds the file in 10_Special.pak with the corresponding number.
Examples
Set Title|10, 0, 1
When this line is read, Toko's special ability would be changed to "Ultimate Writing Prodigy and Murderous Fiend," from file 25 in 10_Special.pak.
Notes
- This opcode should be called for every character at trial preparation screens in order to ensure that all the characters have the correct ability set at the start of trials.
- Near the end of Trial 6 in Danganronpa 1, Makoto (Character 0) is supposed to have their special set to "Ultimate Hope". The game reads from file 15, which mistakenly contains "Ultimate Despair" instead. So, be warned that in DR1 character 15 DOES NOT use the 10_Special PAK as they do not have a report card page and thus their Special should not be included.
SFX A
To do: Make a list of useful common SFX for DR1 and DR2 |
LIN Hex Opcode: 0x0A
This opcode is used in scripts to play sound effects. Sound effect IDs correspond to the sound effect filenames found in /data/all/se/
. It takes three arguments.
Argument | Purpose |
---|---|
1 | Short |
2 | Sound ID |
3 | Volume Percentage |
As this opcode uses a short, the final ID is calculated by finding (argument1 * 256) + argument2
Examples
SFX A|0, 109, 100
This code would play sound effect number 109 at max volume.
SFX A|1, 109, 50
This code would play sound effect number 365 ((1 * 256) + 109) at half volume.
Notes
- Any sound effect with a corresponding loop file will loop.