#So, just started working with unity like

1 messages · Page 1 of 1 (latest)

meager dragon
#

👋

wraith ember
#

Hey!

#

bro not even chat gpt can help me with that

meager dragon
#

You debugged their health ?

#

chat gpt is useless

wraith ember
#

how can i do it?

#

the debug thing

meager dragon
#

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

wraith ember
#

yeah they remain the same

#

just tried

meager dragon
#

also in these moments (debugging) I like to make values for my player like godmode so he dont die every test xD

wraith ember
#

haha makes sense

meager dragon
#

now to find out why

#

could you screenshot your enemy inspector as well

#

the whole object

wraith ember
meager dragon
#

is there collider ?

wraith ember
#

and rigidbody

meager dragon
#

why is it disabled

#

expand it a bit more

#

looks disabled

wraith ember
meager dragon
#

oh ok couldnt see checkmark there

wraith ember
meager dragon
#

inside of enemy

#

you have to see if thats printing

wraith ember
#

ok

#

i put it after the ally attacks?

meager dragon
#

do Debug.Log($"{name} currentHealth");

wraith ember
#

at update?

#

or at takedamage?

meager dragon
#

take damage

wraith ember
meager dragon
#

ya

wraith ember
#

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

meager dragon
#

hmm thats weird

#

so its not called but its debugging the other log

#

Debug.Log("Deu dano " + enemydamage);

wraith ember
#

Yeah this one is debugging

meager dragon
#

wait..

#

why is ally controller damaging itself

wraith ember
#

Hm it is….?

#

Where

meager dragon
#

oh wait.. its two files

wraith ember
#

Yeah

meager dragon
#

i scrolled to far i was in enemy 😅

#

ohh

wraith ember
#

Haha Sorry i was in doubt if i should send 2 copy pasted codes or one with both controllers

meager dragon
#

ohh currentHealth is private

#

what did you look at inspector then

wraith ember
#

But i returned it

#

Maxhealth lmao

meager dragon
#

oh lol but i meant look at it in the inspector

#

you can press 3 dots here

#

and put it in Debug mode

wraith ember
#

Lol bro Sorry

meager dragon
#

you can view all private fields at runtime

#

double check the values of currentHealth again on ememy, just to be sure

wraith ember
#

Ok bro just give me 1sec? I got to lunch rn lmao

meager dragon
#

all good

wraith ember
#

But ill set the current health as public?

meager dragon
#

dont have to, just use the inspector debug mode

wraith ember
#

And if the current health is not going down still?

meager dragon
wraith ember
#

Ok ill be back on the pc in just à few

meager dragon
#

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

wraith ember
#

ok im back in the PC brosky

wraith ember
#

wth

meager dragon
#

yes i just took animator lines out

#

do the thing I asked earlier first

wraith ember
#

hmmm maybe its the animator that is getting in the way? any chance is that?

#

kk

meager dragon
#

in debug mode you are able to see currenthealth

wraith ember
#

ok i've activated the debug

meager dragon
#

look at the inspectors for the enemy

#

currentHealth going down

wraith ember
#

and guess what, the health is 0 rb

#

yeah

#

oh wait

#

holy moly

#

you are the best mate

meager dragon
#

maybe they were just killing your player too quickly ?

wraith ember
#

THE ENEMY IS STARTING WITH 0 HP

meager dragon
#

oh lol

#

that will do it then..

#

hehe

wraith ember
#

but i dont get it

#

I've got currenthealth = maxhealth;

meager dragon
wraith ember
#

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

meager dragon
#

player

#

make sure the values are all correct

wraith ember
#

im just changing the values at the inspector

#

i dont change them at the script

meager dragon
#

yes

#

thats how yu change them

wraith ember
#

kk just to be sure

meager dragon
#

enemy values for test I did

wraith ember
#

the current health is set on zero for ally and enemy's

#

something is wrong

#

gonna remove the animations lines

meager dragon
#

when you start the value of current health goes to 0 ?

wraith ember
#

yeah lol

#

for some reason

meager dragon
#

did u animate any values via animator /

#

because it likes to lock those down

wraith ember
#

ok this is my animator

meager dragon
#

doesnt answer tho lol

#

are any scripts values changed via animator ?

wraith ember
#

the transition values, but not the intial var's

meager dragon
#

wdym transition values

#

just the parameter

#

nothing like health or any of that?

wraith ember
#

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

meager dragon
#

thats not issue im just asking if any of those animations animate script values

#

but doesnt sound like it

wraith ember
#

no

#

i just check the values

