// Custom script for the OnUsed event of a placable // Simulates climbing a rope up 20 feet #include "prc_misc_const" void main() { object oPC = GetLastUsedBy(); int nClimbSkill = GetSkillRank(SKILL_CLIMB, oPC); int nClimbDC = 5; location locDestination1 = GetLocation(GetWaypointByTag("WP_LATRENE_EXIT")); location locDestination2 = GetLocation(GetWaypointByTag("WP_LATRENE3")); // Roll a d20 for the Climb check int nRoll = d20(); // Add the Climb skill rank to the roll nRoll += nClimbSkill; // Check if the roll meets or exceeds the DC if (nRoll >= nClimbDC) { // Successful climb, move the player to the destination AssignCommand(oPC, ClearAllActions()); AssignCommand(oPC, ActionJumpToLocation(locDestination1)); } else { // Failed climb, apply 2d6 bludgeoning damage and move the player back to WP_LATRENE3 int nDamage = d6(2); // Roll 2d6 for damage ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(nDamage, DAMAGE_TYPE_BLUDGEONING), oPC); AssignCommand(oPC, ClearAllActions()); AssignCommand(oPC, ActionJumpToLocation(locDestination2)); AssignCommand(oPC, SpeakString("Ow!")); } }