Search Unity

Been working on single issue in the bolt tutorial for 4 days. Health & Damage

Discussion in 'Visual Scripting' started by Oddyseous, Sep 5, 2021.

  1. Oddyseous

    Oddyseous

    Joined:
    Jan 30, 2020
    Posts:
    5
    Hello, I'm hoping someone here can help me with this, it's been 4 days and I've fixed a lot of issues but I can not get this one resolved as of yet, would really appreciate some help.



    Now what's interesting is it seems to run flawlessly if I get rid of the Get Variable > Player, however, regardless of my player taking damage, it does not update the damage and Get Variable always passes the default value of 3, but on my player it is updated correctly.

    So my character takes damage, and dies from damage, but the hearts in the HUD are not updated.

    I really appreciate any help here, thanks guys.
     
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,063
    You're passing the "Player" Application variable which is of type GameObject into a string input for Get GameObject Variable node. That port is for variable name which is of type string (color coded orange for strings). Hence the error of it not being able to convert a GameObject to String.
     
  3. Oddyseous

    Oddyseous

    Joined:
    Jan 30, 2020
    Posts:
    5
    Thanks for the reply, so I fixed that since I posted the original question, it was originally fixed but that was from me messing with it trying to fix it. I did not know orange was for strings, THANK YOU. That helps a lot. However here is where I am now, it claims to be working, but it isn't. Some how the 3 health the player has is not being updated in my HUD > row embed flow machine because the player DOES TAKE DAMAGE, and dies accordingly still.

    Here is the code fixed:


    Here is the code inside Player, my PlayerController code that should be updating the health properly across the application:


    The HUD code above will always claim health = 3 and pass 3 instead of updating the fact it actually equals 2, 1 or well dead doesn't matter because the game restarts.