Health change notification

Hi there, is there a way to display when you lose health? I have it so the health displays as a status thing (the right hand stuff), but I would like it so a message is displayed saying something like "Lost 50 HP!"

Is there any way I could do this?


(filler for getting my edited post, updated/posted)


for whenever and whatever action(s) within your game:

add new script -> 'output' section/category -> 'Print a message' Script -> see below

print [EXPRESSION] "Lost " + game.pov.health + " HP!"

I used the special built-in 'pov' Object (reference/pointer) Attribute of the 'game' required special Object, as it's the currently controlled Player Object, in case you changed the name of your default 'player' Player Object, and/or should you be using multiple Player Objects


if you are just using the default 'player' Player Object, and have NOT changed its name from 'player' to 'WHATEVER', then you can use the the 'player.health' specifically instead if you prefer:

add new script -> 'output' section/category -> 'Print a message' Script -> see below

print [EXPRESSION] "Lost " + player.health + " HP!"

if you CHANGED the default 'player' Player Object's name from 'player' to 'WHATEVER', then you can use the the 'WHATEVER.health' specifically instead if you prefer:

(replace my 'WHATEVER' with whatever you named it as, quest IS lower/upper case sensitive, so make sure you type it in exactly)

add new script -> 'output' section/category -> 'Print a message' Script -> see below

print [EXPRESSION] "Lost " + WHATEVER.health + " HP!"

In the GUI/Editor:

for the 'print a message' Script:

the '[MESSAGE]' control allows for TEXT ONLY:

// examples:

print [MESSAGE] hi
// output: hi

print [MESSAGE] "hi"
// output: "hi"

whereas, the '[EXPRESSION]' control allows for everything:

TEXT ONLY:

// examples:

print [EXPRESSION] "hi"
// output: hi

print [EXPRESSION] "\"hi\""
// output: "hi"

VARIABLE ONLY:

// examples:

// create ("example_object")
// example_object.example_string_attribute = "hi"

print [EXPRESSION] example_object.example_string_attribute
// output: hi

// create ("example_object")
// example_object.example_string_attribute = "\"hi\""

print [EXPRESSION] example_object.example_string_attribute
// output: "hi"

TEXT AND VARIABLE:

// example:

// create ("example_object")
// example_object.example_string_attribute = "hi"

print [EXPRESSION] example_object.example_string_attribute + ", my name is HK, what is your name?"
// output: hi, my name is HK, what is your name?

This is the way I did it.

game -> start -> script

player.hitpoints = 25
player.changedhitpoints => {
  if (player.hitpoints > 0) {
    msg ("Hits points now " + player.hitpoints + ".")
  }
  else {
    msg ("You are dead!")
    finish
  }
}

Log in to post a reply.

Support

Forums