I need help with printing a counter.
AKA99
27 Jun 2017, 08:43I'm new into quest and im trying to make a counter appear in the screen, it tells me this: "Error running script: Error compiling expression 'HP': Unknown object or variable 'HP'". Someone help me please.
JenniferKline
27 Jun 2017, 09:14Is it for the player? What did you do so far? It'd give us a good basis to say where you went wrong.
Anyway, go to player
and go into attributes
. You want to make a new attribute called HP
. This should be an integer
attribute, which means it works in numbers. If you want to then print the counter, type {player.HP}
into a message.
There is already a built in health system that can be added in the Features
tab when you select game
at the top of the tree of the left.
To modify the HP attribute, using the GUI you can make a set variable or attribute
or set an objects attribute
to alter the value using something along the lines of HP = HP - 10
to remove `10 points.
Probably not the best explaination at 5am, but let me know if there's other issues ^__^
hegemonkhan
27 Jun 2017, 10:13Jennifer has already answered, in that you need to create an Attribute and not a Variable.
here's a extensive guide on using Attributes and the 'if' Script:
http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk
here's a step by step walkthrough of the basics of Attribute usage, creating your own demo game:
http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375
ask if you got any questions