Proposed Addition
Name: Swimming
Author: ShadeRaven (Bret Davenport)
Funtion: I pseudo-swimming system for NWN. Non-animated (yet) but
essentially works for what it's worth.
Here is an example script of how it is called. In this case, I called it
from a dialogue stream (do you want to swim across this lake? Are you
sure? You'll have to take off your equipment while swimming.) It could
be called from a trigger or other event handler just as easily.
Here's the calling script (action taken):
NWScript: #include "sr_swimming"
void main()
{
object oPC = GetPCSpeaker();
if (SwimCheck(oPC, 10, 1)) {
location lSwimWP = GetLocation( GetObjectByTag( "Landing_WP2"));
AssignCommand(oPC, ActionJumpToLocation( lSwimWP));
}
}
The real code is found here, though. In the sr_swimming script. It could
easily be put in one of the other core includes and used as a call to
one of them.
sr_swimming:
NWScript:
int SwimCheck(object oPC, int iDC, int nChecks, int iCold=FALSE, int iRough=FALSE, int iDuress=FALSE)
{
if (!iDuress) {
AssignCommand(oPC, ActionUnequipItem( GetItemInSlot( INVENTORY_SLOT_CHEST)));
AssignCommand(oPC, ActionUnequipItem( GetItemInSlot( INVENTORY_SLOT_LEFTHAND)));
AssignCommand(oPC, ActionUnequipItem( GetItemInSlot( INVENTORY_SLOT_RIGHTHAND)));
AssignCommand(oPC, ActionUnequipItem( GetItemInSlot( INVENTORY_SLOT_HEAD)));
AssignCommand(oPC, ActionUnequipItem( GetItemInSlot( INVENTORY_SLOT_BOOTS)));
AssignCommand(oPC, ActionUnequipItem( GetItemInSlot( INVENTORY_SLOT_CLOAK)));
} else {
}
int iSkill = GetAbilityModifier( ABILITY_STRENGTH, oPC);
iSkill += GetLevelByClass( CLASS_TYPE_BARBARIAN, oPC);
iSkill += GetLevelByClass( CLASS_TYPE_BARD, oPC)/2;
iSkill += GetLevelByClass( CLASS_TYPE_DRUID, oPC);
iSkill += GetLevelByClass( CLASS_TYPE_FIGHTER, oPC)/2;
iSkill += GetLevelByClass( CLASS_TYPE_MONK, oPC)/2;
iSkill += GetLevelByClass( CLASS_TYPE_RANGER, oPC);
iSkill += GetLevelByClass( CLASS_TYPE_ROGUE, oPC)/2;
if (GetRacialType(oPC) == RACIAL_TYPE_DWARF)
iSkill -= 2;
int nDrowning = 0;
int iDrownDC = 10;
int nTries = 0;
while (nTries < nChecks)
{
int iRDam = d3();
if (iRough==2)
iRDam = d6();
if (iRough>0) {
SendMessageToPC( oPC, "You take rough water damage.");
effect eDamage = EffectDamage( iRDam, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_FIVE);
ApplyEffectToObject( DURATION_TYPE_INSTANT, eDamage, oPC);
}
int iResult = d20() + iSkill - iDC;
if (iResult >= 0) {
nTries++;
SendMessageToPC(oPC, "Successful swim of segment " + IntToString(nTries) + ".");
} else {
if (iResult < -4) {
iDC++;
nDrowning++;
if (iCold) {
effect eDamage = EffectDamage(d6(), DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_FIVE);
ApplyEffectToObject( DURATION_TYPE_INSTANT, eDamage, oPC);
}
if (nDrowning > GetAbilityScore(oPC, ABILITY_CONSTITUTION)*2) {
if ((d20()+GetAbilityModifier( ABILITY_CONSTITUTION, oPC)) < iDrownDC) {
int iHPs = GetCurrentHitPoints(oPC);
effect eDamage = EffectDamage(iHPs+10, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_FIVE);
ApplyEffectToObject( DURATION_TYPE_INSTANT, eDamage, oPC);
return FALSE;
}
iDrownDC++;
}
}
}
}
return TRUE;
}
In testing, it worked quite well with different settings and DCs. I am
going to add in a "menu" for Duress Swimming where a player can choose
what he or she removes and have DC adjusted accordingly. Anything
removed under duress will be destroy, but death by drowning isn't
pleasant either (but for easier campaigns death is better than item
loss).
Any addition, improvements, etc., to this, please feel free to email me
(bretwd@attbi.com) or repost with improvements.
I have other scripts I am thinking of adding, but I thought this one
might be one worth starting with.
_________________
Imitation is the sincerest form of imitation.
For good NWN information, visit
Neverwinter Vault
For my Analyses/Guides visit:
ShadeRaven's NWN Guides
|