Need Help W/ Adventure Module Weapon and Text

Hello everyone. I hope everyone has enjoyed their weekend and that each and everyone made progress goals on your projects. So I ran into some issues with Melee and Text while making my game in Adventure module. While following Joe's 3hr Adventure tutorial to make the weapon and such, I noticed that when I followed along with my own asset for some reason it was drawing the weapon on tile 8 and 9 on the player's asset. Of course I can really read what's, what on ASM so I did some digging in the forums and saw Dale's realy Melee tutorial. but After doing so I realized it was for platform module... I contacted Dale to see what he thought and made some adjustments (Thank you!) But it only works well with Down and Up attacks.

Am I suppose to use Melee only while doing the offset or is that part of project tile? In Joes video he used Projectile for Left and Right. Also I tried using a B_Text script but for some reason its making the Player/NPC/Monster all disappear. This time ive been smart enough to test things on a testing project and not the main build project.

B_Weapon

Code:
	LDA gameHandler
	AND #%00100000
	BEQ notNPCstate_attack
	JMP doneAttacking
notNPCstate_attack:
	 LDA weaponsUnlocked
	 AND #%00000001
	 BNE canAttack
	 JMP doneAttacking
canAttack:
	LDX player1_object
	GetCurrentActionType player1_object
	CMP #$02
	BNE notAlreadyAttacking 
	JMP doneAttacking
	
notAlreadyAttacking:
	;;; don't attack if already attacking.
	;;; do we have to check for hurt here?
	;;;;; Here, we WOULD create melee
	ChangeObjectState #$02, #$05
	LDA Object_movement,x
	AND #%00001111
	STA Object_movement,x
	LDA #$00
	STA Object_h_speed_hi,x
	STA Object_h_speed_lo,x
	STA Object_v_speed_hi,x
	STA Object_v_speed_lo,x

	LDA Object_x_hi,x
	STA temp
	LDA Object_y_hi,x
	STA temp1

	LDA Object_movement,x
	AND #%00000111
	STA temp2
	TAY

	LDA Object_x_hi,x
	SEC 
	SBC #$08	;; <<--- HERE, you have to set width of melee weapon in HEX (1 tile = 8px, 8 in decimal = #$08 in hex. Use the binary <-> hex converter plugin)
	STA temp
	LDA Object_scroll,x
	SBC #$00
	STA temp3

	LDA temp
	;;; offset x for creation
	CLC
	ADC weaponOffsetTableX,y
	STA temp
	LDA temp3
	ADC #$00
	STA temp3

	LDA Object_y_hi,x
	CLC
	ADC weaponOffsetTableY,y
	SEC
	SBC #$10	;; <<--- HERE, you have to set height of melee weapon in HEX (1 tile = 8px, 8 in decimal = #$08 in hex. Use the binary <-> hex converter plugin)
	STA temp1	
	
	CreateObject temp, temp1, #OBJECT_PLAYER_MELEE, #$00, temp3
	
meleeCreated:
    ;;;; x is now the newly created object's x.
    LDA Object_movement,x
    ORA temp2
    STA Object_movement,x
	
    ;PlaySound #SND_SLASH
	
doneAttacking:
	RTS

B_Text

Code:
    LDA textboxHandler  ;; dale_coop: check if the text is already displayed
    AND #%11000000 
    BEQ +
    RTS
    +
    ;; from here, the normal script...:
    
    LDA textboxHandler
    AND #%00010000 ;; if the b button is pressed
                    ;; but the box + text have been activated
                    ;; and also the 'do box' bit is OFF
                    ;; that means this is ready to "go away".
                    
    BEQ checkToTurnTheTextboxOn ;; hasn't started yet
    
    ;; begin turning the textbox off.
    LDA gameHandler
    ORA #%00100000
    STA gameHandler
    ;;; are we turning this on or off?
    ;;; check for more
    ;;; check for 'choice'.
  
    LDA #$00
    STA updateNT_offset
    STA updateNT_H_offset
    STA updateNT_V_offset
    
    LDA #%10001000
    STA textboxHandler
    RTS
   
checkToTurnTheTextboxOn:  
   LDA npc_collision
    BEQ noNPCcollision
    LDA textboxHandler
    AND #%10000000
    BNE noNPCcollision
   LDA gameHandler
    ORA #%00100000
    STA gameHandler
    ;;; are we turning this on or off?
    ;;; check for more
    ;;; check for 'choice'.

turnTheTextboxOn:
  
    LDA #%10000000
    STA textboxHandler
    
noNPCcollision:
    RTS
 

Attachments

  • weapon-issue.png
    weapon-issue.png
    53.7 KB · Views: 2,177
Okay, I did some messing around with it. it seems that Joe's tutorial using the projectile source didn't work with this code. Can anyone tell me the actual off set numbers? I know that 08 = 1 tile but does that mean a weapon 3 by 3 tiles is 72? I got the weapon to spawn in the right area ingame but off game offset setting are way off the character to get the right line up.
 

dale_coop

Moderator
Staff member
I think you just forgot to set the offset of your weapon?
I mean set the melee placement for every direction of the player?
You do that (as explained In the tutorials ;)) by selecting the « Game Object » element in the treeview.

Not selecting the « melee » or the « player » object... literally, you click on the « Game Object » root item)
Then you have X and Y to set for very direction.

Here:

2019-10-15-08-08-18-NES-MAKER-4-1-5-Version-0x159-Adventure-MST.png
 
*Melee Weapon FIXED! Made the Object only in the melee section making it 2x2.

*Moving while attacking FIXED! Following an old tutorial. the movement i needed for adventure was in the adventure folder.

*Sword disappearing during attacking an enemy FIXED! script adjustments.

Last is the text issue.

Thank you DALE for helping me.
 
I need to implement exactly this on my game, and am not entirely sure how it goes. Would I just copy/paste this code over my default scripts? I'm also doing a top-down, four-direction Adventure module game instead of Platformer (as in Dale's original guide thread). Do I put both sets of code in the same script? How does it know to do text or weapon?
 
westcoastvagabond said:
I need to implement exactly this on my game, and am not entirely sure how it goes. Would I just copy/paste this code over my default scripts? I'm also doing a top-down, four-direction Adventure module game instead of Platformer (as in Dale's original guide thread). Do I put both sets of code in the same script? How does it know to do text or weapon?

Which is it that you need? We had to adjust a few things to make it work. what dale did in the original thread was for scrolling games not adventure so he had to adjust a few things for me.
 
Well, both. I need text when interacting with an NPC, and a melee weapon other times. I see where the default script checks state and calls either the text or melee, but I'm not sure how to replace that with these pieces of code. Do I need two scripts?
 
Top Bottom