BH/RECV/X SCD SCRIPTING

Moderators: pcwzrd13, deluxux, VasiliyRS

Kapdap
noob
Posts: 1

Re: BH/RECV/X SCD SCRIPTING

Post#21 » Sat Jan 20, 2024 6:00 am

Hi @cbnj. This maybe of interest to you https://github.com/kapdap/re-cvx-tools/ ... ripting.md

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#22 » Sun Jan 21, 2024 5:27 am

Kapdap

Hello! Oh ps2 codes :) this can be useful for me and for everyone interested, yes, i dont knew it was already decoded, im glad to see most of the opcodes are like i supposed they were to, altough the name i gave them is diferent since i was naming them as i found them ^^ by example the 0D check, yes it checks if enemy is dead but also links the enemy dead checker whit a specified enemy line in the enemy table thus i named it enemy linker and i was to explain its function in the scripts examples, the 12 one i named it event line, this info is very valuable and very needed, feel free to add usage examples on how to implemen them in game ^^ and thank you very much!.

(You got added to the opcode list)
Last edited by cbnj on Sun Jan 21, 2024 7:37 am, edited 1 time in total.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#23 » Sun Jan 21, 2024 6:27 am

Game: RECV US D1
BG Room: R0_5530
Modification: unlock doors (Set enemy status)
Files to modify: R0_5530.bin_4_01.yxy
Opcodes to modify: 0503 xx0000xx

battle game consist to beat up enemies to unlock a door and progress the next room, in this example we will set enemies as dead so the door is always unlocked.

How to read enemy set opcode line
0503 is the enemy set opcode, first xx is the id this set enemy line have, 0000 are other values we wont focus rigthnow, the last xx is the value to be set, 1 = alive 0 = dead - this is the value we will focus in this example.

Once you modify your txt script changing those 1's by 0's copy and paste it into your R0_5530.bin_4_01.yxy file, the script file size/length should not change as any space or line break wont be transfered by the hex editor, if the size/length of the script changed you will have to make the changes directly in the hex editor.

This will tell the game the enemies are dead, unlocking the door as you enter the room,
altough they will keep spawning, attack and die if you shoot them down, how this sorcery works is something you will realize as we check up more examples.
Attachments
BEFORE.jpg
BEFORE
AFTER.jpg
AFTER
COPY.jpg
COPY
PASTE.jpg
PASTE
Last edited by cbnj on Sun Jan 21, 2024 10:25 am, edited 1 time in total.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#24 » Sun Jan 21, 2024 10:13 am

Game: RECV US D1
BG Room: R0_5530
Modification: unlock doors (Check enemy status)
Files to modify: R0_5530.bin_4_01.yxy
Opcodes to modify: 0403 xx0000xx

How to read enemy check opcode line
0403 is the enemy check opcode, first xx is the id this check enemy line have, 0000 are other values we wont focus rigthnow, the last xx is the value to be check, 1 = alive 0 = dead - this is the value we will focus in this example.

Once you modify your txt script changing those 0's by 1's copy and paste it into your R0_5530.bin_4_01.yxy file, the script file size/length should not change as any space or line break wont be transfered by the hex editor, if the size/length of the script changed you will have to make the changes directly in the hex editor.

This will tell the game to check for the enemies status to be 1 = alive (previously checking if they where dead by being checking for value 0), unlocking the door as you enter the room.

You could probably notice there is no check status id 00 (0403 00 000000) for enemy set status id 00 (0503 00 000001), this is due that enemy is an explosive barrel and thus is not nessesary to check if you "kill" it to advance to the next room.
Attachments
BEFORE.jpg
AFTER.jpg

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#25 » Sun Jan 21, 2024 12:05 pm

Working whit the enemy linker / enemy table.

Youve seen till now the enemies are set up whit one opcode and checked up whit another being this 0503 and 0403 respectively, but where are stored the enemies and how the game links them whit the script?
This little text will try to explain that.

there are some opcodes in the script which start whit a 0D XX XX XX this are enemy checker / linker to tie the specified enemy in the enemy table whit the desired script set / check opcode, in this case we will keep using rooms R0_5530 as example as this keeps being a very basic and simple room (although you will be amazed whit the quantity of things we can make using only the few lines of codes it holds).
The enemy table is found in the room subfile R0_5530.bin_1_03.yyy this subfile 1_03.yyy will be the same for all the rooms where enemies are present, rooms whit no enemies will lack of this file.
The enemy table structure is as follows: IMAGE1
every line corresponds to an enemy in the room and is composed of 4 main segments as i describe here: IMAGE2
Attachments
IMAGE1.jpg
IMAGE1
IMAGE2.jpg
IMAGE2
Last edited by cbnj on Sun Jan 21, 2024 10:09 pm, edited 1 time in total.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#26 » Sun Jan 21, 2024 3:29 pm

you can see this room holds 7 enemy lines, everyone of them corresponds to one of the "set enemy status" opcode in the script as you can see in the IMAGE3
and this is also present in the enemy "dead" checker / linker opcodes 0D IMAGE4

The last opcodes in both areas are for item, being 050700000001 the set item opcode and 0E000000 the item checker / linker (to discuss about it when we reach their section), thats why those 2 lines dont enter in this section rigthnow

the structure of the 0D enemy checker/linker is as follows:
0D-XX-XX-XX = 0D-number of the enemy line to work whit in the enemy table-ID for this checker-expected value to check and compare whit the enemy status check opcode.
Attachments
IMAGE3.jpg
IMAGE3
IMAGE4.jpg
IMAGE4
Last edited by cbnj on Sun Jan 21, 2024 5:37 pm, edited 3 times in total.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#27 » Sun Jan 21, 2024 4:17 pm

