Weapon damage question

red moon

Member
Hello,
I wanted to check and see if I could get a little help with understanding weapons and enemy health.

When attacking an enemy that is set to 4 health, the projectile works as intended, but my melee weapon destroys the enemy with a single hit. Is there a way to set the melee weapon damage to work like the projectile source? I looked at the object settings and see strength settings but no damage.

Thank you, I looked through the forums but did not see anything similar.

And I am still looking into the sprite positioning of the projectile and its facing when shooting left. I am not sure what happened there yet, the melee sprite is in the right place but not the projectile.
Thanks in advance!

https://youtu.be/6JLhPpMVFuQ
 

dale_coop

Moderator
Staff member
Hey red moon,
For the projectile offset, I replied on the other post ;) (you need to click on the the "Melee" buton to change it to "Projectile"... for settings the projectile offsets)

And about the damage of your sprite weapon... it's because it's designed to be a death weapon (1 hit kill), by default in NESmaker. But you can modify this behaviour to make it work like the projectile (1 hit = -1 on monster's health), following this tutorial:
http://nesmakers.com/viewtopic.php?f=35&t=1738
 

red moon

Member
Wow, I did not know that box could toggle between the two! That did it Dale and I switched to the script you wrote to replace handlespriteweapon which allows for multiple strikes on the enemy. One thing that changed however is enemies no longer drop pickups after dying.
They were when it used the original 1 hit punch.
Thank you for all your help so far!
I placed a screen here in case its set improperly,
 

Attachments

  • enemydeath.jpg
    enemydeath.jpg
    730.3 KB · Views: 767

dale_coop

Moderator
Staff member
Check again your HandleSpriteWeapon.asm script...
And compare with the one from http://nesmakers.com/viewtopic.php?f=35&t=1738
Make sure the line "JSR HandleDrops" is in the script, around line 121 (and not commented out).
 

red moon

Member
Hey Dale,
there is a line about monter (monster) locks afterward, should I cut that out?
 

Attachments

  • line121.jpg
    line121.jpg
    456.2 KB · Views: 755

red moon

Member
I found this as well, its an earlier post you had made to limit 1 projectile at a time. I wasn't sure if it was compatible with the b_create_projectile_platformer code I added from your earlier post. I added it, but did not notice a change.
 

Attachments

  • limit.jpg
    limit.jpg
    164 KB · Views: 751

dale_coop

Moderator
Staff member
Those scripts look correct.
How about the script assigned to the "Handle Monster Drops" element (in Project Settings > Script Settings) ? Could you also share it?
 

red moon

Member
Dale,
I located the handle drops script here: ModuleScripts\HurtWinLoseDeath
I did not find one that was specific to monsters, only this one.


Code:
RTS ;; skip drops
;;; monster objects drop at random.
	LDA Object_x_hi,x
	STA temp
	LDA Object_y_hi,x
	STA temp1

	JSR GetRandomNumber
	AND #%00000111 ;; now, we have a number between 0 and 7
	BNE notPickup0 ;; 
	;; zero case here;
	;;; here, we'll create health
	CreateObject temp, temp1, #$04, #$00, currentNametable
	JMP donePickup
notPickup0:
	CMP #$01
	BNE notPickup1
	;; one case here;
;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, currentNametable
	JMP donePickup
notPickup1:
	CMP #$02
	BNE notPickup2
	;; two case here;
	;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, currentNametable
	JMP donePickup
notPickup2:
	;;;; do the same for each case.
	;;;; blank cases will simply return 'nothing'.
	
	
	
	
donePickup:	
	;;; ALL cases create a "pow"
	CreateObject temp, temp1, #$09, #$00, currentNametable
 

dale_coop

Moderator
Staff member
Yeah as you can see, this script is the default one...
And starts with a "RTS" which means "stop the script here". So this script does nothing.
You'll have to follow (agin?) the tutorial "[4.1] Quick fix for the monster drops issue" to get back your MonsterDrops:
http://nesmakers.com/viewtopic.php?f=35&t=1740
 

red moon

Member
Dale,
It's so close!
I went ahead and updated the handledrops, handlehurtmonster and handleobjectcollision and in most cases it works fine. There are some instances of it dropping health pickups for some reason and a odd combination of sprite elements as you can see at the end of orb2. Its really close, thanks for the help so far!
I can always revert some of these, I was not sure if I was meant to change all of them!

https://youtu.be/6Ofi_3XUETY
https://youtu.be/hI-ECAWRX_4
 

dale_coop

Moderator
Staff member
The Handle Drops will create randomly pickups (heath or charge or key or currency one)
If you share your current Handle Drops script, we could tell you more precisely which pickups would be created.
 

red moon

Member
Thanks Dale, it's this one:


Code:
;;; monster objects drop at random.
	LDA otherCenterX
	SBC #$08
	STA temp
	LDA otherCenterY
	SBC #$08
	STA temp1
	
	LDA Object_scroll,x
	SBC #$00
	STA temp3

	JSR GetRandomNumber
	AND #%00000111 ;; now, we have a number between 0 and 7
	BNE notPickup0 ;; 
	;; zero case here;
	;;; here, we'll create health
	CreateObject temp, temp1, #$04, #$00, temp3
	JMP donePickup
notPickup0:
	CMP #$01
	BNE notPickup1
	;; one case here;
;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup1:
	CMP #$02
	BNE notPickup2
	;; two case here;
	;;; here, we'll create currency
	CreateObject temp, temp1, #$07, #$00, temp3
	JMP donePickup
notPickup2:
	;;;; do the same for each case.
	;;;; blank cases will simply return 'nothing'.
	
	
	
	
donePickup:	
	;;; ALL cases create a "pow"
	CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #$00, temp3
 

red moon

Member
Dale,
I'm placing keys (behind enemies that must be destroyed) and health in specific areas of the map so those do not need to be dropped. The orb objects are animated enemy death objects I set as a pickup. Eventually, I want orb pickups to behave like "bullets" to provide the player with a set number of projectiles. Hopefully, that helps explains the intent!
 

dale_coop

Moderator
Staff member
Ok... after checking your script. Here's how it works...
You kill a monster and it does does 2 things:
1) it creates a "currency pickup" object or a "health pickup" object or nothing... randomly
2) AND it also creates a OBJ_MONSTER_DEATH object.
So currenlty, in order to work correctly, you'll need to set all those objects...

