Default Attributes On Character Sheet (What To Show?)

Good Points!

Epic feats … I don’t know. However, when I ran the code using my players PCs (who have had attribute upgrades as it were) they did not count toward the default total … so that’s good in that the difference would only be showing buffs and penalties due to spells and items.

I think showing just the bonus/penalty is a good idea. I guess that would have to reflect the overall difference only. i.e. A +3 to int (due to item) with a -2 to int (due to curse) would reflect an overall + 1 bonus.

However, I would have the difference show PRIOR to the current ability score, as that is easier to implement. e.g.

STR +1 14 +2

Where the current attribute is 14 with a current overall benefit of +1 included. Again, it would be easy enough to highlight the plus or minus, green or red. I’ll make the changes later to reflect this idea. Thanks! :slight_smile:

Thoughts?
Cheers, Lance.

i like it

Thanks!

I also decided to add a red ( C ) to mark against Compromised or Cursed characters whose attributes return a difference of zero.

The reasoning was to highlight any potential overall differences to attribute scores that now stood at zero after taking into account all bonuses and penalties. i.e. Previously, if any attribute came back zero, then it would not highlight at all. So a +2 to int bonus with a -2 to int penatly (due to a curse) would show nothing. Now, if a PC has any kind of ability decrease effect, it will return all zero differences as a red “C” in the parenthesis ( C ), as a reminder that attributes have been compromised in some way.

Admittedly, this has the downside of highlighting attributes that have not been affected in any way while under the effect of attribute loss, but I erred on the side of caution, I believe.

If there was a better way to determine an actual attribute loss as opposed to a generic attribute loss, then I could be more specific. ie GetHasEffect(EFFECT_TYPE_ABILITY_DECREASE, oPC) does not return with the specific attribute that has been decreased … unless you know a way of getting the more specific info?

Thanks, Lance.

1 Like

Here is how you can determine this:

int GetAbilityDecreaseAmount(int nAbility, object oTarget = OBJECT_SELF)
{
	int nAmount = 0;
	int nCheck;
	effect eCheck = GetFirstEffect(oTarget);
	while (GetIsEffectValid(eCheck))
	{
		if (GetEffectType(eCheck) == EFFECT_TYPE_ABILITY_DECREASE)
		{
			if (GetEffectInteger(eCheck, 0) == nAbility)
			{
				nCheck = GetEffectInteger(eCheck, 1);
				if (nCheck > 0) nAmount += nCheck;
			}
		}
		eCheck = GetNextEffect(oTarget);
	}
	return (nAmount);
}

