forums | blogs | polls | tutorials | downloads | rules | help

Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in remember_me_form_alter() (line 78 of /var/www/siegetheday.org/sites/all/modules/contrib/remember_me/remember_me.module).

A derp moment with progressive items.

So, funny story….

I wanted to create progressive items with values that progressed differently depending on the user’s skill levels. For example, a suit of armor that would gain value quickly as you gained melee levels, more slowly if you gained ranged levels, and very slowly if you gained casting levels.

So I plugged this mishmash in to the “value =” field of the item:

[[ (#melee * 6.375) + ((#ranged - #melee > 0) ? (#ranged - #melee) * 4.7 : 0) + ((#nature_magic_level - #ranged - #melee > 0) ? ((#nature_magic_level - #ranged - #melee) * 1.54) * (1.5 + (#nature_magic_level*.01)) : 0) + ((#combat_magic_level - #nature_magic_level - #ranged - #melee > 0) ? ((#combat_magic_level - #nature_magic_level - #ranged - #melee) * 1.54) * (1.5 + (#combat_magic_level*.01)) : 0) ]];

I tested and tweaked it over a span of hours to make sure it was relatively balanced at least within the level range of the DS1 SP campaign. No sooner did I sit back in my chair and breath a sigh of satisfaction than I realized:

I could have just based the value on Strength. The three ability scores are ALREADY weighted to skill levels. But hey, now I have a super-complicated way of doing it! Laughing out loud

Derp-de-derp-derp.

Great job on making the simple complex-- think you got the award this week, but maybe I will make a new weapon and get the title back!!

Elf

Nice job.
What is the variable for strength? When I use...

#strength

..it does not work.

It's just #str

What, mathematically, does "(A) ? (B) : 0" do, and where can it be looked up?

It’s a compressed “if…then…else.” Everything before the question mark is your “IF,” and everything after the colon is your “ELSE.” For instance:

((#ranged - #melee > 0) ? (#ranged - #melee) * 4.7 : 0)

Means:
(IF you have ranged levels in excess of melee levels)
(THEN you get 4.7 points of value for each of those levels)
(ELSE you get zero.)

I’m not sure where I came across this format. I’m certainly not code-savvy enough to have known it myself. I probably learned it while puzzling out some retail skrit, or a mod by someone who really knows how to code. (Most likely Xaa or Witness, whose works I mined shamelessly.)

The ? : are what languages call conditional operators.

Aye, ternary operators. In nearly all languages. It's nested, so it's evaluating if the conditions before the ? are true to decide what to do.

RSimpkinuk57 wrote:

What, mathematically, does "(A) ? (B) : 0" do, and where can it be looked up?

If (A) is true, (B). Else 0. It doesn't need to check if things are false (no need if we are checking for true). However, we can also check for false rather than true. We just use the not operator (!) before the condition. It's what we use to write a short form of if/else when we don't need multiple if statements.

Example of checking for something false:

(!condtion) ? "B" : "A";

If the condition is false, it will give us "B", otherwise it will give us "A." It's a waste of computing to check twice when one will do.

Dulac wrote:
However, we can also check for false rather than true. We just use the not operator (!) before the condition.

I thought ¬ was the not operator. In the days of pen and paper.

So did you learn the ternary operators by example, or is there a quick reference somewhere?

That symbol doesn't exist in ASCII, only in EBCDIC. Real languages use NOT so you can actually read what the author meant.

The practise of reducing the number of characters in the code, and replacing words with symbols, came about because early computing on UNIX systems involved using very slow teletype terminals, and anything that reduced the data traffic was precious. ALGOL used begin; and end; as block delimiters but C was a "better" language because it replaced them with { and }.

A brief analysis of Strength scores for Level-60 characters has convinced me I didn’t waste my time after all. A straight linear "value" progression based on Strength does’t make an item that is balanced for all the skill classes.

For instance, a value of (#str * 7.5) for body armor is fine for a Level-60 pure-melee character, yielding a defense rating about equivalent to the available DS1/LoA armor. But if a ranger/caster picks up that armor, given their measley Strength scores at Level 60, the armor would be hopelessly weak compared to their available LoA armor. So some kind of complicated scheme of testing the character and assigning custom values is still necessary.

BTW, My overall purpose here was an update of the “signature gear” for specific-character heroes, as found in mods like the Arwen and Ninja mods. You don’t want this gear to ever become “obsolete” and get discarded. On the other hand, you don’t want it to be hyper-powered, as is the case if you balance the gear for melee but the character opts to become a nature mage instead.

https://en.wikipedia.org/wiki/List_of_logic_symbols

You can find the explanation of each character there. Most of those have been replaced for ascii equivalents: ↔ was replaced with <-> and → with ->. Just depends on the language you use.

https://en.wikipedia.org/wiki/%3F:

RSimpkinuk57 wrote:

Dulac wrote:However, we can also check for false rather than true. We just use the not operator (!) before the condition.

I thought ¬ was the not operator. In the days of pen and paper.

So did you learn the ternary operators by example, or is there a quick reference somewhere?

DND and other games must have borrowed the negation symbol from propositional logic. I learned them from other languages. I probably first learned it in C 23 years ago! I quit programming at some point(I didn't think I was good) and focused on graphics during my DS modding days. Now I've been programming in several languages for web development. Luckily programming languages have a lot of things in common, so we can explain stuff in skrit without formal documentation. I wish we had better documentation on skrit though.

ghastley wrote:

That symbol doesn't exist in ASCII, only in EBCDIC. Real languages use NOT so you can actually read what the author meant.


Most languages use ! and ASCII. I'm not sure why you feel they're not real. This would mean C and C++ are not real languages and python is a real language, which most would disagree with. Many claim the opposite and take issue with interpreted languages over compiled languages rather than use of symbols from ASCII. I consider them all real languages and rather not spell out not. I even use ! over not in python.

Edit: Sam already posted a link on ternary operators. I just remembered that python has good documentation if you are interested in toying around with programming concepts.

https://docs.python.org/3/

If you don't want to install python and use it the terminal, you can use https://repl.it/ to try it out. It also supports C# and Microsoft has good documentation on it, but I think you would have an easier time with python.

Alternatively, there is javaScript that also has good documentation:
https://developer.mozilla.org/en-US/docs/Web/JavaScript

Klandank wrote:

A brief analysis of Strength scores for Level-60 characters has convinced me I didn’t waste my time after all. A straight linear "value" progression based on Strength does’t make an item that is balanced for all the skill classes.

For instance, a value of (#str * 7.5) for body armor is fine for a Level-60 pure-melee character, yielding a defense rating about equivalent to the available DS1/LoA armor. But if a ranger/caster picks up that armor, given their measley Strength scores at Level 60, the armor would be hopelessly weak compared to their available LoA armor. So some kind of complicated scheme of testing the character and assigning custom values is still necessary.

BTW, My overall purpose here was an update of the “signature gear” for specific-character heroes, as found in mods like the Arwen and Ninja mods. You don’t want this gear to ever become “obsolete” and get discarded. On the other hand, you don’t want it to be hyper-powered, as is the case if you balance the gear for melee but the character opts to become a nature mage instead.

I'm curious about your testing to tweak it. Looks very fine tuned Smile

Dulac wrote:

I'm curious about your testing to tweak it. Looks very fine tuned Smile

Sadly, it is very crudely tuned!

DS1-LoA gear doesn’t progress in a linear way across the levels. I doubt it even progresses in a nice clean curve. So these linear values are at best just “good enough” up through L60 or so, meaning generally a little bit better than retail gear, sometimes a lot better, rarely a few points lower.

Regarding testing, I ran this gear (items for each slot) through the Ehb campaign on a few characters, and sometimes gave it to some MP characters of various levels to see how it stacked up to the stuff at the vendor’s.

Hi. Some time ago when I was making the raw item tables for the wiki I outputted graphs of req and armor rating... I was sort of vaguely wondering if it was possible to make a best-fit function. But I do not think you can.

One thing is that the lower half of the armor list has a more linear look while the upper half gets exponential. Also I don't think you can do exponential operations— really non-integer exponents, most likely— in the gas files. Skrit can, but not gas. Like you could multiply something by itself one time (squared) or two times (cubed) but not 1.71 times. Lastly the graph has a "sawtooth" look when you line all the armors up by their defense rating. The sawtooths are the specimens that have very high or very low requirements for their ratings, so that the best you could do is make an average progression.

These phenomena were especially pronounced with the mage armors introduced in LoA.

Tristan,

I take it your main graph is for the armors with _f_ in their template names, and the two lower ones for those with _m_ (on the left) and _r_ respectively.

I think of them as "common" (good protection at low cost for those with strength to wear it, i.e. fighters), "lightweight" (more expensive but easier to wear, so aimed at rangers) and "luxury" (costs a fortune but needs so little strength that even mages can wear it - and should, because robes give so little defense by comparison, for even more money, as to be a total rip-off).

Did you include not just the basic grades but the superior versions too (for those, such as Thin Chain, whose pcontent is allowed)?

I've not examined the LoA additions in detail, but my general impression, for those armors requiring strength, is that the developers followed commercial rather than game-world or game-balancing logic by putting them above the existing curve. The ones requiring dexterity are a complete new range, of course.

Well the top graph is literally every body armor piece, including some robes, I think, that has either a strength requirement or no requirement at all. I guess the template names could have been a sorting method but I didn't use them, I only used the req. The armors are lined up along the x-axis by their defense rating, from 1 (Tatters) at left to 659 (Battle Plate) at the right.

This was all done in excel, if you want a look at my data I put it here.

The "luxury" armors are what give the sawtooth appearance on the graph that I was describing earlier. For example the rightmost little tooth on the strength-armor chart is Thin Plate, a bejeweled _m_ type armor that only a couple things in Elite can drop. So at this point along the x-axis, at 341 defense, its measly requirement of 20 str makes a gap down from its neighbors on the axis, Battle Plate (334, req 44) and Crystal Plate (347 req 45), which are wayyyyy more common.

Then on the int armor graph, LoA fibrous stuff are lined up amid the original Robes, which have much higher requirements for the defense you get and make big upward gaps in the int requirement line. I think I know what the developers were thinking. The Robes are balanced to have much stronger magic mods.

It would be hard to make a best-fit function that captures these things. Though on second thought, you could have multiple functions, for common, lightweight, or luxury, etc.