Users browsing this thread: 1 Guest(s)
changeing Health command

#2
Posts: 290
Threads: 3
Thanks Received: 40
Thanks Given: 1
Joined: Apr 2012
Reputation: 9
Status
None
Yes, it's possible, and it should be quite easy.

There is a random number generator at C2/4B5A. You would first want to call that, then run some comparisons based on what you want the odds of each spell to be.

First you would need to interrupt the Health routine and jump to some free space, since this code will be longer than Health's. So your function might look something like this (using the free space at C2/A65A):

Code:
C2/171E: A9 2D      LDA #$2D    (load Cure's spell ID instead of Cure 2's)
C2/1720: 85 B6      STA $B6     (store it into the skill to use; you'll see why shortly)
C2/1722: 4C 5A A6   JMP $A65A   (jump to some free space, since we've used up all of Health's)
C2/1725: EA         NOP

C2/A65A: 20 5A 4B   JSR $4B5A   (get a random number 0-255)
C2/A65D: C9 33      CMP #$33    (compare it to 51 (33 in hex; roughly 20% of 256))
C2/A65F: 90 08      BCC $A669   (if the random number is less than 51, use Cure)
C2/A661: C9 B3      CMP #$B3    (compare the random number to 179 (128 + 51; 50% chance))
C2/A663: 90 02      BCC $A667   (if the random number is less than 179 but greater than 51, use Cure 2)
C2/A665: E6 B6      INC $B6     (else, use Cure 3. Increment the spell ID we stored earlier twice to point to Cure 3)
C2/A667: E6 B6      INC $B6     (Cure 2 enters here, thus we will only increment the spell ID once so it points to Cure 2)
C2/A669: A9 05      LDA #$05    (this is left over from Health originally. Not sure what it's for; maybe the blue palette color. Cure also enters here, so we don't increment the spell ID at all)
C2/A66B: 4C 65 17   JMP $1765

Hopefully this makes sense.


GET A SILK BAG FROM THE GRAVEYARD DUCK TO LIVE LONGER.

Brave New World
  Find
Quote  
[-] The following 1 user says Thank You to Synchysi for this post:
  • Warrax (05-11-2021)



Messages In This Thread
changeing Health command - by Tsushiy - 12-10-2013, 09:52 AM
RE: changeing Health command - by Synchysi - 12-10-2013, 03:53 PM
RE: changeing Health command - by Tsushiy - 12-11-2013, 05:45 AM
RE: changeing Health command - by Cyprus - 12-19-2013, 09:58 PM
RE: changeing Health command - by madsiur - 12-20-2013, 01:59 AM
RE: changeing Health command - by HatZen08 - 12-20-2013, 02:57 PM
RE: changeing Health command - by Cyprus - 12-22-2013, 01:58 PM
RE: changeing Health command - by Gi Nattak - 03-05-2014, 05:45 PM
RE: changeing Health command - by Synchysi - 03-05-2014, 10:02 PM
RE: changeing Health command - by Gi Nattak - 03-05-2014, 10:58 PM
RE: changeing Health command - by SSJ Rick - 03-05-2014, 11:23 PM
RE: changeing Health command - by Gi Nattak - 03-05-2014, 11:36 PM
RE: changeing Health command - by HatZen08 - 03-06-2014, 11:46 AM
RE: changeing Health command - by Gi Nattak - 03-06-2014, 03:49 PM
RE: changeing Health command - by SSJ Rick - 03-07-2014, 01:42 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite