Health Problems

Robert GAC
Help please
I don't know javascript and simply want to use health in the status bar effectively. I've managed to get Quest to display a death message and end the game when health is zero (I didn't find this easy) but it leaves me with the word health appearing twice in the status bar. What am I doing wrong?
health probs 4.jpg
health probs 3.jpg
health probs 1.jpg

HegemonKhan
I've got confused with the built-in healh's percent stuff myself, so this may not be of help to you, but here's how to use status attributes for~with your own custom Attributes:

viewtopic.php?f=10&t=5387&p=37393&hilit=statusattributes#p37375

ask if you got any questions or need help with anything

Robert GAC
Thanks HegemonKhan, for the prompt response. and I have read my way through quite a lot of that colossal link.

But when it gets to bits like:

"(I don't have quest open at the moment, so this will be in code, but hopefully you can figure out how to do it via the GUI~Editor's Scripts):

dictionary add (player.statusattributes, "strength", "Strength: " + player.strength)

outputs~displayment:

Strength: 0"

I get a bit discouraged. If I could figure out how to do it with the editor scripts i would not be on here asking for help.

I didn't want a whole lot of other attributes like strength anyway, I just wanted to know how to send a death message and end the game when health = 0, and as 'health' is an option available by checking a box on the game features tab in the editor I thought the scripts in editor should let me do that without having to write code of my own.

If using 'health' as a game feature does involve writing code then I think it should not be offered as a feature in the editor. While I was looking for online advice on this yesterday I found a screendump of an earlier implementation, 5.3 or something, where the editor offered a space to write a death message when health reached 0. But that doesn't seem to be in the 5.6.1 version I am now using. More's the pity.

HegemonKhan
alright... hopefully this is what you want to get the health's value to appear in the 'status' pane during game play...

'game' Game Object -> 'Attributes' Tab -> Status Attributes -> Add -> (see below)

Attribute Name: health

Format String: !
~OR (both of these formats should output ~~ Health: your_current_health_amount) ~
Format String: Health: !

the '!' is a special command which will tell the quest engine to output whatever your current health is at during game play in the 'status' pane.

so now you should be seeing (for example):

Health: 999
Health: 500
Health: 100
Health: 50
Health: 0
Health: -100
etc etc etc

(you need to do some check 'if' scripting to prevent going into negative health values, so you may not be ready for this, and I don't think it matters, as you have it be a 'game over' anyways)

------------------

as for the multiple health displayment messages...

if the zombie screenshot is a Turnscript... you're going to constantly lose health until you're dead, due to the nature of the Turnscript and~or your lack of needed scripting to prevent this... if the zombie screen shot is a Timer, than you're okay... but you're still going to see the message at every interval that the Timer activates its scripting.

and for your 'object attribute equals ~ end game' screenshot... unfortunately... with the script you're using... in order for the game to end (for you to die) ... your health must land on exactly 0 ... which it may not due so, based on your starting health and the amount you reduce your health by.

what you want is this script (in code, hopefully it doesn't scare you, but it should be pretty straight forward in at least comprehension of it... I hope):

if (player.health <= 0)

if (player.health <= 0) {
// if the player's health is 0 or less, then:
msg ("You were killed or you died.")
msg ("GAME OVER")
finish
}


-----------------

a way to do the above via using the GUI~Editor:

(you're going to need to delete your scripts, and then redo them, using my help below):

run as script -> add new script -> scripts -> 'if' Script -> if [EXPRESSION] player.health <= 0
-> then, -> add new script -> output -> 'print a message' script -> print [MESSAGE] You are dead.
-> add new script -> game state -> 'finish the game' Script

XanMag
This isn't going to be super helpful now but I'm working on putting together a GUI tutorial. For each new question like this, I put a room in my game that explains the bits of quest I see users have trouble with. This will go on my "game" after I get home. I'll be back early next week. Good luck.

XanMag

HegemonKhan
@XanMag:

I actually got my own tutorial (that I made 2-3 years ago for myself when I was still struggling with the Status Attributes like you guys and girls are now) for using status attributes... I could upload them here, instead of you making your own tutorial, unless you want to make the tutorial.

... I actually ... got a lot of "tutorials ~ 'testing game stuff', as I name the game files" (like ~ 30+) on my computer... for my own reference usage... it really helps (when I learn something new, I make a sample~test~tutorial of it, so that I can reference back to it when I need to, such as due to forgetfulness: "if you don't use it, you lose it") :D

Robert GAC
It actually turned out to be very simple

I had added a health I didn't need in plyer attributes, and there was a place in the editor to do the death message and end game - under 'game -player' It looks like this:
health probs 6.jpg

magano
Great... Plus, activating "Health" on Game Features is enough; you don't need to put it in the player/game attributes

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums