Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

Yu-Gi-Oh! Duel Monsters 4: Kaiba Deck/Tutorials: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
Line 5: Line 5:
* Replace an existing Magic/Trap/Ritual Effect, by using its [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:Notes#Card_Effect_IDs_(Magic_Ritual_Trap)|effect_id]] then replacing [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:ROM_map#Player's_card_effects|its associated subroutine]], and optionally [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:ROM_map#CPU_Card_Effects|the associated subroutine used by the CPU as well]];
* Replace an existing Magic/Trap/Ritual Effect, by using its [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:Notes#Card_Effect_IDs_(Magic_Ritual_Trap)|effect_id]] then replacing [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:ROM_map#Player's_card_effects|its associated subroutine]], and optionally [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:ROM_map#CPU_Card_Effects|the associated subroutine used by the CPU as well]];
* Add a new Spell/Trap/Effect by either extending [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:ROM_map#Magic_Trap_Ritual_effects_pointers|the array of pointers at 3:799E]] (as well as the CPU one; both will need some re-pointing in Banks 0x03 and 0x14) and finding space in the current Bank for your new subroutine (there are a lot of ways to do this, for example you can keep only one [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:ROM_map#Widespread_Ruin|Trap setting subroutine and remove all the others]], then point every Trap to that subroutine); or add your new effect subroutine in another Bank (and probably use some rst 08 magic). Effect IDs 0x7E to 0xFE are free, so there's 128 slots available if you don't modify or get around the game engine.
* Add a new Spell/Trap/Effect by either extending [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:ROM_map#Magic_Trap_Ritual_effects_pointers|the array of pointers at 3:799E]] (as well as the CPU one; both will need some re-pointing in Banks 0x03 and 0x14) and finding space in the current Bank for your new subroutine (there are a lot of ways to do this, for example you can keep only one [[Yu-Gi-Oh!_Duel_Monsters_4:_Kaiba_Deck:ROM_map#Widespread_Ruin|Trap setting subroutine and remove all the others]], then point every Trap to that subroutine); or add your new effect subroutine in another Bank (and probably use some rst 08 magic). Effect IDs 0x7E to 0xFE are free, so there's 128 slots available if you don't modify or get around the game engine.
(To be continued)
(''To be continued'')


====Notable Breakpoints for Magic/Trap/Ritual Effects====
====Notable Breakpoints for Magic/Trap/Ritual Effects====

Revision as of 00:47, 24 October 2023

Chip tiny.png The following article is a Tutorial for Yu-Gi-Oh! Duel Monsters 4: Kaiba Deck.

Create new Magic/Trap/Ritual Effects

In progress
You can either:

(To be continued)

Notable Breakpoints for Magic/Trap/Ritual Effects

0:199D - Update card column and row
0:19A8 - Retrieve card column and row
0:19B3 - 00s card_id and set card_status to 0x10 in current_card_zone
0:19C8 - Copy current_card_id and current_card_status in [bc]
0:19E0 - Update current_card_id and current_card_status
0:1A03 - Retrieves card zone pointer
0:1A3F - Checks if bc ≠ 0
3:412C - Field change (in order: Arena, Forest, Wasteland, Mountain, Sogen, Umi, Yami)
3:4528 - Draw a card
3:4EF5 - Check if current_card_id is non-zero
3:51D2 - Check highest ATK enemy Monster; a bit glitched, needs fixing
3:5FB0 - Removes card
3:6215 - Summon Monster card from hand

(In progress)

Text boxes in battle - Magic/Trap/Ritual

Usually you'll be outside of Bank 06, since you'll be mostly calling these for card effects and lingering effects such as Swords of Revealing Light.
So do a rst 08 to Bank 06, grabbing the pointer at 6:400B, with the textbox ID in accumulator as the parameter.

3E 13            ld   a,13        ;0x13 is Stop Defense textbox
CF               rst  08
=> 0B 06                          ;Display text box

The parameter you send in accumulator is also used to retrieve up to 3 card_ids stored in three arrays at 6:41F3, used by display_textbox_func at 6:41B4.
These card_ids are 2 bytes long, and are stored in wC8F6, wC8F8, and wC8FA.
You can display these card_id names in your textboxes using the special character codes (in DM3, these are 0xB5 to 0xB8, but it might be different in DM4, I will check).