void main() { int nSR = GetLocalInt(OBJECT_SELF, "SWIM_RESULT"); object oPC = GetPCSpeaker(); int nDamage = (GetMaxHitPoints(oPC) / 3); object oWPfail; object oWPsuccess; object oWPnearest; oWPnearest = GetNearestObject(OBJECT_TYPE_WAYPOINT, oPC, 1); if (oWPnearest == GetWaypointByTag("WP_SWIM_A")) { oWPfail = GetWaypointByTag("WP_SWIM_A"); oWPsuccess = GetWaypointByTag("WP_SWIM_B"); } else { oWPfail = GetWaypointByTag("WP_SWIM_B"); oWPsuccess = GetWaypointByTag("WP_SWIM_A"); } AssignCommand(oPC, ActionPlayAnimation( ANIMATION_LOOPING_GET_LOW, 1.0, 3.0)); DelayCommand(2.9, PlaySound("as_na_splash1")); if (nSR == 1) { DelayCommand(3.0, AssignCommand(oPC, ActionJumpToObject(oWPsuccess, FALSE))); DelayCommand(4.0, SendMessageToPC(oPC, "You manage to dive through and find yourself in a dark cavern.")); } else { //ActionDoCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0, 5.0)); DelayCommand(3.0, AssignCommand(oPC, ActionJumpToObject(oWPfail, FALSE))); DelayCommand(3.0, ActionDoCommand(ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oPC, 15.0))); DelayCommand(3.0, ActionDoCommand(ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectAbilityDecrease(ABILITY_CONSTITUTION, 2), oPC, 30.0))); DelayCommand(3.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(nDamage, DAMAGE_TYPE_COLD, DAMAGE_POWER_ENERGY), oPC)); DelayCommand(3.0, AssignCommand(oPC, ActionSpeakString("*gasps for breath*", TALKVOLUME_TALK))); DelayCommand(3.5, SendMessageToPC(oPC, "You almost drown and barely manage to get back to the surface. You feel exhausted and should wait a bit before trying again.")); } }