I don't know how the built-in 'health' percent Attribute works as it confuses me, lol, so, I just create my own 'life~hp' Attribute.
-----------------
VARIABLES:
in GUI~Editor: run as script -> add a~new script -> variables -> 'set a variable or attribute' Script -> (see below)
I don't know the GUI~Editor very well, so I don't know what drop down options you choose and etc to set it up, so you got to figure that out on own, or you can choose the ' [expression] ' drop down choice, and type~code in the Attribute Expression yourself as I do (see below)
Variables:
these are local~temporary for use only in its own script block, not 'save-able ~ load-able' and thus can't be used anywhere in your game code.
Variable_name
~OR~
Variable_name=Value_or_Expression
Attributes:
these are global~permanent (so long as the Object that they're attached to, exists or still exists, of course), they are 'save-able ~ load-able' and thus can be used anywhere in your game code, their use is not limited to their own script block.
Object_name.Attribute_name
~OR~
Object_name.Attribute_name=Value_or_Expression
-------------------
String Attributes:
strings are just a collection of symbols (alphabet, numbers, and other various symbols like an underscore, but not all symbols are allowed)
as a (String) Attribute's Value, when directly writing in code (as I show below this code box), they must have double quotes surrounding~encasing them (as without the double quotes, quest will see them as Object Attributes, and not as String Attributes)
however, when writing their Values in the GUI~Editor's text box, you do NOT need to encase them in double quotes if they're just Values, but if you're doing an Expression, then you do got to use the double quotes for the textual parts, like how you do when writing in expressions in code.
example strings:
a
abc
1
123
abc123
dead
normal
poisoned
abc_123
kadfnsjbvojbsogn
player.condition="normal"
player.condition="poisoned"
game.static_greeting="Hi, how are you?"
game.dynamic_greeting="Hi, how are you " + player.alias + "?"
game.state="0"
game.state="1"
orc.dead="false"
orc.dead="true"
HK.favorite_color="black"
--------------
the secret trick to writing dynamic (String) Expressions:
break them up into two chunks:
1. "textual parts"
2. +Object_name.Attribute_name+
for example:
player.alias="HK"
player.age_integer=18 // I wish I was 18 again, lol
player.age_string="adult"
player.sex="male"
player.race="human"
player.class="warrior"
msg (player.alias + " is a " + player.age_integer + " year old " + player.age_string + " " + player.sex + " " + player.race + " " + player.class + ".")
// outputs: HK is a 18 year old adult male human warrior.
the chunks:
player.alias +
" is a "
+ player.age_integer +
" year old "
+ player.age_string +
" {empty space: an empty space, aka the spacebar key, counts as a symbol~string just as an underscore, and as the letter 'a', does} "
+ player.sex +
" {space} "
+ player.race +
" {space} "
" player.class +
" {period~dot, as my eyes are bad and can't see it, lol} "
OR, you can just use the text processor commands:
http://docs.textadventures.co.uk/quest/ ... essor.htmlmsg ("{player.alias} is a {player.age_integer} year old {player.age_string} {player.sex} {player.race} {player.class}.")
just to see it better:
msg ( " {player.alias} is a {player.age_integer} year old {player.age_string} {player.sex} {player.race} {player.class} . " )
---------------
Integer Attributes:
these are non-decimal numbers
player.strength = 100
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100 - (orc.armor.resistance + orc.armor.resistance * orc.endurance / 100)
-------------
Double (Floats~Floating Points) Attributes:
these are decimal numbers
(I've never used them, so I don't know if their Values are within double quotes or not)
player.damage = "54.2"
~OR~
player.damage = 54.2
-------------
Boolean Attributes:
their values are only: 'true' or 'false', NO double quotes
orc.dead=false
orc.dead=true
player.flying=false
player.flying=true
their shortened usage is:
orc.dead
not orc.dead
if (orc.dead) { msg ("The orc is dead.") }
else if (not orc.dead) { msg ("The orc is alive.") }
orc.dead --------> understood as its Value being 'true' --------> true
not orc.dead --------> not (understood as its Value being 'true' ) --------> not (true) -------> false
their full-form usage is:
if (orc.dead=true) { msg ("The orc is dead.") }
else if (orc.dead=false) { msg ("The orc is alive.") }
~OR~
if (orc.dead=true) { msg ("The orc is dead.") }
else if (not orc.dead=true) { msg ("The orc is alive.") }
-----------
Object Attributes:
their Values must NOT have double quotes (as that would tell the quest engine that they're String Attributes, and not Object Attributes), and their Values can't be 'false' or nor 'true' as these are special~reserved for Boolean Attributes.
game.pov = player
player.parent = room
player.right_hand = sword
player.left_hand = shield
and they must be actually existing Objects of course (see below)
<game name="xxx">
</game>
<object name="player">
</object>
<object name="room">
</object>
<object name="sword">
</object>
<object name="shield">
</object>
-----------------
String List Attributes:
http://docs.textadventures.co.uk/quest/ ... split.htmlhttp://docs.textadventures.co.uk/quest/ ... _menu.htmlHK.favorite_colors=split ("black;red", ";")
global_data_object.sex_stringlist_attribute = split ("male;female", ";")
game.primary_pigment_colors=split ("red;blue;yellow", ";")
show menu ("Sex?", split ("male;female", ";"), false) { scripts }
~OR~
show menu ("Sex?", global_data_object.sex_stringlist_attribute, false) { scripts }
show menu ("Favorite Primary Pigment Color?", split ("red;blue;yellow", ";"), false) { scripts }
~OR~
show menu ("Favorite Primary Pigment Color?", game.primary_pigment_colors, false) { scripts }
------------
etc Attributes:
too tired~lazy
------------
these are the math computational expressions:
Addition:
Object_name.Integer_Attribute_name = Object_name.Integer_Attribute_name + Value_or_Expression
Subtraction:
Object_name.Integer_Attribute_name = Object_name.Integer_Attribute_name - Value_or_Expression
Multiplicatin:
Object_name.Integer_Attribute_name = Object_name.Integer_Attribute_name * Value_or_Expression
Division:
Object_name.Integer_Attribute_name = Object_name.Integer_Attribute_name / Value_or_Expression
------
conceptually of how it works (using addition):
initial: player.strength=0
-------
old: player.strength=0
player.strength(new)=player.strength(old:0)+5
player.strength(new)=0+5=5
new: player.strength=5
------
old: player.strength=5
player.strength(new)=player.strength(old:5)+5
player.strength(new)=5+5=10
new: player.strength=10
------
old: player.strength=10
player.strength(new)=player.strength(old:10)+5
player.strength(new)=10+5=15
new: player.strength=15
---------
as to why its not working for you... you're confusing (messing up) a few things... and it'll take a bit of time to explain all of these things...
so, let's first just do it in the simpliest way, as a starting example, of what you do for it to work:
'player' Player Object -> 'Attributes' Tab -> Attributes (NOT Status Attributes) -> Add -> (see below, repeat as needed)
(Object Name: player)
Attribute Name: life
Attribute Type: int (integer)
Attribute Value: 999
(Object Name: player)
Attribute Name: damage
Attribute Type: int (integer)
Attribute Value: 100
'room' Room Object -> 'Objects' Tab -> Add -> Object Name: orc
'orc' Object -> 'Attributes' Tab -> Attributes (NOT Status Attributes) -> Add -> (see below, repeat as needed)
(Object Name: orc)
Attribute Name: life
Attribute Type: int (integer)
Attribute Value: 500
(Object Name: orc)
Attribute Name: damage
Attribute Type: int (integer)
Attribute Value: 50
'orc' Object -> 'Verbs' Tab -> Add -> Verb Name: fight -> [run as script] -> (see below)
add new script -> print a message -> [expression] -> "{player.name} has {player.life} life left."
add a script -> print a message -> [expression] -> "{orc.name} has {orc.life} life left."
add a script -> variables -> 'set a variable or attribute' Script -> Set variable orc.life = [expression] orc.life - player.damage
add a script -> print a message -> [expression] -> "{player.name} does {player.damage} damage to {orc.name}, it now has only {orc.life} life left."
add a script -> variables -> 'set a variable or attribute' Script -> Set variable player.life = [expression] player.life - orc.damage
add a script -> print a message -> [expression] -> "{orc.name} does {orc.damage} damage to {player.name}, it now has only {player.life} life left."
obviously, we want some more stuff with this, but this is the basic.
-------------------------------------
as to your issues....
---
issue 1, choose either 'dead' or 'alive' for your Boolean Attribute, but don't use both, as can be seen:
Object_name.dead = false ---> conceptually: alive
Object_name.dead = true ---> conceptually: dead
~OR~
Object_name.alive = false ---> conceptually: dead
Object_name.alive = true ---> conceptually: alive
or, if you rather, don't use a Boolean Attribute (as it's limited to only two opposing Values: true~false), and instead use a String Attribute such as using 'condition' (or 'status_effects' ) as the String Attribute's Name, as it can have an unlimited number of single Values:
Object_name.condition = "normal"
Object_name.condition = "dead"
Object_name.condition = "unconscious"
Object_name.condition = "poisoned"
Object_name.condition = "asleep"
Object_name.condition = "stunned"
Object_name.condition = "paralyzed"
Object_name.condition = "petrified"
Object_name.condition = "silenced"
if (player.condition="dead") {
// having the 'player' be able to be 'dead' is for having a team~party (as the other characters can revive dead characters), as then we'd check if all of your characters are dead, and end game if so.
// if you don't have a team~party, then (generally) there's really no reason for this, as you'd just check if life<=0, ending the game if it is.
msg ("You died or were killed.")
msg ("GAME OVER")
} else if (player.condition="poisoned") {
player.life = player.life - 50
msg ("The poison does 50 damage to your life.")
} else if (...etc...) { scripts }
or... if you need~want an unlimited number of multiple values, then you need to use a List Attribute (adding and removing values from the list):
player.condition=split ("normal;alive",";")
// you get poisoned:
list remove (player.condition, "normal")
list add (player.condition, "poisoned")
// in code, it would now look like this: player.condition=split ("alive;poisoned", ";")
// or, you get killed:
list remove (player.condition, "alive")
list add (player.condition, "dead")
// in code, it would now look like this: player.condition=split ("normal;dead", ";")
// or, you get poisoned and killed:
list remove (player.condition, "normal")
list add (player.condition, "poisoned")
list remove (player.condition, "alive")
list add (player.condition, "dead")
// in code, it would now look like this: player.condition=split ("poisoned;dead", ";")
if (ListContains (player.condition, "poisoned") and ListContains (player.condition, "dead")) {
player.life = player.life - 50
msg ("You are dead, yet the poison still remains as well.")
msg ("You need another character to revive you and cure you of your poison.")
}
----
issue 2:
adammadam wrote:so what is working is when I "attack monster" in game, it gives the message "you attack monster". When I look at the monster in game it says "it looks alive". When I set the monsters health to zero and play the game again, looking at the monster says "it looks dead". Which is great those things are working. But what isn't working is when I start a new game with the monsters health on 10, attack the monster, it says "you attack monster" but then it never dies, I can keep on attacking it, I'm guessing its health is never going down.
for the part that is working, you got it set up correctly for your 'if (monster.health>0)...' scripting:
Object_name.Attribute_name = Value_or_Expression
Object_name = monster
Attribute_name = health
Attribute_name = dead
Attribute_name = alive
// though, you shouldn't have both 'dead' and 'alive' Boolean Attributes, as I've already said above.
but you are confused a bit with how to set up the 'attack' Command properly:
delete your 'attack' Command, as this is a bit more advanced, let's just stick with using the GUI~Editor's Verb usage for now, your 'attack' Verb.
you're still learning quest and~or coding... so you don't want to be trying to do~use too many things (especially the more advanced things) all at once.
------
issue 3,everything else looks fine (I think), so just MAKE SURE that your 'health' and 'damage' Attributes on your 'monster' Object and 'player' Player Object, are indeed (set to~as) the Attribute Type: int