Language…
12 users online: Batata Douce, DanMario24YT, ForthRightMC, Fozymandias, JPhanto, Majink12, mathew, Maw, Rhubarb44230,  Saphros, simon.caio, TheOrangeToad - Guests: 249 - Bots: 308
Users: 64,795 (2,378 active)
Latest user: mathew

Unltimate Noob Boss Feature Help

Hi there, name's MidiGuy.

I've recently come to like this boss. (Already used it for 1 of my
custom bosses.)

And I was just wondering if I could help just a little help with
creating a new routine for it.

What I'd like to do is make a routine where the boss will automaticly
lose a hit point after a certain amount of time, allowing us to make a session where the boss could go crazy after taking a hit, then calm
down after that set amount of time.

Like it would be like this:

STATE8:
JSR Move
JSR JumpHurt
RTS

STATE7:
JSR Move
JSR GoCrazyfor5secondsthenlose1hpautomaticly (Yeah, long feature I know :p)
RTS

STATE6:
JSR Move
JSR JumpHurt
RTS

So Im guessing it would probably look something like this:

Code
AutoHPLoseTimer:
"Timer Code (This is what I'd need.)"
DEC $1528,x (I believe this is the code the subtracts the health 
right?)

Then like the rest of the feautures it could be used with a "JSR
AutoHPLoseTimer" at a certain STATE.

I still don't know much about asm, but from what I gather it would probably look somewhat like this.

Anyway, if anyone could help out with this, that would be great. :)
My Youtube Channel
Showcases alot of my vids. ^^

Thanks to Pester for the Layout
Hack Progress: -About-
Havn't done much hack work/level making so...
.. (Just a little SMBX stuff really)
I think you may need to LDA 10 to free space and use DEC with a loop. im not sure

