Help with custom status. Increase/Decrease Status

So I have been trying to make this custom status work for a while.

I go to player ->attributes and in the status attributes I add Attribute name Will Power and format string Will Power 100/100, seeing as if I don't add Will Power then it just says 100/100 in the status box.

From here I'm not sure what to do I have tried a number of things from " Set a variable or attribute " and "Increase/Decrease object counter ". I would image the former being what I'm after but am unsure how to decrease/increase as it always ends up as a error when testing.

So for example something happens to the hero and his 100/100 goes to 80/100 or vice versa.


Io

The way I'd do this is actually create 2 Attributes. Willpower and MaxWillpower, both as doubles. So in your case you'd have Willpower=100 and MaxWillpower=100.

In dialogue, you can display it as 100/100 by doing stuff like:

"Willpower is {Player.Willpower}/{Player.MaxWillPower}"

From there you can do the Set Variable or Attribute like so:

Player.Willpower=80

Or:

Player.Willpower=Player.Willpower-20

If you're familiar with changeScripts and want to get fancy, you can also create a changeScript for Willpower, such that you don't go above or below set variables. So if you didn't want to be able to go above your MaxWillpower - whatever it is - or below 0:

if Player.Willpower>Player.MaxWillpower:
       Player.Willpower=Player.MaxWillpower
else if Player.Willpower<0:
     Player.Willpower=0

Pardon my psuedocode. Hope this helps!


@lo
Just tried but still getting errors. This is one Error running script: Error compiling expression 'player.Willpower-20': ArithmeticElement: Operation 'Subtract' is not defined for types 'Object' and 'Int32'

So I'm not setting it up correctly or I'm not understanding.


Io

What happens here is you're not setting it up right. The specific error you're getting means the attribute named 'Willpower' does not exist for the object named 'player'. It doesn't have to strictly be 'Player' like in my example. If you have the player controlling an object named 'Hero' then it'd be 'Hero.Willpower'.

On a second readthrough, I think I more thoroughly understand what you want. For a little display on the side to read 'Willpower 100/100' and such, where Health and Score would be, right? For that, using my example, you'd need a 3rd attribute (2 if you don't want MaxWillpower), one to actually DISPLAY the result.

So it'd look like - without MaxWillpower - that you give your object, say, Hero, the status Willpower as a blank string that the player actually sees, and the attribute WillpowerNumber as a double equal to 100.

Then you'd have code write, again in psuedocode:

Hero.Willpower="Willpower "+Hero.WillpowerNumber+"/100"

Or however it is you want to format it.

Then, say, somewhere a rock falls on the hero's head and reduces their willpower.

Hero.WillpowerNumber=Hero.WillpowerNumber-20

But wait, is Hero.Willpower still showing it as 100/100 and not 80/100? Update Hero.Willpower to properly reflect the new WillpowerNumber with

Hero.Willpower="Willpower "+Hero.WillpowerNumber+"/100"

That's where changeScripts are VERY useful. Rather than need to include the Willpower Display Update Code every single time anything might possibly change Willpower, you just go to Hero, click the WillpowerNumber attribute, and use the button (Alongside Add Attribute, Remove Attribute etc) to make a Changescript for Hero.WillpowerNumber, and put the code there.

That way, ANY time ANYTHING changes Hero's WillpowerNumber, it'll automatically update your Hero.Willpower display!


Yes I'm trying to make it like the health bar, if I could just rename the health bar to Willpower I would since I figured out how to increase/decrease that with ease. But this is just silly, the worst part is I feel like I'm close as I stare at one of the help pages but I just can't seem to make it work!


Io

Hmm, this is indeed a pickle. I'm not actually used to doing anything with Statuses. But I have discovered something that might help you in the right direction.

The attribute Health is stored in an interesting way. It's not player.Health. Nor is it even game.Health. It's stored, specifically, as "game.pov.health". So if you want to directly change stuff with Health, rather than rely directly on the inbuild Increase/Decrease health, you'd need to do something like:

game.pov.health=game.pov.health*0.45

And that changes it just fine. I found this by clicking Filter in the very bottom left, checking to Show Library Elements, and searching for the function IncreaseHealth. I also see, when searching for Status, a bunch of stuff like UpdateStatusAttributes and InitStatusAttributes (Init being Initialize).

I'm sorry I can't be of more help, but this has started to leave the things I know behind.


Io

NEVERMIND, BREAKTHROUGH!

What you want is to leave the format blank, when you create the Willpower status. Just blank, for default. Then in the player - or Hero or whatever - object have your WillpowerNum and WillpowerMax and whatever. And when you want to update the actual display, do:

game.pov.Willpower = player.WillpowerNum+"/"+player.WillpowerMax

It may vary a bit depending on what your actual attributes end up being called, but it works perfectly.

A learning experience for us both! The only difficulty is you'll need to setup Willpower's display immediately on gamestart, as it starts off as "Willpower: "


Well... I have it saying Willpower: in Status now but I still can't seem to err... write? the correct status attributes.

going into the game / attributes I put in status attributes Key Willpower and Value blank. From their it just... falls to pieces for me most likely due to me not understanding like the mook I am.

In player /attributes I made two one saying WillpowerNum and WillpowerMax both with value 100 but then it just reads.
Status
Willpower:
100
100


Io

It's like I said. To use the example of my own names, you put Willpower (The actual status that gets shown to the player) in the games' status attributes, and you leave its format blank.

The WillpowerNum (The actual hidden number of the Willpower) and WillpowerMax (The hidden max value that you can do without) is something I give the actual player object, not the game itself. So I have an object, and that object itself has the attributes WillpowerNum and WillpowerMax - which are set to be Double type (Numbers with decimals enabled) with value 100. So we end up with a trio:

game.pov.Willpower - the actual words. Whatever this is equal to is what will show up. If it's equal to "454/3546" you'll see "Willpower: 454/3546"

player.WillpowerNum - the current Willpower

player.WillpowerMax - the maximum Willpower.

And when we want to change the players' willpower by, say, them getting foodsick and throwing up:

player.WillpowerNum=player.WillpowerNum-20 (Reduces the actual WillpowerNum by 20)
game.pov.Willpower=player.WillpowerNum+"/"+player.WillpowerMax  (Sets the words that the Willpower will show up as to be whatever-our-number-is, a slash, and whatever-our-max-is)

Ok well I think key word being think that I am close. Like you said I did put the Willpower in game section and messing around with player attributes I'm no longer getting a error when I do a test hit but the number 100 is not showing.

Under player / attributes ( not the status attributes ) I made a Name WillpowerNum Value 100 with Assignment Double 100 and the other one the same just name WillpowerMax.

I'm very sorry about all this BTW at this point I might just stop.


Status Attributes:

here's a step by step walkthrough creation of a demo game guide via using the GUI/Editor

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

ask if you need help with anything (sorry, I didn't respond soon'er)


the big trick/secret is:

along with needing a 'CURRENT_STAT' Integer Attribute and a 'MAXIMUM_STAT' Integer Attribute (and optionally, a 'MINIMUM_STAT' Integer Attribute)

for the status attribute itself, you need a 'STAT' String Attribute

for quick conceptual scripting example (use my link above following its step by step for much better help):

// constant Integer Attribute and its Value:

player.minimum_life = 0 // your Integer Attributes

// initial values and displayment:

player.current_life = 999 // your Integer Attributes
player.maximum_life = 999 // your Integer Attributes

player.life = "Player Life: 999/999" // your String Attribute

// the status attribute just uses the 'player.life' String Attribute (we need this String Attribute for the status attribute's displayment of it):

player.statusattributes = NewStringDictionary ()
dictionary add (player.statusattributes, "life", !)

the 'life' is the name of my example String Attribute (player.life)

the '!' tells quest to input the 'player.life' String Attribute's current value (which is our initial displayment of): 'Life: 999/999'

// unfortunately, the status attributes, don't automatically update for us, so we got to cause it to update for us, which the easiest and usually best way is via the special 'changedNAME_OF_ATTRIBUTE' Script Attributes:

player.changedcurrent_life => {

  // handling/correcting if/should your current life be/get raised above the maximum life or below the minimum life (if you want this type of game mechanic, of keeping a stat in a min-max range/bounds, so games don't do this game mechanic however, it's up to you):

  if (player.current_life > player.maximum_life) {
    player.current_life = player.maximum_life
  } else if (player.current_life < player.minimum_life) {
    player.current_life = player.minimum_life
  }

  // this code line below, is the adjustment to the 'player.life' String Attribute, as this is what the status attribute needs to use for its displayment, and since this is within the special 'changed' Script Attribute, it causes your status attributes to update, displaying the new/correct displayment of your 'life' stat:

  player.life = "Player Life: " + player.current_life + "/" + player.maximum_life

}

you also need to handle when/if you 'maximum_life' gets changed as well (such as when leveling up, your maximum life increases):

player.changedmaximum_life => {

  // handling/correcting if/should your current life becomes higher than the maximum life, if/should/if-can your maximum life be lowered below your current life (if you want this type of game mechanic, of keeping a stat in a min-max range/bounds, so games don't do this game mechanic however, it's up to you):

  if (player.current_life > player.maximum_life) {
    player.current_life = player.maximum_life
  }

  // this code line below, is the adjustment to the 'player.life' String Attribute, as this is what the status attribute needs to use for its displayment, and since this is within the special 'changed' Script Attribute, it causes your status attributes to update, displaying the new/correct displayment of your 'life' stat:

  player.life = "Player Life: " + player.current_life + "/" + player.maximum_life

}

usually, a minimum value of a range, isn't adjustable, but if you want this game mechanic, than you got to handle it as well:

player.changedminimum_life => {

  // handling/correcting if/should your current life becomes higher than the maximum life, if/should/if-can your maximum life be lowered below your current life (if you want this type of game mechanic, of keeping a stat in a min-max range/bounds, so games don't do this game mechanic however, it's up to you):

  if (player.current_life < player.minimum_life) {
    // depends on how you want to handle this game mechanic, some examples:
    //
    // player.current_life = player.minimum_life // if you want to be killed by it
    // or
    // player.current_life = player.minimum_life + 1 // if you don't want to be killed by it
  }

  // this code line below, is the adjustment to the 'player.life' String Attribute, as this is what the status attribute needs to use for its displayment, and since this is within the special 'changed' Script Attribute, it causes your status attributes to update, displaying the new/correct displayment of your 'life' stat:

  player.life = "Player Life: " + player.current_life + "/" + player.maximum_life

}

if you're new to coding... this scripting example of mine probably scares you... but my point was just the concept of how it works... hopefully... you can kind-of follow the code and see the concept of how it works (again use my link at the top of my post, as it's a step by step guide on doing all of this for you to follow)


Io
when I do a test hit but the number 100 is not showing.

That's because the Willpower in the game section has no value. When you create it and assign it a format, you're not assigning it a value, but rather filling in the blanks to some godawful code of "How am I supposed to show this on the screen?". Leaving it empty goes to the default of "Willpower: whatever-willpower-is". But it starts empty, so you get "Willpower: " and nothing more.

Find the 'on game start, run script' part of the code - under 'game', under the Scripts tab, the 'Start script' should be it. There, copy-paste in the following code changing names as needed, like player vs Hero or WillpowerNum vs NumWillpower:

game.pov.Willpower=player.WillpowerNum+"/"+player.WillpowerMax

The above code is what will update the display, and is what you need whenever WillpowerNum or WillpowerMax changes.

And no worries, I'm happy to help!


