//:://////////////////////////////////////////////// //:: Name: J.S. generic scripting include //:: FileName: js_include //:://////////////////////////////////////////////// /* The is the include file for specific callout using J.S. rules. Add functions that you would like called on the bottom of this script, and add the // line; #include "js_include" above the void command on whatever script you are using your new defined function on. Props to "spilth" for his excellent tutorial. */ //:://////////////////////////////////////////////// //:: Created By: Jer Wolfe //:: Modified By: //:: Created On: Aug 01, 2002 //:://////////////////////////////////////////////// // *** Configuration Variables - These are meant to be changed *** int iStableCheck = 19; // GUI Options When Disabled (0 HP) string sDisabledGUIMessage = "You've been disabled. You can either wait for another player to help or respawn if nobody else is around."; int bAllowRespawnWhenDisabled = TRUE; int bAllowWaitForHelpWhenDisabled = TRUE; // GUI Options When Stable (-1 to -9 and not bleeding) string sStableGUIMessage = "You've stabilized! You can either wait for another player to help or respawn if nobody else is around."; int bAllowRespawnWhenStable = TRUE; int bAllowWaitForHelpWhenStable = TRUE; // GUI Options When Dead (-10 or lower) string sDeathGUIMessage = "You've died! Here are your options..."; int bAllowRespawnWhenDead = TRUE; int bAllowWaitForHelpWhenDead = TRUE; // *** Constants - DO NOT CHANGE THESE! *** int PC_HEALTH_ALIVE = 0; // HP > 0 int PC_HEALTH_DISABLED = 1; // HP = 0 int PC_HEALTH_DYING = 2; // -10 < HP < 0 & Bleeding int PC_HEALTH_STABLE = 3; // -10 < HP < 0 & Stabilized int PC_HEALTH_DEAD = 4; // HP <= -10 // A tool to help us test void SetPCHitPoints(object oPC, int iHitPoints) { if (GetIsPC(oPC)) { int iDamage = GetCurrentHitPoints(oPC) - iHitPoints; effect eDamage = EffectDamage(iDamage, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_FIVE); ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC); } } #include "nw_i0_plot" //:://////////////////////////////////////////////// //:: Name: KillAndReplace //:://////////////////////////////////////////////// /* Kills a body and leaves its corpse for looting. Even makes plot characters killable. */ //:://////////////////////////////////////////////// //:: Created By: Bioware //:: Created On: Aug 01, 2001 //:://////////////////////////////////////////////// void KillAndReplace(object oTarget) { // Make sure the object exist if (GetIsObjectValid(oTarget)) { // Make the object killable, and leaves a corpse SetPlotFlag(oTarget, FALSE); AssignCommand(oTarget, SetIsDestroyable(FALSE, TRUE, TRUE)); AssignCommand(OBJECT_SELF, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oTarget)); /*strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_ARMS, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_ARROWS, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_BELT, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_BOLTS, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_BOOTS, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_BULLETS, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_CHEST, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_CLOAK, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_HEAD, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_NECK, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPlayer)); strip_equiped(oTarget, oDeathCorpse, GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPlayer)); */} } //::////////////////////////////////////////////// //:: Name: RemoveEffects //::////////////////////////////////////////////// /* Used to remove all effects during rest. A smaller visulal effect is played, instead of the defalut restoration one */ //::////////////////////////////////////////////// //:: Created By: Jer Wolfe //:: Created By: SPBTool //:: Created On: Aug 01, 2002 //::////////////////////////////////////////////// void RemoveBadEffects(object oDead) { // Declare major variables object oTarget = oDead; effect eVisual = EffectVisualEffect(VFX_IMP_MAGIC_RESISTANCE_USE); int bValid; effect eBad = GetFirstEffect(oTarget); // Search for negative effects while(GetIsEffectValid(eBad)) { if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS || GetEffectType(eBad) == EFFECT_TYPE_DEAF || GetEffectType(eBad) == EFFECT_TYPE_PARALYZE || GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL || GetEffectType(eBad) == EFFECT_TYPE_FRIGHTENED || GetEffectType(eBad) == EFFECT_TYPE_DAZED || GetEffectType(eBad) == EFFECT_TYPE_CONFUSED || GetEffectType(eBad) == EFFECT_TYPE_POISON || GetEffectType(eBad) == EFFECT_TYPE_DISEASE) { // Remove the effect if it is listed above RemoveEffect(oTarget, eBad); ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oTarget); // SendMessageToPC(oTarget, "removed ability"); } eBad = GetNextEffect(oTarget); } // Fire cast spell at event for the specified target // SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE)); } //::////////////////////////////////////////////// //:: Name: AbilityHeal //::////////////////////////////////////////////// /* Used to store and find the difference from PC ablity scores, before and after healing. Using a DC 19 Heal Check to see if amount healed is more than default; 2 points */ //::////////////////////////////////////////////// //:: Created By: Jer Wolfe //:: Created By: SPBTool //:: Created On: Aug 01, 2002 //::////////////////////////////////////////////// void AbilityHeal(int iAbility, string sOrigAbility, int iMinHeal, int iMaxHeal) { object oPC = GetLastPCRested(); // This should be an int stored on the PC before removing the effects, but close // enough to the removing of efects so it doesn't drop again after setting it. int iOrigAbility = GetLocalInt(oPC, sOrigAbility); string sAbility = sOrigAbility; int iCurAbility = GetAbilityScore(oPC, iAbility); int iHealSkill = GetSkillRank(SKILL_HEAL, oPC); // This is the max amount to heal if a heal DC check is made // The DC for the heal check int iHCDC = AutoDC(2, iHealSkill, oPC); int iHeal = iMinHeal; int iHealed = (iCurAbility - iOrigAbility); int iHealedText = (d20(1) + iHealSkill); //SendMessageToPC(oPC, "iHealed "+IntToString(iHealed)+" iHealed "+sAbility+"."); //SendMessageToPC(oPC, "iCurAbility "+IntToString(iCurAbility)+" iCurAbility "+sAbility+"."); //SendMessageToPC(oPC, "iOrigAbility "+IntToString(iOrigAbility)+" iOrigAbility "+sAbility+"."); //SendMessageToPC(oPC, "iHeal "+IntToString(iHeal)+" iHeal "+sAbility+"."); // A Heal skill check v.s. int iHCDC if (iHealedText >= iHCDC) { // if succesful set ammount healed to the maximum, iMaxHeal, and make a //call to the PC saying the roll made iHeal = iMaxHeal; SendMessageToPC(oPC, "Your DC was " +IntToString(iHCDC)+"." +"You made your Heal Check with a "+IntToString(iHealedText)+"."); return; } if (iHealedText < iHCDC) { // make a call to the PC saying the roll made SendMessageToPC(oPC, "Your DC was " +IntToString(iHCDC)+"." +"You failed your Heal Check with a "+IntToString(iHealedText)+"."); return; } // if amount healed only equals 1 send a call to the PC if (iHealed == 1) { SendMessageToPC(oPC, "You recover 1 point of "+sAbility+"."); } if (iHealed > 1 && iHealed > iHeal) { // if amount healed is greater than 1 AND greater than the minimum // healed, apply the heal effect effect eBad = EffectAbilityDecrease(iAbility, (iHealed - iHeal)); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eBad, oPC, 0.0); SendMessageToPC(oPC, "You healed "+IntToString(iHeal)+" points "+sAbility+"."); } if (iHealed > 1 && iHealed < iHeal) { // if amount healed is greater than 1 AND less than the minimum // healed, use the difference, and send that to the PC SendMessageToPC(oPC, "You healed "+IntToString(iHealed)+" points "+sAbility+"."); } if (iHealed > 1 && iHealed == iHeal) { // if amount healed is greater than 1 AND equal to the adjusted ammount // healed, use the difference, and send that to the PC SendMessageToPC(oPC, "You healed "+IntToString(iHealed)+" points "+sAbility+"."); } }