status pane health showing.

I would like to have my custom health show in the pane like this

Health 35/50

The first number being current health and second max health. I have 3 attributes right now

1- Health : interger
2-Health_max : script - player.Health_max = player.vitality*10
3-vitality : interger (5)

I don't know if my Health_max work tho, I just thought of a way to set it up to be increased later by increasing the vitality attribute so if you guys see it won't work pls also tell me :)


You need to have another attribute, say Health_status, and every time health of max change, change that too. Use Health_status as the status attribute.

Health_status = Health + "/" + Health_max 

(every time health of max change, change that too.)
What do you mean? Wouldn't it update automatically?

If players put 1 point in vitality then Health_max goes up by 10 or if the players heal then
Health_status = Health + "/" + Health_max
should change automatically since it pull his number from those attributes right?

sorry if it's a stupid question.


(filler for getting my edited post, updated/posted)


here you go, a step by step walkthrough guide on using the 'statusattributes' and 'current/maximum' stats:

(scroll past the stuff at the very top of my post, as I'm responding to a user's post, start at the 'conceptual about' section)

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


there's two methods of updating your stats (via using features that happen/run/execute every turn and/or whenever an Attribute's Value changes):

  1. the special 'changed' Script Attribute

syntax naming: changedNAME_OF_ATTRIBUTE

every time the specified Attribute's Value changes, the scripts that you add to within this special 'changed' Script Attribute, are run/done/executed/activated

  1. the 'Turnscript' Element (as long as its 'enabled' and/or if its a local Turnscript, only when you're in the same room as it)

it is executed/activated/run every internal turn (typed in command into the command text box at the bottom or mouse click on a blue hyperlink or whatever else), so you can add whatever scripts you want within here too


  1. manually (you coding it in every where it needs to be, obviously if able, it's much better to use the two methods above if able for your game design):

see the: *an example, below


to update your 'current/maximum' stats within the 'statusattributes', as Pixie already explained, you got to use a String Attribute, which holds the 'current' and 'maximum' Integer Attributes within it, and use this String Attribute Assignment Operation* when ever you have your 'current/maximum' Integer Attributes' Values changed and/or when you want to display the 'current/maximum' stats

*an example:

player.life_string_attribute = player.current_life_integer_attribute + "/" + player.maximum_life_integer_attribute
// example displayment:
// 999/999

all of this is done in my link above, in my step by step guide


if you need any help or got any questions, we'll be glad to help you until you get it right and working as you want


ok, cool so just to be sure the form of my Health_max will work as intended right? meaning

player.Health_max = player.vitality*10

will take the vitality integer and multiplied it by 10 right? so if vitality is 5 Health_max will be 50.


Io

That's what it should do, yes.


yes, mathematical expressions (using Assignment Operations) can be as simple or complex as you want

player.strength = 0

player.strength = 100

player.strength = player.strength + 10

player.life = (player.endurance + player.strength) / 2

create ("katana")
katana.damage = 50
player.weapon = katana
player.strength = 100
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [100] / 100
// player.damage = 100

create ("katana")
katana.damage = 50
player.weapon = katana
player.strength = 50
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [50] / 100
// player.damage = 75

create ("katana")
katana.damage = 50
player.weapon = katana
player.strength = 0
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [0] / 100
// player.damage = 50

create ("katana")
katana.damage = 100
player.weapon = katana
player.strength = 100
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [100] + [100] * [100] / 100
// player.damage = 200

create ("katana")
katana.damage = 0
player.weapon = katana
player.strength = 100
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [0] + [0] * [100]/100
// player.damage = 0

create ("katana")
katana.damage = 75
player.weapon = katana
player.strength = 100
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [75] + [75] * [100]/100
// player.damage = 150

create ("katana")
katana.damage = 25
player.weapon = katana
player.strength = 100
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [25] + [25] * [100]/100
// player.damage = 50

create ("katana")
katana.damage = 50
player.weapon = katana
player.strength = 75
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [75]/100
// player.damage = ~88

create ("katana")
katana.damage = 50
player.weapon = katana
player.strength = 25
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [25]/100
// player.damage = ~63


// the Assignment Operation is unique to programming:
//
// the FINAL Value on the right side of the equal sign (Assignment Operator in this case: quest knows when the equal sign is an Assignment operation vs a Comparison Operation: A Comparison Operation uses the 'if' Script/Function) is STORED INTO the VARIABLE on the left side of the equal sign
//
// so, while in math, you can do this:
//
// x = 10
// or
// 10 = x
//
// you can't do this with the Assignment Operation in programming:
//
// 10 = x // ERROR!
// NOR:
// 10 = player.strength // ERROR!
//
// as remember, the VARIABLE MUST BE on the left side of the equal sign for the Assignment Operation
//
// (technically, what you're doing in math/algebra is a Comparison operation, as you're trying to prove/solve it, but they don't teach that in math class, unfortunately)


// conceptually how Arithmetic expressions using Assignment Operations, works:
//
// (using a simple addition expression as an example):
//
// player.strength = player.strength + 10
//
// (let's say our initial/old strength is zero: player.strength = 0)
//
// player.strength = player.strength + 10
// player.strength (NEW) = player.strength (OLD: 0) + 10
// player.strength (NEW) = (0) + 10
// player.strength (NEW) = 10
//
// new value: player.strength = 10
//
// old value: player.strength = 10
//
// player.strength = player.strength + 10
// player.strength (NEW) = player.strength (OLD: 10) + 10
// player.strength (NEW) = (10) + 10
// player.strength (NEW) = 20
//
// new value: player.strength = 20
//
// old value: player.strength = 20
//
// player.strength = player.strength + 10
// player.strength (NEW) = player.strength (OLD: 20) + 10
// player.strength (NEW) = (20) + 10
// player.strength (NEW) = 30
//
// new value: player.strength = 30
//
// old value: player.strength = 30
//
// etc etc etc


Log in to post a reply.

Support

Forums