Need Help Creating Attribute for Status Window

I want to be able to assign a RANK: Trainee, Cadet, Officer, Corporal, ect. ect.. to my player at the beginning of the game. I don't understand how to navigate the status attribute interface and where to place the code. I've tried to follow along with some of the info in the forum, but only ran into problems.. Any help would be immensely appreciated.


Go to your player object and navigate to the "Attributes" tab! There, add a new item in the Status Attributes list at the very top.

The first thing you enter is the key, aka which attribute the status will display. So if you enter a key of "rank" and your player.rank attribute is a string named "Trainee", it will grab that string.

The second half is the actual, displayed text that will be shown on the status pane. It'll display whatever you type, but substitute "!" with the key's string.

So, if your key is "rank", the player.rank attribute's string is "Trainee" and the key's value is "RANK: !", the status pane will display:

"RANK: Trainee"

And if you change the player.rank attribute to, say, "Cadet", Quest will automatically update the status to:

"RANK: Cadet"


This is helpful. Thanks!

How would I be able to set the rank attribute using an integer?


How would I be able to set the rank attribute using an integer?

For something like that, you'd normally have one attribute containing the integer, and one containing the string. So if you have an int called rank_number, you could create a script attribute called changedrank_number (which will be run every time the int changes), and make its code something like:

ranks = Split("Trainee;Cadet;Officer;Corporal;Sergeant;Lieutenant;Captain;Major;Colonel;Brigadier;Admiral")
if (this.rank_number < 0) {
  this.rank_number = 0
}
else if (this.rank_number >= ListCount (ranks)) {
  this.rank_number = ListCount (ranks) - 1
}
else {
  this.rank = ListItem(ranks, this.rank_number)
}

In this case, it checks that the rank_number isn't negative or too high before changing the rank attribute to the appropriate rank name. (Note that when you make a list like this, the first rank on the list will correspond to rank_number 0)

Hope that helps.


This worked! Kudos mrangel!


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

Support

Forums