//::////////////////////////////////////////////////// //:: PRC_PWONDEATH /* PRC's OnDeath event handler for NPCs. Just hands out XP */ //::////////////////////////////////////////////////// #include "x0_i0_partywide" #include "prc_inc_racial" void RndDropGear(object oSelf, object oKiller); void RndDropGold(object oSelf, object oKiller); void RndDropGold(object oSelf, object oKiller) { //:: Declare major variables int iHD = GetHitDice(oKiller); int iInt = GetAbilityScore(oKiller, ABILITY_INTELLIGENCE, TRUE); int iIntB = GetAbilityModifier(ABILITY_INTELLIGENCE, oKiller); int iRacial = GetRacialType(oKiller); int iBaseGP = 1; int iRewardGP; int iPartyGP; //:: Take one off GetNumberPartyMembers(), see known bugs int nMembers = GetNumberPartyMembers(oKiller) - 1; if (iIntB < 0) { iIntB = 0;} iRewardGP = (iBaseGP * d4(1)) + (iIntB * d4(1)) + (iHD * 5); iPartyGP = iRewardGP * nMembers; if (iRacial == RACIAL_TYPE_ANIMAL || iRacial == RACIAL_TYPE_BEAST || iRacial == RACIAL_TYPE_MAGICAL_BEAST || iRacial == RACIAL_TYPE_CONSTRUCT || iRacial == RACIAL_TYPE_OOZE || iRacial == RACIAL_TYPE_PLANT || iRacial == RACIAL_TYPE_VERMIN) { iPartyGP = 0; } if (iInt <= 5 && iRacial == RACIAL_TYPE_UNDEAD || iRacial == RACIAL_TYPE_ELEMENTAL) { iPartyGP = 0; } if (iPartyGP > 1) { GiveGoldToAll(oKiller, iPartyGP); } } void RndDropGear(object oSelf, object oKiller) { //:: Declare major variables object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oSelf); object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oSelf); object oShield = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oSelf); object oHelm = GetItemInSlot(INVENTORY_SLOT_HEAD, oSelf); object oNecklace = GetItemInSlot(INVENTORY_SLOT_NECK, oSelf); object oArms = GetItemInSlot(INVENTORY_SLOT_ARMS, oSelf); object oArrows = GetItemInSlot(INVENTORY_SLOT_ARROWS, oSelf); object oBelt = GetItemInSlot(INVENTORY_SLOT_BELT, oSelf); object oBolts = GetItemInSlot(INVENTORY_SLOT_BOLTS, oSelf); object oBoots = GetItemInSlot(INVENTORY_SLOT_BOOTS, oSelf); object oBullets = GetItemInSlot(INVENTORY_SLOT_BULLETS, oSelf); object oCloak = GetItemInSlot(INVENTORY_SLOT_CLOAK, oSelf); object oLeftRing = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oSelf); object oRightRing = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oSelf); //:: Give a 3% chance to drop each type of equipment int bDropArmor = d100() > 97; int bDropWeapon = d100() > 97; int bDropShield = d100() > 97; int bDropHelm = d100() > 97; int bDropNecklace = d100() > 97; int bDropArms = d100() > 97; int bDropArrows = d100() > 97; int bDropBelt = d100() > 97; int bDropBolts = d100() > 97; int bDropBoots = d100() > 97; int bDropBullets = d100() > 97; int bDropCloak = d100() > 97; int bDropLeftRing = d100() > 97; int bDropRightRing = d100() > 97; //:: Set Droppable Flag as determined above. SetDroppableFlag(oArmor, bDropArmor); SetDroppableFlag(oWeapon, bDropWeapon); SetDroppableFlag(oShield, bDropShield); SetDroppableFlag(oHelm, bDropHelm); SetDroppableFlag(oNecklace, bDropNecklace); SetDroppableFlag(oArms, bDropArms); SetDroppableFlag(oArrows, bDropArrows); SetDroppableFlag(oBelt, bDropBelt); SetDroppableFlag(oBolts, bDropBolts); SetDroppableFlag(oBoots, bDropBoots); SetDroppableFlag(oBullets, bDropBullets); SetDroppableFlag(oCloak, bDropCloak); SetDroppableFlag(oLeftRing, bDropLeftRing); SetDroppableFlag(oRightRing, bDropRightRing); if (!bDropArmor && !bDropWeapon && !bDropShield && !bDropHelm && !bDropNecklace && !bDropArms && !bDropArrows && !bDropBelt && !bDropBolts && !bDropBoots && !bDropBullets && !bDropCloak && !bDropLeftRing && !bDropRightRing) { RndDropGold(oSelf, oKiller); } } void main() { //:: Declare major variables object oKiller = GetLastKiller(); object oSelf = OBJECT_SELF; RndDropGear(oSelf, oKiller); }