Custom Health & Score?

NoxAegis
08 Sept 2017, 02:47

My game involves the Player being a ghost. I would like to be able to rename Health to Plasm, failing that, I can add a new Attribute for it and just make it work but I am not sure how to make it appear in the status box. Similarly, the game will track the Player's Karma, which would take the place of Score in this case.

Also would it be possible to make the Score (custom or otherwise) a variable? My plan is to have negative Karma provide a percentage chance for an event to occur. (Being vague cause I don't want to spoil too much.)

While I have coded other stuff before, this is my first attempt with Java. Everything else I want to do seems pretty simple. I have it all outlined I just wanted to get the hard part out of the way first.

Anybody help?


hegemonkhan
08 Sept 2017, 04:00

here is a step by step walkthrough guide on making your own demo game, teaching you the basics of using Attributes (including how to use the built-in 'statusattributes' String Dictionary Attribute, which controls their displayment in the 'status pane' on the right side during game play):

http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375

and here is my guide on Attributes and the 'if' Script usage:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk


ask if you got any questions and/or need help with anything


you said : ~ "this is my first attempt with Java"

I presume you meant: "This is my first attempt with quest"

or, did you actually meant 'Java', and you need help with doing this in Java ???

(quest's underlying language is similar-to and/or uses: Java/C++/Python)

or, did you meant: 'JS (JavaScript)', which is NOT the same as 'Java'. Quest can use JS too.


K.V.
08 Sept 2017, 04:10

Here's how to make the health pane display Plasm:

dictionary remove (game.povstatusattributes, "health")
dictionary add (game.povstatusattributes, "health", "Plasm: !")

More to come...


K.V.
08 Sept 2017, 04:14

I set player.karma up as a string, thinking you'd change it around from maybe: neutral, good, or bad, but you can make it an integer just as easily. The Status attribute part will still use ! to fill in whatever player.karma is.

image

image


NoxAegis
08 Sept 2017, 10:50

Thanks!

I said Java because from the tutorial help from Quest itself it says to use a js.custom-something I'd have to look at again and I haven't had to use that before. I am used to C++ / MSL and am currently learning Python.

I will tinker a bit more and then if I have any other questions I will be sure to ask.


hegemonkhan
08 Sept 2017, 15:39

quest can use JS (JavaScript, this is a scripting/web language. This is very different from Java, a full-bore language like C++ and Python), which allows it to do a lot of really cool stuff, beyond what it can normally do (lots of UI/GUI stuff: windows/menus, style sheets, and etc):

https://www.w3schools.com

(this is a good site for learning web languages, including JS: JavaScript)


P.S.

KV has really learned this stuff fast and well, I've still got to learn it... sighs, so he can help you a lot more with it than I can. Pixie of course can help as well too, as he's very knowledgeable and a good programmer.


P.S.S.

I know C++ and Java decently well, and-but only a little bit of Python, so if you want any help with these (if you need it/help), let me know!