How to add a "Monster Jump" AI script [NESMaker 4.0.X - Module Platformer]

dale_coop

Moderator
Staff member
I thought it would be nice to add a "Jump" action for the monster's AI actions (my son wanted it for one of its monters)...
So I choose a very easy way to acheive that (just copyied the script of the player jump):

1) Make a new script "MonsterJump.asm" in the '\Routines\UserScripts\PlatformGame_Base\AiScripts" folder, with this:

Code:
	LDA #$00
	SEC
	SBC #$04  ;; <-- jump value
	STA Object_v_speed_hi,x
	LDA Object_status,x
	AND #%11111011
	STA Object_status,x


2) In the "Project settings > Script Settings", assign the "MonsterJump.asm" script to a unused AI Action (for example the "AI Action 10").

2018-12-06-15-58-45-Project-Settings.png


3) In the "Project settings > Project Labels", for the monster's "Action Types", rename the "AI_Behavior 10" to "10 - Monster Jump".

2018-12-06-15-59-24-Project-Settings.png


4) Now, you can use the action "Monster jump" for your monsters, in their Action Steps.

2018-12-06-15-59-58-Monster-Animation-Info.png

(I'd recommand to use a timer value greater than 1 to give enough time for the jump)
 

ZeGGamer1

New member
Is it possible to turn this into a tile so that an enemy with a flag checked jumps when it touches it? (ie, the flagged enemy get's to an edge and touches the tile, jumping over the edge.)
 

dale_coop

Moderator
Staff member
I suppose, if you assign this script to a unused "Tile Collision XX" in the "Script settings" (and rename the corresponding Tile Type label) and make a tile with it... It could work.
You should modify the jump values the script (maybe 06 or 07) to have bigger jump,... over the edge.
 
ZeGGamer1 said:
Is it possible to turn this into a tile so that an enemy with a flag checked jumps when it touches it? (ie, the flagged enemy get's to an edge and touches the tile, jumping over the edge.)

That's an awesome idea, if you figure out how to do it, I'd love to use it.
 

dale_coop

Moderator
Staff member
I just assign the script to a unused « tile collision » in the Scripts Settings.
And used this new tile type to make a tile.
But any object would jump... even the player >_<
 

CutterCross

Active member
I made a similar AI Action script to make my boss change between different levels of altitude in The Tower of Turmoil ;)
 

dale_coop

Moderator
Staff member
CutterCross said:
I made a similar AI Action script to make my boss change between different levels of altitude in The Tower of Turmoil ;)

Yeah, ramember that. Your bosses were great!
This weekend I will flash the new version and try to beat the game this time (my wife will be out, I will have more time)
 

SubCog

New member
So I followed the instructions, and added the behavior onto my monster's actions, but instead of the monsters jumping every 5 seconds, it makes my player jump every 5 seconds. The monsters just sit there. Any ideas?

btw, I'm still using 4.0.x
 

dale_coop

Moderator
Staff member
Yeah, of course, You're right... I don't know why my code is SO wrong!? (I made a wrong copy/paste from another script... maybe my jumping tile)?
just remove the 4 first lines of the script.
(I will update the post)
 

Craigery

Active member
ZeGGamer1 said:
4.1.0 version?

Code:
	SEC
    SBC #JUMP_SPEED_LO
    STA Object_v_speed_lo,x
    LDA #$02
    SEC
    SBC #JUMP_SPEED_HI
    STA Object_v_speed_hi,x

I dug through a_simple_jump.asm and this seemed to work! I am so excited I was able to (somewhat) figure out a piece of code.
 

dale_coop

Moderator
Staff member
I think, yeah, it can be use for the 4.1 too as the script is quite simple.
Contrats Craigery. With experiments like this... you will learn how to code for NESMaker. And in some months, you will be able to code full scripts ;)
 

pit.baldriz

New member
This sounds great! I just want to add a monster jump but I feel so dumb as I don´t know how to do the first step... create a new script :( Where can I need to do this? Sorry for the basic question.
 

Dirk

Member
You can open a simple text editor of your choice, paste the code and save it as filename.asm instead of filename.txt.
You might need to change the proposed extension in your text editor to *.* so your file don't get saved as eg. filename.asm.txt or filename.asm.docx.
 

pit.baldriz

New member
Thanks Drik! I´ll do that. EDIT: I did it, I could make a jumping monster. Thanks for the help and for the script!
 

red moon

Member
Hello Dale,
I went ahead and added the script but could not get the jump action to start after the walk. I must be missing something....Let me know if you need more screenshots, thank you!
 

Attachments

  • jump1.jpg
    jump1.jpg
    619.9 KB · Views: 2,569
  • jump2.jpg
    jump2.jpg
    621.5 KB · Views: 2,569
  • jump3.jpg
    jump3.jpg
    612 KB · Views: 2,566
  • jump4.jpg
    jump4.jpg
    1.3 MB · Views: 2,566
  • jump5.jpg
    jump5.jpg
    274.1 KB · Views: 2,568
Top Bottom