#

for example
if current health <= 0
{
transition = 3 (dead animation)
}

just an example obvious haha

meager dragon
#

you copied the same values I had, but on game start but enemy current health they go to 0

wraith ember
#

im gonan remove the animations line just like u did

meager dragon
#

ig but those shouldnt affect Both players

#

cause onyl 1 has them no ?

wraith ember
#

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

meager dragon
#

what did you add that broke it ?

wraith ember
#

and when i started doing the animations lines it broke the game lmao

meager dragon
#

maybe

#

maybe you had accidentally animated a value

wraith ember
#

I really dk what i did bro.. the one thing that i changed and them changed back is that:

meager dragon
#

cause it works here Im assuming only thing different at this point is animations lines are all commented out

wraith ember
#

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

meager dragon
#

I think start might not be called

#

whatever yuo sent me works, just see what is different maybe tags or something

wraith ember
#

you tagged the ally as ally

#

and the enemy as enemy, right?

meager dragon
#

ye

wraith ember
#

ok, i'll remove the animations

#

really really thanks either way

meager dragon
#

sure np

wraith ember
#

U got any game or something like that

#

that u want me to help u? hahaha idk bro

meager dragon
#

nah not yet haha too busy

wraith ember
#

just want to retribute

meager dragon
#

you can sub to my channel if you want 🙂

wraith ember
#

suuuure bro

#

send me all the links u want

meager dragon
wraith ember
#

im gonna comment as well

#

damn bro

#

u make videos about unity

#

thats why u are pro

meager dragon
#

yeah Its been a while since i've done one hehe

#

I enjoy doing that more so why my games are on hold

wraith ember
#

im legit watching lmao

meager dragon
#

nice!! UnityChanThumbsUp

wraith ember
#

yo whats delegate? lmao

#

never used it

meager dragon
#

hehe I dont use them as much like that, I just use the Action

wraith ember
#

in your 90th subscriber

meager dragon
meager dragon
wraith ember
#

and more to go lmao

#

ok from 89 to 95

#

thats all i got

wraith ember
#

that u can put an event to trigger at any frame

#

but never used tbh in very new to Unity

meager dragon
#

events are very powerful

wraith ember
#

you already used gamemaker?

#

its way easier lmao i tought i was an expert indie dev

meager dragon
#

I used game maker from v5. to 7 🙂

wraith ember
#

and then i got to unity lmao

wraith ember
#

and u still uses?

#

or u prefer unity as well?

meager dragon
#

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#

wraith ember
#

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

meager dragon
#

nice! maybe you can popularize my channel xD

wraith ember
#

yeah i surely can haha

meager dragon
#

the only script I did prior was a little HTML/PHP

wraith ember
#

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

meager dragon
#

hehe pretty good idea

wraith ember
#

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

meager dragon
wraith ember
#

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

meager dragon
#

fr 😂

wraith ember
#

and yo what about the art

#

u do it yourself?

meager dragon
#

nah im not good at that stuff

#

i just get 3D models mostly

wraith ember
#

yo ppl are watching as we talk?

#

lmao

wraith ember
meager dragon
#

I tried a bunch but they're nowhere near as good

wraith ember
#

but yo lets talk in private i just noticed we are speaking on the unity server

wraith ember
meager dragon
#

its fine I gotta run anyway

wraith ember
#

kk bro

#

im gonna try to remove the animations and if it doesnt work i'll redo the whole game lmaooooo

meager dragon
#

try it , and nah the scripts work

#

something is just wrong in the setup

wraith ember
#

add me as a friend, and lets keep in touch

meager dragon
#

if anything just put a new scene and trya gain

wraith ember
#

im pretty sure we can help out eachother

meager dragon
#

visit this discord im always here !

wraith ember
#

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?

meager dragon
#

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

wraith ember
#

im trying to see whats wrong still but nevermind

meager dragon
#

you tried without all the animator lines?

wraith ember
#

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

meager dragon
#

LOL

wraith ember
#

but the knight current health is going down haha

wraith ember
meager dragon
#

all good lol

#

i would follow one of the structured paths on the learn website

#

instead of random tutorials or gpt 🥲

wraith ember
#

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

meager dragon
#

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

wraith ember
#

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

meager dragon
#

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

near tokenBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

wraith ember
#

gonna try again

wraith ember
# meager dragon something you did at some point haha

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

meager dragon
wraith ember
#

hehe thanks a lot

#

now its time to add the animations

#

lets hope i dont fuck up this tame lmao

#

time*(

wraith ember
#

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