RATDOG/_module/nss/latrene_rope.nss
Jaysyn904 2e30722043 Level One rework
Revamped Level One: North & Level One: Central to be as close to PnP as possible.  Added Level One: Latrene 3 area.  Added efreeti appearance from CEP3.  Revamped efreeti bottle to be like PnP (no wishes, yet)
2023-09-23 22:02:32 -04:00

37 lines
1.1 KiB
Plaintext

// 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!"));
}
}