Help with custom status attributes

I just want to display a status attribute that reads HP: currenthp / maxhp (HP: 100 / 100)

  1. I created an object type called playerstats.
  2. I added HP as a string attribute.
  3. I added currenthp and maxhp as integers.
  4. I had the player object inherit player stats.
  5. I have added the inherited HP to player status.
    I just can't figure out the next step. How do I make status window display what I want. Every attempt to edit the string attribute just displays what I've written.
    ""HP " +playerstats.currenthp+ "/" +players tats.maxhp+ ""

I am totally stumped and really am lacking the knowledge to proceed any further. Any help would really be appreciated.


Nevermind


Did you set a ! in the box at the top?


Hi Jennifer. Thanks for replying. Where does the ! Go?


Status attributes display their value. If it's a string containing some text, that text will be displayed.

What you probably want to do is give your type two script attributes named changedcurrenthp and changedmaxhp. These would both contain a line like:

this.HP = this.currenthp + "/" + this.maxhp

Whenever currenthp is changed, the corresponding changescript runs automatically. In this case, it would set the HP attribute to a string like "95/100", which can be displayed using the statusattributes system.


I just used ! as the variable in the status attribute box at the top of the object's attribute page.
This is the page I followed.
https://docs.textadventures.co.uk/quest/status_attributes.html


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

Support

Forums