Users browsing this thread: 1 Guest(s)
Disable Jump command if character has Dark status

#1
Posts: 281
Threads: 18
Thanks Received: 13
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
@Kugawattan requested this, so here goes.


This code is easily extendable to check more commands. It likely conflicts with assassin's Brushless Sketch patch, since they muck with the same tables.

Use xkas 0.06 to assemble this patch.

Update 0.2
Dark sets Fight to spread aiming.
Release 0.1
Dark disables the Jump command.
Code:
;xkas 0.06
hirom ;don't change this
;header ;uncomment this if your ROM has a header
!freespace = $C2A65A ;change this to where you have free space in C2
!howmanycommands = #$0008

;****************************************************************
;Relocate and expand the command table and function pointer table
;****************************************************************

org !freespace
;(Data - commands that can potentially get grayed out on the menu in battle,
; or have a property like their aiming altered.)
table_Commands:
db $03    ;(Morph)
db $0B    ;(Runic)
db $07    ;(SwdTech)
db $0C    ;(Lore)
db $17    ;(X-Magic)
db $02    ;(Magic)
db $06    ;(Capture)
db $00    ;(Fight)
;Add commands here... don't forget to update !howmanycommands. For reference:
;00 = Fight     01 = Item       02 = Magic        03 = Morph      04 = Revert
;05 = Steal     06 = Capture    07 = SwdTech      08 = Throw      09 = Tools
;0A = Blitz     0B = Runic      0C = Lore         0D = Sketch     0E = Control
;0F = Slot      10 = Rage       11 = Leap         12 = Mimic      13 = Dance
;14 = Row       15 = Def        16 = Jump         17 = X Magic    18 = GP Rain
;19 = Summon    1A = Health     1B = Shock        1C = Possess    1D = Magitek
db $16    ;(Added command - Jump)


;(Data - addresses of functions to check whether above command should be
; enabled, disabled, or otherwise modified on battle menu)
table_Functions:
dw $5326   ;(Morph)
dw $5322   ;(Runic)
dw $531D   ;(SwdTech)
dw $5314   ;(Lore)
dw $5314   ;(X-Magic)
dw $5314   ;(Magic)
dw $5301   ;(Capture)
;dw $5301   ;(Fight)
dw function_Fight   ;(Fight)
;Add function pointers here...
dw function_Jump:


;****************************************************************
;Add functions here. If Carry is set, command is disabled.
;For examples, see C2/5301, C2/5314, C2/531D, C2/5322, and C2/5326.
;****************************************************************

;(New function - disable Jump if character has Dark status)
function_Jump:
macro checkDark()
LDA $3EE4,Y             ;(Status byte 1)
LSR                     ;(If Dark is set, disable command slot)
endmacro
%checkDark()
.exit
RTS


;(New function - make Fight spread-aim if character has Dark status) 
function_Fight:
%checkDark() ;(or JSR function_Jump if already using that)
BCC .noDark
JMP $5307 ;Skip to set Spread Aim
.noDark
JMP $5301 ;Check for Offering

;****************************************************************
;Modify some function calls to use the new tables' location
;****************************************************************

;Redirect the calling function's pointers to the new tables
org $C252C6
LDX !howmanycommands
CMP table_Commands,X    ;(Does our current command match one whose menu
                        ; availability or aiming can vary?)
org $C252D2
JSR (table_Functions,X)  ;(Call special function for command)


;****************************************************************
;Update command availability upon setting Dark
;****************************************************************

;Set status pointers ("side effects" to perform upon setting of a status):
org $C246B0
dw $4649 ;(Dark)        (Update command availability)

;Clear status pointers ("side effects" to perform upon clearing of a status):
org $C246F0
dw $4649 ;(Dark)        (Update command availability)
  Find
Quote  
[-] The following 4 users say Thank You to seibaby for this post:
  • B-Run (11-28-2016), Imzogelmo (02-04-2017), madsiur (11-21-2016), SSJ Rick (12-09-2016)

#2
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
This is a really cool concept. Great work!
  Find
Quote  

#3
Posts: 281
Threads: 18
Thanks Received: 13
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
Yeah, a lot more can be done with this code than what was intended, I believe. The unmodified game only use functions to change targeting or enable/disable commands, but it should be possible to do a lot more.
  Find
Quote  

#4
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
I like your structure. flexible code is the best.
  Find
Quote  

#5
Posts: 281
Threads: 18
Thanks Received: 13
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
I've added some functionality to this to further showcase what can be done - Dark status now forces the Fight command to use Offering-style spread aiming. You still only get one attack though! Smile
  Find
Quote  

#6
Posts: 2,768
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
very impressive


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite