having a player attribute get +10 and not only increase attribute by 1 and how to have it as a % value #1508
Replies: 4 comments
-
Hello, it looks like some of that code got parsed as HTML on GitHub, and we can't see all of it. To post code so that it stays intact, we can nest it between three backticks
We definitely have a few RPG folks around here. So, I'm sure you'll end up with some good feedback. (I can help a little, but my brain goes fuzzy when random chances and things are involved, hehehe.) |
Beta Was this translation helpful? Give feedback.
-
It looks like you have it working well already, but, if you'd just like to see a different approach (that isn't necessarily better)... You have: IncreaseHealth (30)
for (loopy, 1, 10, 1) {
IncreaseObjectCounter (player, "Endurance")
if (GetInt(player, "Endurance") > 100) {
player.Endurance = 100
}
} That could be: IncreaseHealth (30)
player.Endurance = player.Endurance + 10
if (player.Endurance > 100) {
player.Endurance = 100
} ...but if you ever change the game's POV to different objects, and you want this to effect the current "player" object, it's best to use
So, that code should probably actually be: IncreaseHealth (30)
game.pov.Endurance = game.pov.Endurance + 10
if (game.pov.Endurance > 100) {
game.pov.Endurance = 100
} ...and be sure the To avoid having to do that, we could add a line or two: IncreaseHealth (30)
if (not HasAttribute (game.pov, "Endurance")) {
game.pov.Endurance = 0
}
game.pov.Endurance = game.pov.Endurance + 10
if (game.pov.Endurance > 100) {
game.pov.Endurance = 100
} |
Beta Was this translation helpful? Give feedback.
-
I think i understand better and the problem has been:
and looking higher in the code i found this entry which was not existing when i had only defined status attribute.
Am i correct to understand that status attribute are $string by default and can not be declared as int, directly in the status attribute settings tab of player and have to be done in the attribute settings below the status attribute? |
Beta Was this translation helpful? Give feedback.
-
Now i know: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a player and he has an attribute "Endurance".
When he does something i want to increase or decrease his endurance.
First i do not know how to display it as a % like his health.
and i can only increase or decrease by +/- 1 using script in the verb section.
But i want it to increase by 10 pts or 10%
after spending my whole sunday trying to figure it out i came with a solution but i think there is a easier way to do it.
But it felt like i solved a rpg puzzle as being a script writer so i had good time.
Here is my code (windows Quest 5.9.0) and if there is a easier way...well thank you.
Beta Was this translation helpful? Give feedback.
All reactions