But, iff you don't want the "health pickup" object to be dropped (if you just want currency objects or nothing)... replace the "#$04" in the script by "#$07" (the 7th object is the "currency pickup" object).

If you don't want any drop (and want only the OBJ_MONSTER_DEATH object) add a:
Code:
	JMP donePickup
after the line (11):
Code:
	STA temp3
 

red moon

Member
That worked great!
Your explanation helps as well. I ordered a couple books on 6502 to help my understanding of the prefix system and general understanding. I am sure it will help!

As far as getting the weapon to fire when pressing up and the B button from what you mentioned before, it would be altering the create_projectile script and not the input script correct?
 

dale_coop

Moderator
Staff member
Exactly...
Currenlty, you might assigned both scripts (b_create_projectile and b_create_melee to your "B" "PRESS" button). So when you are pressing b, your player does the melee attack and shooting a projectile, right?

Then, modify the "b_create_projectile" script, at the beginning of te script, add this code:
Code:
	;; checking if "Up" is pressed on the gamepad
	LDA gamepad
	AND #%00010000
	BNE +
	RTS		;; if not pressed, then we stop the script, here
	+

Now your projectile script should be skipped (doing nothing) if you are not pressing UP...
It means (because you assigned that script to "B") that this script will create a projectile only where you are pressing B and Up.

Let me know if it doesn't work.
(I am writing that, while at work... so can't test it, right now...).
 

red moon

Member
Yes, at present the melee and projectile activate simultaneously when pressing the B button. I will add the new lines of codes when I get home and let you know!
 

red moon

Member
Hey Dale, It works!

It works great thank you so much!
I am very excited to have this part of game play functioning.
Here it is!!!

https://youtu.be/SuPA7Xzwr1I


The punch appears to have changed though... The enemy drop now spawns beneath them and many of the swings go through the enemy when standing. If you jump and punch, it seem to damage them consistently but standing and punching produces varying results.
I made a couple videos so you could see. My object bounds fills the whole 8x8 block too, and the previous one shot kill punch could be done at further range.
Let me know what you think and if you need me to share any code!

https://youtu.be/zu1wzVKFGeg
https://youtu.be/e_RHaS7nr18
https://youtu.be/UEqNydA5yRY
Heres a video of the previous punch in action as well
https://www.youtube.com/watch?v=h6rNej1xoTM
 
Top Bottom