Give Mario some love?~
If you want to make a timer you can just use one of the free sprite tables that smw auto decrements (if you don't want to do it yourself). If description on $1558,x is correct you can use that one.

the idea is to set $1558,x or whatever to some intial count. Then you wait until $1558,x equals zero, that is when the timer has expired. If I stored dec 60 there, because the game runs at 60hz for NTSC roms then it would expire after one second once it equals zero.

In code, before entering the angry state, you set the timer to some value depending on how long you want it to last. Then in your angry code you keep testing if the timer has expired, if the timer value is not zero then it hasn't expired yet. Once it has reached zero the time has passed and you can change state or whatever you are going for.

In your example code you would DEC $1528,x (if that's your hp counter) after timer has expired ofcourse.
The DEC command mainly means -1 if I'm right?

So for it to subtract 1 from value $1528 (Which is mainly the hp.)

So for this to subtract 1 I'd have to program it to once the timer reaches zero.

What I mainly want to do, is make it skip a certain state after a certain amount of time, since the sprite allows you to set it's actions on each HP. So for one HP State, I would set it in a way that Mario cannot hurt it at all, but after a while it would just sort automaticly lose one HP so it would go to the next state where mario can hurt it again.

Like in this example: (STATE8=8Hp, STATE7=7HP...etc)
Code
STATE8:
JSR Move
JSR JumpHurt
RTS

STATE7:
JSR Move
DEC $1528,x
RTS

STATE6:
JSR Move
JSR JumpA
JSR JumpHurt
RTS

So once mario jumps on the spirte during state 8, it goes to state 7 seeing as it now has 7 hp. But that state doesn't have any ways to hurt mario. Instead the hp just goes down automaticly after a while to 6. So state 7 would be considered the angry state pretty much.

So in this situation at the moment, the moment mario jumps on the sprite and it goes to STATE7 (7hp), it'll right away lose another hp and go to state6. Though I mianly want to know to put a timer, so it does "DEC" right away.

When you said 60 (As 60hz being 1 second) where would a put this 60? In the place of x? After another command?

Could you show me how it would look through example?

Sorry I'm asking all these questions. I still don't understand the deep details of asm much, or barley even. O.o

EDIT: Okay, I think I understand a little of what your saying. Value $1558 is the timer, while $1528 is the hp am I close with the example?
EDIT2, I modified it a bit:

Code
LDA $FF
STA $1558
DEC 60
STA $1558
DEC $1528, x


So this is what I hope I did:
-I loaded value $FF (255) and stored to value $1558
-Then I did DEC 60 and stored to value $1558 to cause value FF to go down by 60 a second
-Then once it reaches 0, DEC $1528, x executes.

Am I getting warmer? ^^
My Youtube Channel
Showcases alot of my vids. ^^

Thanks to Pester for the Layout
Hack Progress: -About-
Havn't done much hack work/level making so...
.. (Just a little SMBX stuff really)
Quote
The DEC command mainly means -1 if I'm right?


Yes it will read the address you give it, subtract one from it, then write the value back to that address.

Quote

So for this to subtract 1 I'd have to program it to once the timer reaches zero.


yes.

Quote
What I mainly want to do, is make it skip a certain state after a certain amount of time, since the sprite allows you to set it's actions on each HP.


Sounds simple enough to do. Just hold it in a certain state until the timer expires, then transition into other state.

I am assuming JSR jumphurt will transition this into state7? (will get it later in post)

Quote
When you said 60 (As 60hz being 1 second) where would a put this 60? In the place of x? After another command?


The value 60 is stored to $1558,x for example, I'm just going to run with that address for now.

Code
LDA #60
STA $1558,x


will initialise timer to decimal 60. On the next frame, $1558,x is going to have decimal 59, frame after that? decimal 58 etc. It will stop decrementing once it hits zero. When reading $1558,x checks back as zero you know the timer has expired, you know 60 frames (or 1 second) has passed etc.

Quote
So this is what I hope I did:
-I loaded value $FF (255) and stored to value $1558
-Then I did DEC 60 and stored to value $1558 to cause value FF to go down by 60 a second
-Then once it reaches 0, DEC $1528, x executes.

Am I getting warmer? ^^


You are far off but luckily its not much code to make anyway:

What I would do is in JumpHurt routine (or whatever makes it switch to STATE7), add this somewhere in it:

Code
LDA #60 ;change this to other value if wanted, multiply this vlaue by 16.67 millisecond to get the waiting time in milliseconds
STA $1558,x


Remember I'm making the assumption that JumpHurt will make future runs of the sprite code go to STATE7 and not STATE8 anymore, is this how it works?

The above code sets the timer to 60, it starts ticking once each frame afterwards. Now in STATE7 you start checking this timer every single time the code runs like this example here

Code
STATE7:
LDA $1558,x ;check timer value
BNE NotZeroYet

....   ;stuff to do when timer HAS expired
DEC $1528,x ;this will remove 1hp when timer hits zero
RTS

NotZeroYet:  ;stuff to do when timer hasn't expired
....
RTS


At the start of this block, the timer value is loaded. BNE will branch if the timer value it just loaded is NOT zero, so whatever you want the thing to do when the timer hasn't expired yet goes under the NotZeroYet label. When the timer DOES equal zero, the branch is not taken so the hp counter is reduced, and add whatever else you want the thing to do there. After the DEC $1528,x it jumps to STATE6 because you said the STATEx is decided by the hp count.

So in summary, you set the timer up just before you switch states, and then in your new state keep checking the timer to see if it has expired yet and decide what to do if it has or has not.
Ok, I think I can do this now.

JSR JumpHurt goes to the routine that enables mario to hurt the sprite when he jumps on it.

I've already added a sfx on that very routine, so I'm quite sure I know exactly where to put the timer now.

So, would it look something like this?

Code
JumpHurt:
LDA #60
STA $1558,x
DEC $1528,x
...Other commands in routine...

;Once mario jumps on the sprite, timer is activated, and value $1528 (hp) is decreased by 1.

STATE8: 
JSR Move
JSR JumpHurt
RTS

STATE7: 
JSR Move 
LDA $1558,x 
BNE NotZeroYet 
DEC $1528,x  
RTS 
NotZeroYet: 
RTS

RTS STATE6: 
JSR Move 
JSR JumpA 
JSR JumpHurt 
RTS 


Though I think I'd have to make a 2nd jump hurt routine for this to work (One with a timer, one without), unless every hit would work like this.
My Youtube Channel
Showcases alot of my vids. ^^

Thanks to Pester for the Layout
Hack Progress: -About-
Havn't done much hack work/level making so...
.. (Just a little SMBX stuff really)
I would also recommend taking a look at this http://www.smwcentral.net/download.php?id=366&type=sprites
Look through the asm in that file it should be very helpful to you. Replacing with your own. Thanks SuperYoshi (This particular file)

Give Mario some love?~
Hiya.

I've come quite far with the timers. I've gotten them to work quite well. ^^

Though now I've got another question. To do what I need to do, I need to be able to have 2 timers at once.

It seemed like I had it working by using x and y

LDA $1558,x
LDA $1558,y

Those two mainly. But now for some reason, only the x one seems to work.

Let me explain what I want to do, as you know you can program the sprite to do whatever you want during each hp (Known as the states):

State8: (Normal State where you can jump on him to hurt the sprite)
State7: (Stunned for a split second and cannot move)
State6: (Goes crazy)
State5: (Normal Again)

The enemy starts at State 8. So once Mario jumps on the enemy, it goes to state 7 and would activate both timers. Then once the first timer expires, it would go to state 6 (Crazy), then once the second timer expires, to would go to stage 5 (Back to normal).

Though I thought I could do it with "x&y" y doesn't seem to work anymore.

So I was just mainly wondering if there was another way. ^^
My Youtube Channel
Showcases alot of my vids. ^^

Thanks to Pester for the Layout
Hack Progress: -About-
Havn't done much hack work/level making so...
.. (Just a little SMBX stuff really)
Do you know how indexing works? X works because it is normally loaded with the "sprite index", $1558 is simply the start of a table (see schwa tutorial) that has 12 entries for each sprite possibly on screen.

See X takes a value from 0-11 (decimal or 00-0B hex) based on which of the 12 sprites is being processed. You are only ever supposed to use the table byte in $1558+ or any other table that belongs to YOUR sprite, unless you want to read or change behaviour of other sprites. Y doesn't contain the sprite index unless you move it there yourself.

For example $1558 as mentioned contains 12 bytes for each sprite.
$1558-$1563 <- your sprite uses one of these based on sprite index.
LDA $1558,x takes the value $1558 and then adds the contents of X to it. If the sprite index was 3 for example, it would do $1558 + 3 = $155B. $155B is the byte your sprite is allocated, it's the address that gets read. You normally are not supposed to touch any other.

If you want another timer running in parallel you want another table. Like $163E+ for instance, it ticks automatically just like $1558+.

For what you say though you don't need another timer running in parallel you just need one. You can set timer up in State8 when a hit is detected that would run for a short time that keeps State7 alive. When State7 detects the timer has expired, set the same timer again and switch to State6.
Well, that was the last thing I needed to know. :)

Thanks alot eeveryone. With your help I was able to achieve this:

<object width="500" height="405"><param name="movie" value="http://www.youtube.com/v/cf5st5dMUJA&hl=en&fs=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/cf5st5dMUJA&hl=en&fs=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="405"></embed></object>

If I or anyone else have any other questions about the UNB sprite, use this thread. ;)
My Youtube Channel
Showcases alot of my vids. ^^

