WoR_PRC8/_module/nss/cutscn_cliffclim.nss
Jaysyn904 b5e28e52f4 Initial commit
Initial commit [1.18]
2025-04-03 11:49:34 -04:00

120 lines
4.3 KiB
Plaintext

//::////////////////////////////////////////////////////////////////////////////
//::
//:: Script Name: cutscn_cliffclim
//::
//:: Use: This script is used to create a visual effect of falling it will also
//:: deal damage to the player and send a brief descriptive message
//::
//::
//:: Created By: Birdman076
//::
//:: Created On: August 16, 2009
//::
//:: Note: This script will disarm the player before they climb to add a bit
//:: more to the effect of climbing a rope and falling.
//::
//::////////////////////////////////////////////////////////////////////////////
effect eAppear = EffectAppear();
int nInt;
effect eEffect;
location lTarget;
object oTarget;
//Put this on action taken in the conversation editor
void main()
{
//Gets who is doing the talking
object oPC = GetPCSpeaker();
// 15% chance of this actually happening
if (d100()<=15)
{
//Unequips items in players hand for better immersion
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND)));
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND)));
//Fades the screen to black to hide what is happening
FadeToBlack(oPC);
//Retrieves a waypoint to jump the player too
oTarget = GetWaypointByTag("WP_CLIFF_CS_OUT");
lTarget = GetLocation(oTarget);
//only do the jump if the location is valid.
//though not flawless, we just check if it is in a valid area.
//the script will stop if the location isn't valid - meaning that
//nothing put after the teleport will fire either.
//the current location won't be stored, either
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionJumpToLocation(lTarget));
//Retrieves the waypoint to jump the player back to.
oTarget = GetWaypointByTag("WP_CLIFF_CS_IN");
lTarget = GetLocation(oTarget);
//only do the jump if the location is valid.
//though not flawless, we just check if it is in a valid area.
//the script will stop if the location isn't valid - meaning that
//nothing put after the teleport will fire either.
//the current location won't be stored, either
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionJumpToLocation(lTarget));
oTarget = oPC;
//This gives the player that "Falling" effect
DelayCommand(5.1, ApplyEffectToObject(DURATION_TYPE_INSTANT, eAppear, oTarget));
//This cancels the fade to black effect. We do this after the Falling effect
//because if we don't the player will see him/her self appear on the ground
//and then bounce into the air, then fall again. Not very believable for a
//falling effect
DelayCommand(5.3, StopFade(oPC));
eEffect = EffectKnockdown();
//This knocks the player to the ground after the fall for a better effect
DelayCommand(5.5, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 3.0f));
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
nInt = GetObjectType(oTarget);
//We make some blood
DelayCommand(7.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_REG_RED), oTarget));
//Deal some damage
eEffect = EffectDamage(10, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_NORMAL);
DelayCommand(7.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC));
//Send a message informing them of what happened.
DelayCommand(8.0, SendMessageToPC(oPC, "You have lost your grip on the rope and fallen to the base of the cliff."));
}
else //Just send them up the rope if they don't fall
{
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND)));
AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND)));
oTarget = GetWaypointByTag("WP_CODS_UP");
lTarget = GetLocation(oTarget);
//only do the jump if the location is valid.
//though not flawless, we just check if it is in a valid area.
//the script will stop if the location isn't valid - meaning that
//nothing put after the teleport will fire either.
//the current location won't be stored, either
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionJumpToLocation(lTarget));
}
}