Amon_PRC8/_module/nss/swimcheck.nss

32 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2025-04-03 19:00:46 -04:00
void main()
{
// ______________________________________________________________
// Do a swimming check.
// Note the 3.0 Players handbook P. 74 indicates a -1 penalty for every 5 pounds carried.
// That seems a bit harsh in this environment. Especially since I'm having to fake the
// swim skill anyway.
// Also note that the PHB indicates that the default ability is STR, but it seemed
// appropriate to also include Dex and Con (endurance) since NWN doesn't provide the
// swim skill at this point.
// ______________________________________________________________
object oPC = GetEnteringObject();
if(GetIsPC(oPC))
{
int iDIFFICULTY = 18;
int iSwimCheck = GetAbilityModifier(ABILITY_DEXTERITY, oPC) +
GetAbilityModifier(ABILITY_STRENGTH, oPC) +
GetAbilityModifier(ABILITY_CONSTITUTION, oPC) -
(GetWeight(oPC) / 250) + // -1 for each 25 lbs carried
d20();
if(iSwimCheck < iDIFFICULTY)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oPC, 1.0f);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDamage(d6()), oPC);
SendMessageToPC(oPC, "You are choking on the water!");
}
}
}