How to change a counter?

Hey, I'm new to Quest, and I'm creating a gamebook. I'm having trouble trying to figure out how to change my Health counter, like when you make the wrong decision and click on the wrong link you lose one hp, but how? I already figured out how to show a specific counter, but I don't know how to change it when you click onto another link.
I searched and searched, but they were all based on Text Adventure, which I don't like because I hate coding that much. I just wanna write.


It should be as simple as:
HP=HP-1


Coding is just writing/typing... wink


with the Game Book, you're going to have to do a bit of coding:

'WHATEVER' Page Object -> 'Page' Tab -> Page Type: [script] or [script + text]

add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = [EXPRESSION] VALUE_OR_EXPRESSION

in the Game Book, you only got 3 types of Objects to use:

  1. the special 'game' Game Settings and Publishing Info Object
  2. the (default named) 'player' Player Object
  3. your 'Page' Page Objects

Arithmetic Operation examples:

Addition:

set variable player.strength = [EXPRESSION] player.strength + 5
set variable game.state = [EXPRESSION] game.state + 2
set variable Page2.state = [EXPRESSION] Page2.state + 8

Subtraction:

set variable player.strength = [EXPRESSION] player.strength - 1

Multiplication:

set variable player.strength = [EXPRESSION] player.strength * 3

Division:

set variable player.strength = [EXPRESSION] player.strength / 2

Modulus (division, but it gets/finds/returns the REMAINDER):

set variable game.clock_military_hours = [EXPRESSION] game.hours_count % 24
set variable game.clock_civilian_hours = [EXPRESSION] game.hours_count % 12

example of a bit more complex expression:

set variable player.life = [EXPRESSION] (player.strength + player.endurance) / 2


for conditionals, you need to use the 'if' Script:

'WHATEVER' Page Object -> 'Page' Tab -> Page Type: [script] or [script + text]

add new script -> 'scripts' section/category -> 'if' Script -> (see below)

// example 1:

if [EXPRESSION] player.current_life > player.maximum_life

-> then -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.current_life = [EXPRESSION] player.maximum_life

// example 2:

if [EXPRESSION] player.poisoned

-> then -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable player.current_life = [EXPRESSION] player.current_life - 50


Quest takes it as player.health. Simply do:

player.health = player.health - 2

If you want to be more specific/complex, you could...
(This may not work, I don't know. Health might be set at 100. Just try it.)
game start script

player.health = 20

New function or verb

roll = GetRandomInt(1,3)
player.health = player.health - roll

Uh where do you type these codes?


I hope this helps. I guess you put them in the game part, and the page part.

http://i.imgur.com/LLOFNs6.jpg
http://i.imgur.com/QSAXkPE.jpg
http://i.imgur.com/xf0Mc8O.jpg
http://i.imgur.com/SKannVA.jpg


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

Support

Forums