Ok well I think I'm calling it quits yet again. I'm just clearly not getting it and have tried my best at everything you gave to me.

Even looking at the link from hegemonkhan gave I just don't get it! I have messed with every kind of attribute but nothing. Even somehow finding what I believe was the correct spot for your code nothing.


Io

Maybe go to bed, take a look at it tomorrow with fresh eyes. If you can copy-paste the relevant bits of your code from code-view as well, that would help too. That is, where you assign the Willpower status, and where you give the WillpowerNum and such attributes.


@ LordKrei:

did you try following my steps in my link/guide? (here it is pasted below, just the step by step guide itself)


so, here's an example guide using the GUI~Editor, to make a sample game for you:

create a new quest Text Adventure game

first, let's create our Attributes:

'game' Game Object -> 'Attributes' Tab -> Attributes -> Add -> (see below, repeat as needed)

(Object Name: game)
Attribute Name: strength
Attribute Type: int (integer)
Attribute Value: 100

(Object Name: game)
Attribute Name: current_life
Attribute Type: int (integer)
Attribute Value: 999

(Object Name: game)
Attribute Name: maximum_life
Attribute Type: int (integer)
Attribute Value: 999

(Object Name: game)
Attribute Name: life
Attribute Type: string
Attribute Value: 999/999

// these special 'changed' Script Attributes are for causing the updating of the status pane for when your Attributes' Values change:
(Object Name: game)
Attribute Name: changedcurrent_life
Attribute Type: script
Attribute Value: (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.life = [expression] game.current_life + "/" + game.maximum_life

// these special 'changed' Script Attributes are for causing the updating of the status pane for when your Attributes' Values change:
(Object Name: game)
Attribute Name: changedmaximum_life
Attribute Type: script
Attribute Value: (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.life = [expression] game.current_life + "/" + game.maximum_life

'player' Player Object -> 'Attributes' Tab -> Attributes -> Add -> (see below, repeat as needed)

(Object Name: player)
Attribute Name: strength
Attribute Type: int (integer)
Attribute Value: 100

(Object Name: player)
Attribute Name: current_life
Attribute Type: int (integer)
Attribute Value: 999

(Object Name: player)
Attribute Name: maximum_life
Attribute Type: int (integer)
Attribute Value: 999

(Object Name: player)
Attribute Name: life
Attribute Type: string
Attribute Value: 999/999

// these special 'changed' Script Attributes are for causing the updating of the status pane for when your Attributes' Values change:
(Object Name: player)
Attribute Name: changedcurrent_life
Attribute Type: script
Attribute Value: (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.life = [expression] player.current_life + "/" + player.maximum_life

// these special 'changed' Script Attributes are for causing the updating of the status pane for when your Attributes' Values change:
(Object Name: player)
Attribute Name: changedmaximum_life
Attribute Type: script
Attribute Value: (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.life = [expression] player.current_life + "/" + player.maximum_life

now, let's set up our 'statusattributes' String Dictionary Attributes:

'game' Game Object -> 'Attributes' Tab -> Status Attributes -> Add -> (see below, repeat as needed)

(Object Name: game)
Status Attribute's Inputs:
Attribute Name (Key): strength
Format String (Value): Game Strength: !
// initial output~display: Game Strength: 100

(Object Name: game)
Status Attribute's Inputs:
Attribute Name (Key): life
Format String (Value): Game Life: !
// initial output~display: Game Life: 999/999

'player' Player Object -> 'Attributes' Tab -> Status Attributes -> Add -> (see below, repeat as needed)

(Object Name: player)
Status Attribute's Inputs:
Attribute Name: strength
Format String: Player Strength: !
// initial output~display: Player Strength: 100

(Object Name: player)
Status Attribute's Inputs:
Attribute Name: life
Format String: Player Life: !
// initial output~display: Player Life: 999/999

and lastly, for testing of our status attributes for changing Attributes' Values:

'room' Room Object -> 'Objects' Tab -> Add -> (see below, repeat as needed)

Object Name: increase_game_strength
Object Name: decrease_game_strength
Object Name: increase_player_strength
Object Name: decrease_player_strength
Object Name: increase_game_current_life
Object Name: decrease_game_current_life
Object Name: increase_game_maximum_life
Object Name: decrease_game_maximum_life
Object Name: increase_player_current_life
Object Name: decrease_player_current_life
Object Name: increase_player_maximum_life
Object Name: decrease_player_maximum_life

'increase_game_strength' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.strength = [expression] game.strength + 10

'decrease_game_strength' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.strength = [expression] game.strength - 10

'increase_player_strength' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.strength = [expression] player.strength + 10

'decrease_player_strength' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.strength = [expression] player.strength - 10

'increase_game_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.current_life = [expression] game.current_life + 100

'decrease_game_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.current_life = [expression] game.current_life - 100

'increase_game_maximum_life' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.maximum_life = [expression] game.maximum_life + 100

'decrease_game_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.maximum_life = [expression] game.maximum_life - 100

'increase_player_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.current_life = [expression] player.current_life + 100

'decrease_player_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.current_life = [expression] player.current_life - 100

'increase_player_maximum_life' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.maximum_life = [expression] player.maximum_life + 100

'decrease_player_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.maximum_life = [expression] player.maximum_life - 100

and hopefully this all works for you! save your game file, and play~study~test it! (HK crosses fingers that he's got no mistakes, lol)


Copied and changed the name when needed and for the most part it ended up just fine I see in the status box [ Game Willpower: 100/100 ] and another one just with player, the thing I'm after.

Then when I tried testing all I got was [ Error running script: Error compiling expression 'game.Willpower - 10': ArithmeticElement: Operation 'Subtract' is not defined for types 'String' and 'Int32' ]


Io

Ah, that's the problem. It's not "game.Willpower", it's "game.pov.Willpower". game.pov.Willpower is a String, and even if it's "50" the game treats it like letters. You can't 'subtract 10' from letters, so you get the error.

It wouldn't even be game.pov.Willpower-10, either. It's player.WillpowerNum-10, remember. Think of player.WillpowerNum as a clock storing the time, and game.pov.Willpower as the clock's actual flashing lights showing the number. You change player.WillpowerNum, and then update game.pov.Willpower to say "Ah yes, it's player.WillpowerNum-o'clock".


That did not seem to work says the same thing just with .pov.

[ Error running script: Error compiling expression 'game.pov.Willpower - 10': ArithmeticElement: Operation 'Subtract' is not defined for types 'String' and 'Int32' ]


Io

Read it again. I made some edits because I didn't think I was clear.

TL;DR - You want player.WillpowerNum-10, because game.pov.Willpower is treated as letters. You can no more do game.pov.Willpower-10 than you can subtract 10 from the word "Fox".


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


@ Lord Krei:

let's start from scratch and learn how to do status attributes, okay? (I'll help you step by step, if/when you need help with any of the steps):

(trying to fix your code, as you're experiencing, is quite a pain, especially when you don't know coding, and so, you're getting frustrated and confused, and feeling lost/hopeless)


create a new quest Text Adventure game


first, let's create our Attributes:

'game' Game Object -> 'Attributes' Tab -> Attributes -> Add -> (see below, repeat as needed)

(Object Name: game)
Attribute Name: strength
Attribute Type: int (integer)
Attribute Value: 100

(Object Name: game)
Attribute Name: current_life
Attribute Type: int (integer)
Attribute Value: 999

(Object Name: game)
Attribute Name: maximum_life
Attribute Type: int (integer)
Attribute Value: 999

(Object Name: game)
Attribute Name: life
Attribute Type: string
Attribute Value: 999/999

// these special 'changed' Script Attributes are for causing the updating of the status pane for when your Attributes' Values change:
(Object Name: game)
Attribute Name: changedcurrent_life
Attribute Type: script
Attribute Value: (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.life = [expression] game.current_life + "/" + game.maximum_life

// these special 'changed' Script Attributes are for causing the updating of the status pane for when your Attributes' Values change:
(Object Name: game)
Attribute Name: changedmaximum_life
Attribute Type: script
Attribute Value: (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.life = [expression] game.current_life + "/" + game.maximum_life

'player' Player Object -> 'Attributes' Tab -> Attributes -> Add -> (see below, repeat as needed)

(Object Name: player)
Attribute Name: strength
Attribute Type: int (integer)
Attribute Value: 100

(Object Name: player)
Attribute Name: current_life
Attribute Type: int (integer)
Attribute Value: 999

(Object Name: player)
Attribute Name: maximum_life
Attribute Type: int (integer)
Attribute Value: 999

(Object Name: player)
Attribute Name: life
Attribute Type: string
Attribute Value: 999/999

// these special 'changed' Script Attributes are for causing the updating of the status pane for when your Attributes' Values change:
(Object Name: player)
Attribute Name: changedcurrent_life
Attribute Type: script
Attribute Value: (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.life = [expression] player.current_life + "/" + player.maximum_life

// these special 'changed' Script Attributes are for causing the updating of the status pane for when your Attributes' Values change:
(Object Name: player)
Attribute Name: changedmaximum_life
Attribute Type: script
Attribute Value: (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.life = [expression] player.current_life + "/" + player.maximum_life


now, let's set up our 'statusattributes' String Dictionary Attributes:

'game' Game Object -> 'Attributes' Tab -> Status Attributes -> Add -> (see below, repeat as needed)

(Object Name: game)
Status Attribute's Inputs:
Attribute Name (Key): strength
Format String (Value): Game Strength: !
// initial output~display: Game Strength: 100

(Object Name: game)
Status Attribute's Inputs:
Attribute Name (Key): life
Format String (Value): Game Life: !
// initial output~display: Game Life: 999/999

'player' Player Object -> 'Attributes' Tab -> Status Attributes -> Add -> (see below, repeat as needed)

(Object Name: player)
Status Attribute's Inputs:
Attribute Name: strength
Format String: Player Strength: !
// initial output~display: Player Strength: 100

(Object Name: player)
Status Attribute's Inputs:
Attribute Name: life
Format String: Player Life: !
// initial output~display: Player Life: 999/999


and lastly, for testing of our status attributes for changing Attributes' Values:

'room' Room Object -> 'Objects' Tab -> Add -> (see below, repeat as needed)

Object Name: increase_game_strength
Object Name: decrease_game_strength
Object Name: increase_player_strength
Object Name: decrease_player_strength
Object Name: increase_game_current_life
Object Name: decrease_game_current_life
Object Name: increase_game_maximum_life
Object Name: decrease_game_maximum_life
Object Name: increase_player_current_life
Object Name: decrease_player_current_life
Object Name: increase_player_maximum_life
Object Name: decrease_player_maximum_life

'increase_game_strength' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.strength = [expression] game.strength + 10

'decrease_game_strength' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.strength = [expression] game.strength - 10

'increase_player_strength' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.strength = [expression] player.strength + 10

'decrease_player_strength' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.strength = [expression] player.strength - 10

'increase_game_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.current_life = [expression] game.current_life + 100

'decrease_game_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.current_life = [expression] game.current_life - 100

'increase_game_maximum_life' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.maximum_life = [expression] game.maximum_life + 100

'decrease_game_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable game.maximum_life = [expression] game.maximum_life - 100

'increase_player_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.current_life = [expression] player.current_life + 100

'decrease_player_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.current_life = [expression] player.current_life - 100

'increase_player_maximum_life' Object -> 'Verbs' Tab -> add -> Verb Name: increase -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.maximum_life = [expression] player.maximum_life + 100

'decrease_player_current_life' Object -> 'Verbs' Tab -> add -> Verb Name: decrease -> (see below)

add new script -> variables -> 'set a variable or attribute' Script -> set variable player.maximum_life = [expression] player.maximum_life - 100


and hopefully this all works for you! save your game file, and play~study~test it! (HK crosses fingers that he's got no mistakes, lol)


Oh sh*t I somehow did it! I clicked decrease Willpower and player willpower went down by 10...with no error!

Now I have to transfer this over to the game (as I made a test game out of fear with f*cking up the progress I made).

I thank both of you for your help :P!


awesome! congrats (I'd still recommend trying to do my step by step guide, as I think it'll hopefully teach/cement into you how to do status attributes with ease --- hopefully)

(if worse comes to worse, you can always copy and paste your entire game code here, and we can fix it up for you, this is actually easier for us, than in us and you trying to work/communicate together on what you did and what needs to be changed/fixed up, and how to do it)

(to get at your entire game code, just right click on your game file itself, 'XXX.aslx', and choose to 'open' it, and select a text editor software (notepad, wordpad, Apple: text editor, notepad++, etc), which will bring up your entire game code, which you highlight all of it, copy it, and then paste it here, using the forum-post's code box (as it keeps all the formatting):

m```
(PASTE YOUR ENTIRE MASS OF GAME CODE HERE)
m```

(those weird symbols are from the '~' tilde key, it's in the upper left corner of your keyboard)

but without the m's in front, which produces this:

(PASTE YOUR ENTIRE MASS OF GAME CODE HERE)

Io

Congrats!


@ Lord krei:

welcome to programming! (spending most of your time, NOT doing the coding, but trouble-shooting/debugging/fixing-up your code, of 90% of the time it being very small simple stupid mistakes/typos/errors, so that it works, lol)


Io

@hegemonkhan

of 90% of the time it being very small simple mistakes/typos/errors

The amount of times I nearly ripped my hair out because I confused Player.FighterObject and Player.FightingObject...


even for programming experts as well... it truly is 90% of the time, some small simple stupid mistake/typo/error... we're better at programming then we realize, even those who never coded before, as it's rarely an issue with the entire scripting itself (logic), it's almost always some small simple stupid mistake/typo/error... the issue is realizing it, and where it is (usually you have lots of stupid small simple mistakes/typos/errors, but sometimes just a single one --- which can be really hard to realize and find) ... lol


coding errors:

90% of the time, it's some small simple stupid mistake/typo/error
9% of the time, its some syntax error and/or a logical (math or scripting/'order of operation') error
1% of the time, it's the entire scripting, you got the whole design/logic completely wrong, and need to do it all over


for me... its usually a missing '>' in the ending tag, or the forward-slash, '/>', in the ending tag, or I forget either a beginning or ending curly brace or parenthesis

and for a short while, I was so used to using the Object Types / Types / Inherited Attributes, that when I went to write in the 'include ref' Libraries (as I work directly in code, in the asl/xml), I instead wrote in 'inherit ref' instead of the 'include ref', ARGH! Also... I often mistake it as 'inherited' instead of as 'inherit', as well, ARGH!

the absolute worse error: an accidental [space] character (such as if you copy and paste a lot of code, and you accidentally highlight something too far/much, highlighting-in/copying-in an extra [space] in front of it or after it)... as its near impossible to realize you got an accidental [space] and juts as near impossible to find it... lol


@ Io:

instead of: 'FighterObject' and 'FightingObject'

use 'self/party/team' and 'target/enemy/monster' terminology, wink

'combat_object.self/combat_object.party/combat_object.team'
and
'combat_object.enemy/combat_object.target/combat_object.monster'

I personally, also like to write out descriptive names/labels, and I hate upper-case, and I love underscores, lol:

combat_object.self_object_attribute

as, it allows me to do this:

player.strength_integer_attribute = 100 // actually it'd be a range: 67 to 100, for the string attribute and its value
player.strength_string_attribute = "strong"

player.strength_integer_attribute = 50 // actually it'd be a range: 34 to 66, for the string attribute and its value
player.strength_string_attribute = "average"

player.strength_integer_attribute = 0 // actually it'd be a range: 0 to 33, for the string attribute and its value
player.strength_string_attribute = "weak"

player.alignment_integer_attribute = GetRandomInt (0,100)

------------------

if (player.alignment_integer_attribute > 66) {
  player.alignment_string_attribute = "good"
} else if (player.alignment_integer_attribute > 33) {
  player.alignment_string_attribute = "neutral"
} else if (player.alignment_integer_attribute >= 0) {
  player.alignment_string_attribute = "evil"
}

though, it is a bit of pain, as since they have the same naming/labeling structure/pattern, it does get difficult to tell them apart, you got to read them very slowly and carefully, but it makes it easy to keep them unique, and you know directly what you're dealing with


Io

@ hegemonkhan

I don't know if that'd work. The game I'm making, team fights are a big part of it. I needed a super flexible system that could make any number of combatants, both ally and enemy, and have them all execute different moves, with different stats and health. I did this by making a BaseFighterObject and stuck it in a debugroom, and when a fight starts I clone a bunch of it and put it in the Fight room. Permanent fighters - like, say, the main Player, or an important teammate you recruit - instead has one cloned and assigned to them at the start of the game as the FightingObject attribute.

This lets me use the FilterByAttribute(GetDirectChildren( stuff to search for Fighters with specific characteristics and make a super-flexible battle system. I can do AoE attacks that affect only enemies, only allies, only enemies that are Mechanical, etc. With the use of cloning a BuffBase object and such, I can even do robust buffs/debuffs with turn duration, or are permanent, last through fights, can be removed, do stuff when they run out etc, and a AbilityBase to make cooldowns and such for various enemy attacks.

I am exceedingly proud of the fight system I cooked up for my indev game.


(filler to get my edited post, updated/posted)


ah cool, a complex/advanced combat system! (if you don't mind making it public, I'd love to study it, lol -- still a noobie coder and game designer, so love seeing code to learn more from it/others, hehe)

there's lots of ways of doing it, I was just referring to the terminology itself, not knowing you already had/were-using your own advanced/complex combat system

(I too am trying to make an rpg, a way too ambitious TES:morrowind/oblivion/skyrim rpg, I'm still stuck and on hiatus with just the character creation system, and specifically a single powerful 'menu/input/attribute-type' game-system displayment, setting/initializing Attributes, and/or handling, sighs)

(my plans for my own combat system will be just as robust as yours, very complex/advanced combat system, choosing single target and/or multiple target, magical/status effects, damage/elemental types, various combat types: attack/defend/special-ability-perk/magic/item/flee/stealth-steal-etc/etc-etc-etc, though whether I'm able to do it... is another matter... lol)

(I've played a lot of rpgs, so I got a big knowledge base of ideas to implement, hehe)

(Grandia 1 for the PS1 has one of the best/coolest and flawless combat systems I've ever seen --- if only didn't have the lag-loading of the PS1/PS1-Emulators, might want to check it out, for ideas)

(7th Saga for the SNES, has a cool little mechanic, making the 'defense' combat choice more tactical/actually-useful, lol: you can do normal attacks every turn like every rpg, or you can choose to 'defend', which until your next turn, reduces physical damage done to you, and should you choose to attack on your next turn, you do extra damage to the enemy, finally making 'defense' a viable combat option, lol)

(if you don't know about this incredible fan-made mod for Civ4, FFH2: Fall From Heaven 2, check it out, it's got some amazing game mechanics, as well as lore/world-building/story too, you can google: ffh2)

(too many rpgs to list... too tired/lazy right now)

here's a link to an old attempt to consolidate various rpg stuff:

http://textadventures.co.uk/forum/design/topic/3876/rpg-elements-game-mechanics-and-game-design

it might be of some use, and/or give you some ideas, possibly


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

Support

Forums