Friday, April 30, 2010

Why units refuse to lose their abilities

So, if when {CLEAR_VARIABLE unit.abilities}-ed a unit, it didn't always drop their ability. This was very troubling. I had Dwarvish Guardsmen with bucklers that refused to give up steadfast along with Fencers wearing armor who could still skirmish. This totally wasn't the case ever for player characters. This code, inserted into the start event of the tutorial, confirmed it.

Hypothesis #1: It has to do with the fact these NPCs are canrecruit=no.

Nope. Tested it in the Tutorial. It did the same for Konrad (if I made him a Dwarvish Guardsman).

Hypothesis #2: There's a [modification] that needs to be removed.

Nope. Not in the save file.

Hypothesis #3: Abilities of regular-ish units need to be removed via [object]/[effect].

Damn, this one worked, but there's no way to just clear them all like that.

Then I talked to zookeeper who, as always, had brilliant insight. In IRC:

zookeeper: could it be that removal works on abilities which are no inherent to the unit type?
zookeeper: that'd be my first guess; that the game would see something missing and would recalculate it...like if you removed unit.hitpoints then the game would recalculate it (probably means fill them up to max)

Oh, so I just put a dummy [abilities] container in after clearing it and it worked fine. It turns out that PCs never had an inherent ability, so it was never an issue.

I was really scared this would be a roadblock, but it turned out not to be, thanks to good ol' zoo.

Thursday, April 29, 2010

Abilities mostly done, valuation mostly done, now for items gain

I've come to a resting point for valuation. Some abilities, specials, and traits are all that is left, and I would mostly just be throwing random values at the algorithm for each one.

Instead, I'm focusing on how to make the item move to and from the players and the environment. I'll have to scrap a lot of the old way of doing things, but I can replace most of that with the NPC valuation now.

I got PCs giving shields to NPCs working. It was great to simply create a second copy of a unit, give it the new shield and see if the valuation algorithm thinks it is overall better or worse than the original. And, it's working good. A Thief is worse off with a shield while a Thug is better off, so the thief refused.

The difficult part is going to come when I try to give a unit a weapon when it already has 3 equipped.

I've also given most weapons negative evade adjustments, and most armors' negative evade adjustments have been lessened. A weapon, simply depending on its type, will have either 0, -1, -2, or -3 evade adjust. I'm a little unsure about this, mainly because you would expect a heavy club to have more of a penalty than a light one, but it's not like strength has ever found itself into the evade equation from the start.

Thursday, April 8, 2010

Not So Bad

Fortunately, the new release of Dwarf Fortress is more buggy and the docs on how to play are less complete than I had anticipated. This means less time it will be sucking away at my soul and more time on Wesnoth.

I think I have the multiple-attacks-of-a-range system down well enough now.

I need to get abilities now, but Trolls and Fungoids (consider them underground Woses) have natural armor, which means they won't be nearly as weak as the units wearing tattered versions of whatever they wear. This means it's going to be difficult to give a value to regen.

I need to get back into the project because I'm daydreaming of making action games again. I've got a unique setting nearly fleshed out any everything.