Fix request

Hi all.
Can someone create a fix or script for Zen Archery so that affects ranged touch attack as it should in pnp?
Thanks.

P.S. Sorry for my bad English.

the result for TouchAttackRanged() is done in dozens of spellscripts.

the good side is that the function has a parameter for some sort of ‘nBonus’ (which for this would be the difference between a caster’s Dex modifier and Wis modifier, roughly … i guess)

the bad side is that it doesn’t look like it can be done in a single script.

You will have to include the following function in any script that calls a ranged touch attack.
After that, all you have to do is to add Zen right after TouchAttackRanged.
It should become TouchAttackRangedZen(…), the arguments are the same of the standard function.

// The caller will perform a Ranged Touch Attack on oTarget
// * nBonus is an additonal bonus to the attack roll.
// * Returns 0 on a miss, 1 on a hit and 2 on a critical hit
// * UPDATE - Clangeddin - 2018 - Included Zen Archery calculation as per PNP.
// * These return TOUCH_ATTACK_RESULT_MISS, TOUCH_ATTACK_RESULT_HIT, or TOUCH_ATTACK_RESULT_CRITICAL
int TouchAttackRangedZen(object oTarget, int nDisplayFeedback = TRUE, int nBonus = 0)
{
	object oPC = OBJECT_SELF;
	int nADD = nBonus;
	if (GetHasFeat(FEAT_ZEN_ARCHERY, oPC, TRUE) == TRUE)
	{
		int nDIFF = GetAbilityModifier(ABILITY_WISDOM, oPC) - GetAbilityModifier(ABILITY_DEXTERITY, oPC);
		if (nDIFF > 0) nADD = nADD + nDIFF;
	}
	return TouchAttackRanged(oTarget, nDisplayFeedback, nADD);
}
2 Likes