Creating a function to modify "opposite" stats based on a simple line in script.
Ip Man
10 May 2023, 04:34I have created a system of Stats which are used to dramatically alter my game when incorporated with flags, descriptions, and scripts based on growing and changing player perspective. Using Pixie's CombatLib, I've modified some of the library to help keep the process simpler. If x flag and object has xdesc for printing descriptions, and the flags can be set or unset depending upon levels of stats and/or choices made in the game.
The stats are set up as "opposites", so they don't have negatives, but when one reaches zero, the next step down is actually an increase in the opposite stat:
Opposite stats:
agility ~ clumsiness
bravery ~ anxiety
charisma ~ antipathy
curiosity ~ disregard
intelligence ~ stupidity
selfawareness ~ selfdelusion
stamina ~ unhealth
stealth ~ overtness
strength ~ weakness
trust ~ cynicism
selflessness ~ greed
purity ~ perversion
Perspective flags are set based on choices in Character Generation and also final selection of one out of many "key" objects that allow access to the realms in the game.
Perspective flags:
Mage
Warrior
Diplomat
Collector
Ninja
Rich
Biblesight
Explorer
Traveler
Goth
Catlover
Gender
Bornagain
Pervert
Night
selfaware
alive
dead
possibly "Necromancer?"
Anyway, I made a function script that doesn't error, but I also haven't gotten it to do what I want when running script on a taken object.
Function:
A sample object I made to test the script is:
<object name="stattester">
<inherit name="editor_object" />
<take />
<ontake type="script">
statchg (player.charisma, 2, player.antipathy)
statchg (player.curiosity, 2, player.disregard)
statchg (player.stealth, 2, player.overtness)
statchg (player.agility, 2, player.clumsiness)
statchg (player.trust, 2, player.cynicism)
</ontake>
</object>
I'm not sure what's missing from the code(s) for this to work. The list of stats includes all of these already have integers of different values to test their changes ("opposites" also have values)
Yet when I take the object, the player stats don't change at all.
Please and thanks for any info/ideas!
Ip Man
10 May 2023, 04:38Sorry, don't know why the function didn't paste over:
function name="statchg" parameters="attribute, int, opattribute"><
DarkLizerd
13 May 2023, 02:05Kinda late here, and didn't read most of the comments... but
Why have 2 attributes: agility ~ clumsiness
when you can just use agility...
but adjust the values from positive to negative...
IE: if agility is +5, then you are agile, but...
if agility is -5, then you are clumsy...
This sounds much more simple to me...
(I'm checking back through the comments now...)
mrangel
13 May 2023, 14:06Here's an alternate version; without the function.
You could give the player a script attribute named changedstrength
with code like:
if (not this.strength = 0) {
value = this.strength
if (not this.weakness = 0) {
value = value - this.weakness
}
if (value > 0) {
this.weakness = 0
this strength = value
}
else {
this.strength = 0
this.weakness = -value
}
}
(off the top of my head… I might have made some careless error there)
If you do this for all the attributes (including the negative ones) then you can just change values with something like:
player.strength = player.strength - 3
and it will automatically redirect the points into weakness if necessary.
@DarkLizerd
when you can just use agility...
but adjust the values from positive to negative...
I assume it's a look-and-feel thing. Mathematically it's equivalent; but it can give different player experience. Like how a stat from 1-100 feels different from a stat that goes 0-10 with one decimal place, even though they're the same numbers behind the scenes.
Ip Man
13 May 2023, 20:09Yes @Darklizerd! That's the idea. I want the "Ninja," the "Rich," and maybe the Necromancer characters to have "Greed" and "Cynicism" rather than "negative Selflessness" and "negative trust" stats. And the "Born again" to be dealing with "Selflessness" and "Purity" rather than "negative Greed" and "negative" perversion, etc. This game is going to have a myriad of perspectives and biases affecting not only descriptions, but which objects in the game are accessible, etc.
The stats are one of the ways to track and change these mid-game. Also going to use flag system. I already have a "perspectives" function to work with descriptions, and am thinking about a "change alias" function.
There will also be objects/exits, etc hidden and/or inaccessible depending upon stats and flags.
So depending upon one's perspective they might see the "Bible" as "The Holy Bible" or "a book of hate speech" or "Abraham Lincoln's Bible" or "an old Bible." It might be the one artifact out of the group which makes extra special things happen for them, or maybe they can't see and interact with it at all, etc.
Each character "type" will have it's own artifact which is powerful for everyone who can get it, but more powerful for them.
There are also doors in the world which lead to dramatically different worlds/realms. Each accessible after getting these key artifacts which are more suited to one "type" of character over all the others. So each type has their own "world" which is going to be more at home for them, and other worlds they might be able to discover how to enter, but which are more or less suited to them in different ways.
I'm having a lot of fun with the concept development, and also fun with discovering how to work the code. Super indebted to Pixie and Mrangel for their contributions in forum and via tutorials and libraries.
Ip Man
13 May 2023, 20:22Thanks for the additional ideas Mrangel!
If I don't use it for this precisely, it certainly may come in useful elsewhere.