Thanks to Pester for the Layout
Hack Progress: -About-
Havn't done much hack work/level making so...
.. (Just a little SMBX stuff really)
It amazes me what people are able to hack out of that noob boss. Good job :)
I don't see that boss in the sprites section did it get removed or something?
Originally posted by Grim Reaper
I don't see that boss in the sprites section did it get removed or something?

As the thread clearly shows, it's an edited version of the Newbie boss by Maxx. It's available in the custom sprites section.

MidiGuy: Looks pretty sweet. Great job. Suggestion: Maybe take the routine from the big boo boss that kills all sprites on screen when the boss is dead? I know it has a disassembly, so it shouldn't be too difficult.
Originally posted by Boingboingsplat
Suggestion: Maybe take the routine from the big boo boss that kills all sprites on screen when the boss is dead? I know it has a disassembly, so it shouldn't be too difficult.


Hmm... that may be a good idea. I just checked. The routine would probably be around this area I guess:

EDIT: Though I don't think it's here. Hmm...

Code
DEFEATED	    LDA #$02                ; \ status = 2 (being killed by star) 
		    STA $14C8,x             ; /
		    STZ $B6,x               ; no x speed
		    LDA #$D0                ; \ set y speed
		    STA $AA,x               ; /
		    LDA #$23                ; \ sound effect
		    STA $1DF9               ; /
		    RTS                     ; return


Thanks for the comments everyone. ^^
My Youtube Channel
Showcases alot of my vids. ^^

Thanks to Pester for the Layout
Hack Progress: -About-
Havn't done much hack work/level making so...
.. (Just a little SMBX stuff really)