45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
//:://////////////////////////////////////////////////////////////
|
|
//:: ModMan's Bashing Script.
|
|
//:: Created: 01/09/03
|
|
//:://////////////////////////////////////////////////////////////
|
|
//:: This script is placed in OnDamaged Event of a Door or Chest.
|
|
//:: When damaged there is roughly a 5% chance of destroying the
|
|
//:: weapon of whoever is damaging the object. Weapons with
|
|
//:: any kind of enhancements have a reduced chance of breaking.
|
|
//:: This encourages players to be more careful about bashing, or
|
|
//:: to carry extra, disposable weapons for such a purpose.
|
|
//:://////////////////////////////////////////////////////////////
|
|
|
|
void main()
|
|
|
|
{
|
|
object oPC = GetLastDamager(); // Who is hitting me?
|
|
object oPrimary = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
|
|
//int oWeaponType = GetBaseItemType (oPrimary);
|
|
|
|
|
|
|
|
// Roll to see if the weapon broke
|
|
int nBash = d100(2); // Range is 2 to 200, rough 1 in 20 chance of breakage
|
|
|
|
if (nBash <= 15)
|
|
{
|
|
DestroyObject(oPrimary);
|
|
SendMessageToPC(oPC, "You have broken your weapon trying to bash the object!");
|
|
}
|
|
|
|
string sLevel = IntToString(GetHitDice(oPC));
|
|
int nAlert = d100(1);
|
|
string sResref = "wm_" + sLevel;
|
|
object oWP = GetNearestObjectByTag("wmwp");
|
|
location lWP = GetLocation(oWP);
|
|
|
|
if (nAlert <= 2)
|
|
|
|
{
|
|
FloatingTextStringOnCreature("You are making a lot of noise.",oPC);
|
|
object oSpawn = CreateObject(OBJECT_TYPE_CREATURE,sResref,lWP);
|
|
AssignCommand(oSpawn,ActionAttack(oPC));
|
|
}
|
|
}
|