Here i show an image on how the table and the script element mix up together, the linkage wont always be direct and the enemy IDs wont always be sorted up in ascending way, but everything at its own time, for now i think this shows how it works.

The status checkup for the enemy status (0403 00 000000) of line 1 (0hex) is not present as this is a explosive barrel (ENEMY TYPE 00) thus dont needs to be killed to advance and thus dont need to be checked by the status chek opcode, but the rest of the enemies are zombies (ENEMY TYPE 01) and this ones do need to be checked by the status check opcode and, all of them tough need to be declared and linked/monitored by the 0503 and the 0D opcodes.

the question you should be doing your self by now.... its all this necessary? my head starting to hurt...
the answer you so much wanted to get NOPE! all this is not necessary...... for normal game at least, but for battle mode it is necessary because you need to put conditionals to open the doors, in battle game the enemies are the conditionals, for normal game the conditionals are items as keys or objects to be placed somewhere, if you dont setup enemies in script they will become infinite in normal game, respawning everytime you enter a room.
Attachments
WORFLOW.jpg

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#28 » Tue Jan 23, 2024 5:32 pm

CONDITIONALS

Now is time to meet the conditionals (also known as "if" statements), conditionals in cv scd are specified by the opcode 01+the total hex lenght of the conditional code you will write to reach the "if" end wich is marked by a 0300 opcode, this is a example:

010E 040301000000 050301000001 0300

The previous line reads: if the enemy in line 2 of the enemy table is dead set its value to be show as alive, end the if statement, and the length of the line of code to reach the "if end" is 0E starting to count from the "if start" (01)

"If" statements can work as stand alone as the example above, but the most usual way you will find them and use it is working together whit a 02 "else" opcode + the length of the else line of code, this works exactly as the "if" statement but aims to tell the game to do a second action while the first one stated by the "if" is not met.

0110 040301000000 050301000001 0000 020A 050301000001 0300
This line reads: if enemy of line 2 of the enemy table is dead, set it as to be alive, else set it as alive.

If you examine the previous line you will find there is now a line of 0000 where previously used to be the 0300 if end opcode, then starts the 02 opcode, this is because you are telling the game to stop readind opcodes there, thats what the 0000 opcode means, stop reading opcodes here, also the "if" lenght now aims to the 02 opcode after the 0000 line, and the "else" lenght aims to the next opcode after the "if end" opcode 0300

Once you learn this base you have 80% of the scripthing earned and we can start to create custom scripts for the rooms :)

Note 1: i write "the enemy of line 2 of the enemy table" because thats the enemy which is linked trough the 0D010100 line, in the R0_5530 script, the 01 after 0503 is the id for that set enemy status line itself, something you already know if you followed the previous examples ;)

Note 2: altough the if end seems to be comprensive is not actualy an if end but a loop line, i already checked this because there exist if statements whit no if ends, but use a diferent terminator wich are 0000, 0100, 0200 and 0300, the 03 is more like a looping operand but i leave its name as "if end" to be the most similar to previous RE games and for easier understanding, you can directly loop a line of code adding the 0300 to the end but this out of the scope for now.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#29 » Wed Jan 24, 2024 1:22 pm

SET OPCODE 25 AND TRIGGER TABLE

before to continue lets meet some other important aspects of the script and the tables, another line we will find in this and other rooms scripts is the set opcode 25, in battle mode this opcode is used mainly for doors and is formed by 2 octets length.
25 xx xx xx xx xx xx xx
one ability of this opcode is to turn it self into a door or tell the game to execute a line in the triggers table which is linked to this opcode trough a tag number.

in our R0_5530 script it appears in this way,

0130
040301000000
040302000000
040303000000
040304000000
040305000000
040306000000
25000000 05360002 0000
020C
25000080 00000000 0300

which ill describe the best i can

0130 - if
040301000000 |
040302000000 |
040303000000 |- all this conditions are true
040304000000 |
040305000000 |
040306000000 |
25-00-0000-05-36-00-02-0000 set (25)- the trigger 1 of the trigger table (00)- not relevant (0000)-to be a door to send you to area 5 (05)- room 54 (36)- using the player spawn coordinates 1 of that room (00)- using the transition door number 2 (02)- stop reading opcodes (0000)
020C else (if the conditions are not true)
25000080 00000000 0300 set (25)- the trigger 1 of the trigger table (00) - not relevant (00) to execute its normal function (80) and ignore the rest of the line which is 00000000

which one is the trigger table you would be asking, well its the subfile 1_08.yyy, in this case it will be R0_5530.bin_1_08.yyy
as the image show, to be read at 9 octets length, the trigger table can hold different kind of triggers, in this case it only holds 2 types, the text trigger denoted by the 0103 trigger headers and a pick-able item denoted by the 0104 trigger header.
Attachments
TRIGGER_TABLE.jpg
Last edited by cbnj on Wed Jan 24, 2024 1:44 pm, edited 1 time in total.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#30 » Wed Jan 24, 2024 1:42 pm

The trigger table structure is as follows:
(this time i dont specify the flags because the are many of them to use)
Attachments
TRIGGER_STRUCTURE.jpg

  • Similar Topics
    Replies
    Views
    Last post

Return to “Modifications”

Who is online

Users browsing this forum: No registered users