nAbility is a ABILITY_* constant (https://nwnlexicon.com/index.php?title=Ability).

Ha!

Well done! In fact, now you mention it, I do recall having a conversation with KevL many moons ago with respect to GetEffectInteger.

After a search in my own code for the function you use, I find some in my own test scripts, which means I must have used it elsewhere before.Needless to say, thanks for reminding me and bringing the info back for me to use.

Cheers, Lance.

EDIT: Can I assume that using the same index values I can check the INCREASE by replacing the ability effect checked?

///////////////////////////////////////////////////////////////////////////////
// GET A SPECIFIC ABILITY VALUE nAbility is a ABILITY_* constant
// PASS EITHER: EFFECT_TYPE_ABILITY_DECREASE OR EFFECT_TYPE_ABILITY_INCREASE
///////////////////////////////////////////////////////////////////////////////
int GetAbilityAlteredAmount(int iEFFECTTYPE, int nAbility, object oTarget = OBJECT_SELF);
int GetAbilityAlteredAmount(int iEFFECTTYPE, int nAbility, object oTarget = OBJECT_SELF)
{
	int nAmount = 0;
	int nCheck;
	effect eCheck = GetFirstEffect(oTarget);
	while (GetIsEffectValid(eCheck))
	{
		if (GetEffectType(eCheck) == iEFFECTTYPE)
		{
			if (GetEffectInteger(eCheck, 0) == nAbility)
			{
				nCheck = GetEffectInteger(eCheck, 1);
				if (nCheck > 0) nAmount += nCheck;
			}
		}
		eCheck = GetNextEffect(oTarget);
	}
	
	return (nAmount);
}

Yep, I’ve even checked this. Be aware that technically “decrease” from effects can exceed the full ability score, though the score can never go below zero.

Good point … I actually experienced this when adopting an idea with my Life Essence system that allowed attribute alterations - I realised the dangers of not setting a limit then.

Thankfully, I only need to check the figure here, rather than alter it. :slight_smile:

OK,

Here is the new look with a PC wearing a ring boosting intelligence. (NB: This PC already had exceptionally high default int due to previous adventures in the PnP campaign going back over 20 years. i.e. It was already 22!)

Cheers, Lance

2 Likes

that’s very cool <g>

Thanks,

Actually, I think I may have hit a snag with …

int iDIFF = GetAbilityAlteredAmount(EFFECT_TYPE_ABILITY_DECREASE, 3, oPC);

(See function usage above)

It returns a zero and not -3 as expected. i.e. It appears to take into account the +3 of the ring, which means I may not be able to distinguish the specific negative effect in play.

Or, have I not used nCheck = GetEffectInteger(eCheck, 1); correctly?

Cheers, Lance.

EDIT: Although, it may be because I was using EffectCurse, which affects attributes, but NOT via the EFFECT_ABILITY_TYPE_DECREASE constant by the looks of it. (CONFIRMED: Attributes penalised by a curse do not count towards the DECREASE constant.) :frowning:

Do you happen to have the equivalent function that checks for specific attribute target curses? i.e. Something that would return 2 if I checked for CheckCursedAttribute(STRENGTH) kind of thing when cursed strength is -2.

the position to look at with GetEffectInteger() changes depending on what the effect-type is …

it’s a (fairly) long road to cover all or (at least) required types …

Hi KevL,

That is what I feared … I think that I will revert to my original idea and use a ( C ) for any attributes that may be affected due to some other effect if they are on the PC and the attribute currently calculates to zero.

Unless, of course, you have any scripts/functions that cover attributes with those effects like curse … Are there any others? I am not aware of any others at this stage.

EDIT: At the moment, the ( C ) is only added with positive check on DECREASED stats and CURSE … and the diff is zero.

Thanks, Lance.

Yep, the attribute losses from the curse effect are treated separately, just checked. But still they can be easily extracted:

void main()
{
	int nStrMod, nDexMod, nConMod, nIntMod, nWisMod, nChaMod;
	effect eCurse = EffectCurse(nStrMod, nDexMod, nConMod, nIntMod, nWisMod, nChaMod);

//	nStrMod is GetEffectInteger(eCurse, 0);
//	nDexMod is GetEffectInteger(eCurse, 1);
//	nConMod is GetEffectInteger(eCurse, 2);
//	nIntMod is GetEffectInteger(eCurse, 3);
//	nWisMod is GetEffectInteger(eCurse, 4);
//	nChaMod is GetEffectInteger(eCurse, 5);
}

P.S. sorry replied to @kevL_s mistakenly.

Ah ok !

I will make a quick function and test the results … back when done. (Although monitoring posts.)

Cheers, Lance.

definitely pursue it i say, I really really really like what you got going in the Attributes section,

between Aqvi & i we’ll write the darn functs. hehe

2 Likes

Well I can confirm this works fine:- :slight_smile:
Thanks - I do appreciate the help and encouragement.

Are you aware of any other effects that differ in the way they affect attributes? (Apart from what we have discovered with ABILITY DECREASE AND EFFECT CURSE? )

///////////////////////////////////////////////////////////////////////////////
// GET A SPECIFIC ABILITY VALUE nAbility is a ABILITY_* constant
// FOR EFFECT_TYPE_CURSE
///////////////////////////////////////////////////////////////////////////////
int GetAbilityCursedAmount(int nAbility, object oTarget = OBJECT_SELF);
int GetAbilityCursedAmount(int nAbility, object oTarget = OBJECT_SELF)
{
	int nAmount = 0;
	int nCheck;
	effect eCurse = GetFirstEffect(oTarget);
	
	while (GetIsEffectValid(eCurse))
	{
		if (GetEffectType(eCurse) == EFFECT_TYPE_CURSE)
		{
			nCheck = GetEffectInteger(eCurse, nAbility);
			if (nCheck > 0) nAmount += nCheck;
		}
		
		eCurse = GetNextEffect(oTarget);
	}
	
	return (nAmount);
}
2 Likes

EffectPoison(), maybe?

If it does, is it simply applying a ABILITY_DECREASE rather than its own attribute constant version? If you manage to check before I get finished updating the curse bit, do let me know.

EDIT: As poison has its own 2da, I just wondered if it simply applied the basic ABILITY_DECREASE from there.

Cheers, Lance.

Ok, I’ll check it now. Also EffectDisease()

1 Like

OK, Thanks!
Lance.

LATEST … showing the ( C ) where Karasten is affected by a curse that drags his int -3. When his ring adds + 3, there is zero difference, so it is now marked by a C for compromised. (Curse was - 5, -4, -3, -3, -2, -1)