kevL / TccScripts

4 stars 0 forks source link

Lucky is not working? #5

Closed vandervecken closed 5 years ago

vandervecken commented 5 years ago

Aqvilinus says: Lucky: Adds +1 to all saves Requires: Caster Level 5, Craft Magic Arms and Armor feat Ingredients: Faint Power Essence + Faint Earth Essence + Obsidian Spell: Resistance

encoded incorrectly as “40,1,3,0,0” (bonus +3 to Fortitude saves). Should be “40,0,1,0,0”.

Aqvilinus commented 5 years ago

IP #40 is ITEM_PROPERTY_SAVING_THROW_BONUS.

int IP_CONST_SAVEBASETYPE_ALL                   = 0; // AFW-OEI 05/02/2007
int IP_CONST_SAVEBASETYPE_FORTITUDE             = 1;
int IP_CONST_SAVEBASETYPE_WILL                  = 2;
int IP_CONST_SAVEBASETYPE_REFLEX                = 3;
/**
* Returns Item property saving throw bonus to the base type (ie. will, reflex,
* fortitude). You must specify the base type constant(IP_CONST_SAVEBASETYPE_*)
* to which the user gets the bonus and the bonus that he/she will get. The
* bonus must be an integer between 1 and 20.
* @bug Need to verify: Does not work with IP_CONST_SAVEBASETYPE_ALL Workaround: Do each saving throw as a separate effect.
* @param nBaseSaveType
* @param nBonus
* @return  an item property
*/
itemproperty ItemPropertyBonusSavingThrow(int nBaseSaveType, int nBonus);

Note there's a mention in the description above about a bug with IP_CONST_SAVEBASETYPE_ALL. So what I suggested might not work at all...

kevL commented 5 years ago

pretty sure ALL works, needs test -- i might be thinking effect SaveAll works ...

vandervecken commented 5 years ago

Pushed this change for testing: https://github.com/kevL/TccScripts/tree/test_lucky

kevL commented 5 years ago

dang, doesn't work - sry bout that.

will make more comments about it on the commit page

vandervecken commented 5 years ago

After doing some testing we decided to delete this recipe, which will be a heavy diff since it involves renumbering crafting.2da.

kevL commented 5 years ago

odd ...

ItemPropDef.2da #40 ITEM_PROPERTY_SAVING_THROW_BONUS

says use Iprp_SaveElement.2da for subtypes

but that 2da doesn't mention fort/will/refl. Instead it has a bunch of elements, plus stuff like Backstab and Mind-affecting.

So it looks like ItemPropertyBonusSavingThrow() is overruling its 2da-subtype behind the scenes, using the IP_CONSTSAVEBASETYPE* values directly for fort/will/refl, but it was never fully implemented and debugged.

Note also that the next ip in ItemPropDef.2da #41 ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC

says use Iprp_SavingThrow.2da for subtypes

and that 2da has fort/will/refl ... but ItemPropertyBonusSavingThrowVsX() again looks like it bypasses its 2da-subtype and uses the IP_CONSTSAVEVS* values directly.

https://www.youtube.com/watch?v=z02J_kPincA

vandervecken commented 5 years ago

I'm well aware that there are two different IPRP tables for saves. It's quite possible that we may be able to get Lucky to work by using the "Universal" in SaveElement instead of the All in SavingThrow.

kevL commented 5 years ago
int IP_CONST_SAVEVS_UNIVERSAL = 0;
int IP_CONST_SAVEBASETYPE_ALL = 0;

they're both (int)0 ... both as constants and in the 2das -- changing them won't make any difference to the function

Aqvilinus commented 5 years ago

@vandervecken probably means using #41 ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC with IP_CONST_SAVEVS_UNIVERSAL for Lucky. I'm not sure whether it would be equivalent to #40 ITEM_PROPERTY_SAVING_THROW_BONUS with IP_CONST_SAVEBASETYPE_ALL. Anyway, it doesn't make sense since there's already this kind of enhancements (#41) among universal recipes (X1004):

Resistance +1 Requires: Caster Level 3, appropriate Craft feat Ingredients: Faint Earth Essence + Obsidian Spell: Protection from Energy

Resistance +2 Requires: Caster Level 6, appropriate Craft feat Ingredients: Faint Earth Essence + Diamond Spell: Protection from Energy

Resistance +3 Requires: Caster Level 9, appropriate Craft feat Ingredients: Weak Earth Essence + Canary Diamond Spell: Protection from Energy

Resistance +4 Requires: Caster Level 12, appropriate Craft feat Ingredients: Glowing Earth Essence + Jacinth Spell: Protection from Energy

Resistance +5 Requires: Caster Level 15, appropriate Craft feat Ingredients: Radiant Earth Essence + Blue Diamond Spell: Protection from Energy

saves

They are listed under "Feats" category in the readme file, but they have nothing to do with feats (the same applies to the regeneration enhancements there).

vandervecken commented 5 years ago

FYI they're actually under Misc, not Feats. https://github.com/kevL/TccScripts/blob/master/Rebalanced%20Crafting%20Recipes.txt#L2207

vandervecken commented 5 years ago

That said, Lucky isn't ever going to work properly, for two reasons: 1) The way Lucky is implemented in defined items like the Luckstone is with over a dozen individual +1 properties 2) The whole point of Luck bonuses has always been that they are supposed to stack with non-luck bonuses. However I don;t think NWN2 has a concept of bonus types here. "luck bonus vs morale bonus vs enhancement bonus" which means Luck bonus to saves is the same as Resistance bonus to saves.

vandervecken commented 5 years ago

@kevL for your most recent comment here - could you clarify where in the code you're looking at? It's not in the mod - somewhere in the base game?

Aqvilinus commented 5 years ago

They are under Feats in the readme file from neverwintervault.org.

He is looking at constants and prototypes of built-in functions in nwscript.nss (\<game root folder>\Data\Scripts_X2.zip).

kevL commented 5 years ago

yep the stuff i mentioned is in nwscript.nss -- the core interface with the engine for all scripting.

if you want to keep a copy of nwscript.nss loose on your hardrive for reference, find the most recent in

C:\Neverwinter Nights 2\Data\scripts_X2.zip\Scripts_X2\nwscript.nss

(or thereabouts)

vandervecken commented 5 years ago

I just looked up the Rebalanced Crafting Recipes.txt in the NWN Vault, and on line 2207 there's " Misc "

Anyway, I reckon for the reasons I listed above that this will likely never work the way it's intended.

kevL commented 5 years ago

since there already are universal saving throw bonus recipes ... I vote to remove "Lucky" else do the +3 Fortitude recipe -- but it seems like you guys know much more than me about what recipes are already in place, what overlaps in usefulness, what's redundant, and whether it should/could be extended to +3 Will, +3 Reflex also (etc etc )

whatever you decide, V.