Forum rules - please read before posting.

Simple Health

2»

Comments

  • The Making a first-person game tutorial has a section showing how you can show the active inventory item in the corner of the screen, as opposed to having an active cursor. It does so with the AC menu rendering, but the principle is the same for Unity UI.

    To have an icon showing the active player, you can create a new Menu with each Player icon as a separate Graphic element (linked to an Image component if using Unity UI), and then use a series of Menu: Change state Actions to show/hide the correct one when the menu turns on. Define an ActionList when turn on in it's list of properties, and then have a series of such Actions to hide all of these Player icon elements. Then use a Player: Check Action (or series of them) to determine which is the active Player, and follow this up with another Menu: Change state Action to show the correct Player icon accordingly.

  • @ChrisIceBox Ok I am trying the health bar (which is now a hunger bar).

    I have placed a Unity UI slider bar and have created a global variable named Hunger as float giving it a value of 100.

    I have created in menus a menu named Bars and have "hooked" Unity UI of the slider to the menu. Then I have created a Slider element and have slider affects the global variable named Hunger. Have set min value 0 and max value 100 and have linked the slider (even though i don't need it I want the bar to slide as time passes).

    I tried to do what you suggested

    You can create an ActionList that runs in the background, and uses a Variable: Set Action to reduce the variable's value, followed by an Engine: Wait Action to wait however long you need, and then loops back onto the first Action.

    and I put that on the only place i could think of which is On start as a cutscene where i put the ActionList.

    There I use a variable set to set the Hunger variable to be (using formula) =Hunger-1,
    then do an engine wait for 1 second (test) and then for back to variable set the Hunger to be -1

    So from this point on the slider handle is not visible the slider is empty and it is not working. What am I doing wrong ?

  • @ChrisIceBox Solved it! ( Don't know why I can't delete my post over this

  • I was reading the topic with a similar problem and I couldn't find a solution. I have a problem creating a bar of values ​​on the screen, the variable that increases the score when the lion bites the man, this score works but when I made a change to convert these numbers into filling in a bar, it is not working, the bar appears on the screen before starting the test, but not during the game.

    I saw that under the minimum and maximum value there is an ''actionlist on change'' I used one that I already had, it didn't work, I don't know how to do it.

  • Unset the "ActionList on change" field - it shouldn't affect variable values itself, only display them.

    Sliders can only be mapped to Float variables - not Integers like your Score. If you change your Score variable to the type Float, you should then be able to assign it in the Slider's properties.

  • worked, thank you

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.