#So, just started working with unity like
1 messages · Page 1 of 1 (latest)
in playmode you should be able to see their values from inspector
since they're public
check if the values are going down and what they are
also in these moments (debugging) I like to make values for my player like godmode so he dont die every test xD
haha makes sense
ok values arent moving thats a step closer
now to find out why
could you screenshot your enemy inspector as well
the whole object
is there collider ?
oh ok couldnt see checkmark there
its hard to debug this Debug.Log(currentHealth);
inside of enemy
you have to see if thats printing
do Debug.Log($"{name} currentHealth");
take damage
ya
gonna play rn
its not debugging
the enemy current health
i think its not acessing the take damage idk bro its strange that i got the takedamage on EnemyController, and the same on AllyController
I check if they are dead on both controllers, u know what I mean?
i just putted it on both cuz chat gpt said so lmao and I tought it was going to fix the issue
hmm thats weird
so its not called but its debugging the other log
Debug.Log("Deu dano " + enemydamage);
Yeah this one is debugging
oh wait.. its two files
Yeah
Haha Sorry i was in doubt if i should send 2 copy pasted codes or one with both controllers
oh lol but i meant look at it in the inspector
you can press 3 dots here
and put it in Debug mode
Lol bro Sorry
you can view all private fields at runtime
double check the values of currentHealth again on ememy, just to be sure
Ok bro just give me 1sec? I got to lunch rn lmao
all good
But ill set the current health as public?
dont have to, just use the inspector debug mode
And if the current health is not going down still?
I have a pretty good idea on something else it could be
Ok ill be back on the pc in just à few
np
im gonna test script real quick
i got a few minutes spare
ok here are the results
Green = Ally
script is technically working
not a good script but it works
ok im back in the PC brosky
in debug mode you are able to see currenthealth
ok i've activated the debug
and guess what, the health is 0 rb
yeah
oh wait
holy moly
you are the best mate
maybe they were just killing your player too quickly ?
THE ENEMY IS STARTING WITH 0 HP
what is max health set too
it was 1
because i wanted to try if the enemy dies with 1 hit
but i'll change it to 100000 for godmode
like you sid
said
kk just to be sure
the current health is set on zero for ally and enemy's
something is wrong
gonna remove the animations lines
when you start the value of current health goes to 0 ?
ok this is my animator
the transition values, but not the intial var's
idk if it answers, but im trying to animate in the following way: instead of putting bool options like isRun true or isRun false, im doing a transitio that i put int numbers
and for example when transition = 1, it walks, when transition = 2 it takes damage
and etc
thats not issue im just asking if any of those animations animate script values
but doesnt sound like it
no
i just check the values
for example
if current health <= 0
{
transition = 3 (dead animation)
}
just an example obvious haha
you copied the same values I had, but on game start but enemy current health they go to 0
im gonan remove the animations line just like u did
yeah, just enemy has it bc i was just starting programming them
and this major issue happened
b4 that it was good bro
just like your experiment
what did you add that broke it ?
and when i started doing the animations lines it broke the game lmao
I really dk what i did bro.. the one thing that i changed and them changed back is that:
cause it works here Im assuming only thing different at this point is animations lines are all commented out
public void EnemyTakeDamage(int damageAmount)
{
if (allyController != null)
{
currentHealth = currentHealth - damageAmount;
Debug.Log($"{name} currentHealth");
animator.SetInteger("transition", 2);
if (currentHealth <= 0)
{
Destroy(gameObject);
Debug.Log("Você matou um inimigo");
animator.SetInteger("transition", 3);
}
}
}
in take damage, instead of doing what i just send u, i changed for that because it makes more sense to me
public void EnemyTakeDamage(allyController.allydamage)
{
if (allyController != null)
{
currentHealth -= allyController.allydamage
because im calling the ally damage
but when the game broke i changed it back lmao
i mean wtf is damageAmount u know
isnt it supossed to get the ally damage? thats why i called the ally damage on enemyscript
I think start might not be called
whatever yuo sent me works, just see what is different maybe tags or something
ye
sure np
nah not yet haha too busy
just want to retribute
you can sub to my channel if you want 🙂
im gonna comment as well
damn bro
u make videos about unity
thats why u are pro
yeah Its been a while since i've done one hehe
I enjoy doing that more so why my games are on hold
nice!! 
hehe I dont use them as much like that, I just use the Action
in your 90th subscriber
A delegate is a way to specify which method you want to execute when an event fires
thanks!
and your 91th
and more to go lmao
ok from 89 to 95
thats all i got
the only events i know is when u are animating
that u can put an event to trigger at any frame
but never used tbh in very new to Unity
events are very powerful
I used game maker from v5. to 7 🙂
and then i got to unity lmao
dope bro
and u still uses?
or u prefer unity as well?
nahh moved way past it
Unity all the way
funny though I never used GML
i did everything with the drag n drop components
I found code "too hard"
here i am, years later coding in c#
hahahahah really
I started coding with python, doing bots for maketing
act thats why i got tons of accounts on every platform
i got bots to comment on youtube nonstop
on twitter,telegram, etc
i used to "shill" my crypto tokens
nice! maybe you can popularize my channel xD
yeah i surely can haha
the only script I did prior was a little HTML/PHP
you can spam on every unity video on youtube "hey i got a new channel that teachs unity please take a look"
if u do that 24/7
it'll surelly attract viewers
hehe pretty good idea
i used to do marketing for new crypto lmao
thats how i learned english as well
but im a gamer haha so my drem always was making games
https://web.archive.org/web/20050830103832if_/http://www.gamemaker.nl/old.html
oh man..so many good memories on this website
i want to launch those casual mobilegames for free and profit with ads
maybe market with the bots dk
i wanna try to see if it profits haha
hahaha 2000's websites
fr 😂
i have an AI that can help u
I tried a bunch but they're nowhere near as good
but yo lets talk in private i just noticed we are speaking on the unity server
for 3D for sure
its fine I gotta run anyway
kk bro
im gonna try to remove the animations and if it doesnt work i'll redo the whole game lmaooooo
add me as a friend, and lets keep in touch
if anything just put a new scene and trya gain
im pretty sure we can help out eachother
visit this discord im always here !
yo when u call an animator as a var you cn call it public? or it'll not work?
public Animator animator;
gotta be private?
wdym by calling it ?
it can be used if its either private or public, those are just restrictions across scripts not within the same scripts
ok thanks just to be sure
im trying to see whats wrong still but nevermind
you tried without all the animator lines?
yeah, and current health still 0 when starts
ooooh forget it
my mistake, i was looking at the prefab
the prefab is 0 ofc but
LOL
but the knight current health is going down haha
hahah bro i started unity in just a week... i swear
all good lol
i would follow one of the structured paths on the learn website
instead of random tutorials or gpt 🥲
yeah gpt helps a bit but when the code gets too big
gpt dont know how to react
when the code is small, gpt works fine
but when i tried to send my whole code to it he got lost lmao
thats because the small bits are just info from internet already there but doesnt know how to piece logic together properly
it lacks critical thinking
it just does pattern matching
bro fr something broke my game
i've removed the entire animations code, still not working
im going to create a new project and start it all again
but with the same code
but different sprites
im thinking my unity is bugged lmao
something you did at some point haha
yeah the scripts in blank project work fine
if you want better courses Id suggest the paths here
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
gonna try again
yo, just for u to know, i find the fix haha
it was because i was checking if allyController != null
before doing the damage, but since player just had 1hp and the enemy kills him insantly, the allyController was always null lmao
so i can make the player attack faster (on attackinterval smaller than the enemy), or make the player with more hp, or even just delete the if = allyController !null
and now its working!!!
thanks a lot
nice! 
hehe thanks a lot
now its time to add the animations
lets hope i dont fuck up this tame lmao
time*(
bro wtf, for some reason i've got the same issue again, im thinking its because the animations are happening in loop and it doesnt go for the next line in the code