#oh

1 messages · Page 1 of 1 (latest)

stiff sage
#

current code

#

enemy code

#

since enemy is a monobehavior script

#

shouldnt this work?

raven glacier
stiff sage
#

ohhh

#

how would i amend that

raven glacier
#

just change it

stiff sage
#

change the .GetComponent to EnemyScript?

#

oh that worked

#

okay.

#

thanks lmao

raven glacier
stiff sage
#

updated script

#

genuinley unsure why its not working

#

enemy is in correct layer, code seems good (i think), damage math sould be correct

raven glacier
stiff sage
#

oh sorry

stiff sage
#

the enemy is supposed to die

#

with the current values (damage being 1) and enemy health being 2,

#

2 hits should kill the enemy

raven glacier
#

debug your code

stiff sage
raven glacier
#

what does that even mean

#

for both what?

stiff sage
#

both scripts

#

in vs studio code

raven glacier
#

i dont think we're talking about the same thing

#

what exactly did you do

stiff sage
#

uh.... this....

raven glacier
#

yeah that's not what i was talking about

#

i meant adding debug.log statements to your code

stiff sage
#

ohhhhhh

#

ok attack seems to be triggering without issues

#

enemy taking damage is the issue

#

i guess

#

it only works when enemy has a box collider

#

and rigidbody

#

is there a reason to that

raven glacier
#

yeah, a rb is necessary for a collider to be triggered and detected

stiff sage
#

i really appreciate all the help

stiff sage
raven glacier
stiff sage
#

ohh // Draw the attack range in the game view
Debug.DrawLine(attackPos.position, attackPosition, Color.red, 0.1f); // Draw for 0.1 seconds?

stiff sage
#

im gonna tweak

#

the direction is correct

#

but the damage is dealt right

#

my directional attack broken

#

;-;

median zinc
#

probably you have named things terribly and confused yourself. lastDirection attackPosition , the "attack position" log and the line you draw here all can be deleted because they have no bearing on what gets hit. At a guess, you meant to use attackPosition instead of attackPos.position in your overlap query

#

otherwise it makes no sense for those other things to be there