BH/RECV/X SCD SCRIPTING

Moderators: pcwzrd13, deluxux, VasiliyRS

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#31 » Wed Jan 24, 2024 3:20 pm

now the most important part for this to work, the tag number.
if you see the line of code which sets the trigger to do its normal job you will have this

25000080 00000000

and if you see the text trigger line number 1 from the room trigger table (subfile 1_08) you get this

01030000 00800000 0000ACC1 00000000 00002EC2 14AEFF40 00000000 18AEDF40 00000000

this two lines despite to be totally different have something in common, the 80 number close to the start of each line, that is how you link them to communicate each other. whit this new knowledge we can understand a little more about how this conditioned scripted door is working in this specific room and this is:

if all the status checked enemies are dead, convert the first text trigger to a door sending you to room 5540 spawning at coordinate set 1 using transition door 02 (05360002) else (if not all the status checked enemies are dead) just execute the text trigger, end the if.

all that is expressed in cv scd like this =

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

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#32 » Thu Jan 25, 2024 9:32 am

TEXT TRIGGER AND MESSAGE TABLE

Last part to fully understand how this conditioned door is working is to analyze how the text trigger knows what message to display while is locked, for this we will come back to see the trigger table subfile 1_08.yyy and compare the 3 text triggers there.

the image shows the 3 text triggers (01030000) are working together whit the script as all of them have the 80 tag number on them, this can mean each door is settled up to display a different text or many copies of the same text, at the end of this text triggers we have the second area of flags which displays in order:
00000000
00010000
00010000

since this is a room whit 3 doors and only one of them opens while the other 2 remain locked, which means 2 of the doors will display the same message while only one will display a different message, and are those 00 "00" 0000 and 00 "01" 0000 wich are telling us what message display each door, thus now we know text trigger 1 displays message 1 (00) and text trigger 2 and 3 display the message 2 (01), is very convenient this room have all its files nicely ordered, very well what messages are those, where they are?
Attachments
TEXT_TRIGGERS.jpg

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#33 » Thu Jan 25, 2024 10:02 am

those message are found in the subfile 1_15.yyy

this table layout works like the scd one, except by a single difference, the first octet is the quantity of messages this text table holds, next comes the message pointer table and then comes the messages themselves.

in this case is as follows:
there are 2 messages in this table expressed by the first octet 02000000
next comes the message pointer table saying the messages start at offsets 0C and 44 each one respectively.
and finally after that comes the messages winch are: I must defeat the monster! (and) It's locked.

and thats all, no more to say about the text table for now.
Attachments
TEXT_TABLE.jpg

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#34 » Thu Jan 25, 2024 10:21 am

the last piece of the puzzle is how he opcode 25 calls the correct trigger to work whit, it calls it whit the second pair of bits, 25 "xx" this pair of bits tells the opcode 25 which line to call from the trigger table, since is calling the line 1 thats why it have value 00 settled up, if the trigger 2 were being called instead the line was to express it like this:
25010000 05360002 0000
020C
25010080 00000000 0300 0000
and if where calling the trigger line number 3 it will be like this:
25020000 05360002 0000
020C
25020080 00000000 0300 0000
--------------------------------------------------------------
making a recap, of everything weve seen so far,
1 setup enemies as alive
2 set checkups for enemy deads
3 set conditionals to meet whit "if" statements and what actions to take when all the enemies are dead
4 set "else" actions to do when those enemies are not dead.
Now we can finally understand how this scripted door works and all its parts and you can now successfully understand what this next code ill write means:

050300000001 050301000001 050302000001 050303000001 050304000001 050305000001 050306000001 0000
0D000000 0D010100 0D020200 0D030300 0D040400 0D050500 0D060600 0300
0130
040301000000 040302000000 040303000000 040304000000 040305000000 040306000000
25000000 05360002 0000
020C
25000080 00000000 0300 0000

If you got able to read that code then is time to advance to the next level! if not is time to give another read to the texts >:)
Last edited by cbnj on Thu Jan 25, 2024 10:46 am, edited 1 time in total.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#35 » Thu Jan 25, 2024 10:45 am

REWRITING R0_5530 ROOM SCD

if youve been following my examples and guides you will quickly notice i am leaving out some of the original scripts opcode lines out of the view, and yes i did it whit the sole purpose to not to get you confused more than you probably can be as i did when i started to try to decode this :)
those extra lines of codes will be left out for now:
95250000
050700000001
0E000000
011E040A 17000100 86070000 00808000 00000000 00005B02 050A1700 00010300
011E040A 17000200 86070000 00808000 00000000 00005F02 050A1700 00010300

we will add them as we advance in this rewriting guide once you get used to handle the conditionals, lets start.

Open R0_5530 script in your hex editor and fill it up whit zeroes as the image show:
Attachments
BEFORE.jpg
AFTER.jpg
Last edited by cbnj on Thu Jan 25, 2024 11:55 am, edited 1 time in total.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#36 » Thu Jan 25, 2024 11:04 am

for my script i will follow the same structure of the original script but making it much more simpler, i will handle 2 functions on my scd as the original one does, so my first pointer in the pointer table will be 08 as seen in the image, i dont know yet how long my code will be so ill leave the second pointer blank.
Attachments
IMAGE1.jpg
Last edited by cbnj on Thu Jan 25, 2024 11:12 am, edited 1 time in total.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#37 » Thu Jan 25, 2024 11:09 am

next thing i will do is to declare my enemy to be alive, i will only set up one enemy in my script so i set it up at offset 8 as you can see in the image.
Attachments
ENEMYSET.jpg

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#38 » Thu Jan 25, 2024 11:17 am

now that i declared my enemy to be alive i tell the game to stop reading opcodes there since i will start to write my second function, so i add the 0000 opcode as follows.
Attachments
enemyset_end.jpg

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#39 » Thu Jan 25, 2024 11:24 am

now i know where my second function will start, at offset 10, so i write my enemy dead check/linker opcode which will link it to one of the enemy lines in the enemy table (in this case the enemy line 1, the explosive barrel, since im checking for enemy in line 00) and update my second pointer of the pointer table whit the offset value 10.

(if i would like to set it whit the enemy of line 2 i will write it as 0D000100, for enemy of line 3 i will write it 0D000200, etc.
if i was to have many 0D cheker/linkers, i will assing a different ID to each one as 0D000000, 0D010000, 0D020000, all of them will be checking enemy in line 1, but i can map them to check any desired enemy i want changing the enemy line picker:
0D000300, 0D010500, 0D020100, now the dead enemy checker/linker whit id 00 checks for the enemy in line 4 of the enemy table, the dead enemy checker/linker whit id 01 checks for the enemy in line 6 of the enemy table and the enemy dead checker/linker whit id 02 checks for the enemy in line 2 of the enemy table).
Attachments
updatepointer_set enemydeadcheck.jpg
Last edited by cbnj on Thu Jan 25, 2024 1:25 pm, edited 2 times in total.

cbnj
brutal
Posts: 248

Re: BH/RECV/X SCD SCRIPTING

Post#40 » Thu Jan 25, 2024 11:56 am

now we loop our enemy dead checker/linker so it constantly checks up for the dead status of the enemy adding the 0300 opcode
Attachments
enemychecklinkloop.jpg

  • Similar Topics
    Replies
    Views
    Last post

Return to “Modifications”

Who is online

Users browsing this forum: No registered users