//::////////////////////////////////////////////////// //:: PRC_PWONDEATH /* PRC's OnDeath event handler for NPCs. Hands out GP & Loot */ //::////////////////////////////////////////////////// #include "x0_i0_partywide" #include "prc_inc_racial" #include "inc_debug" void RndDropGear(object oSelf, object oKiller); void RndDropGold(object oSelf, object oKiller); void RndDropGold(object oSelf, object oKiller) { //:: Declare major variables int iHD = GetHitDice(oSelf); int iInt = GetAbilityScore(oSelf, ABILITY_INTELLIGENCE, TRUE); int iIntB = GetAbilityModifier(ABILITY_INTELLIGENCE, oSelf); int iRacial = GetRacialType(oSelf); int iBaseGP = 1; int iRewardGP; int iPartyGP; if(DEBUG) { FloatingTextStringOnCreature("RndDropGold: Dead Mob is "+GetName(oSelf), oKiller, FALSE); FloatingTextStringOnCreature("RndDropGold: oKiller is "+GetName(oKiller), oKiller, FALSE); FloatingTextStringOnCreature("RndDropGold: Dead Mob had "+IntToString(iHD)+" Hit Dice.", oKiller, FALSE); FloatingTextStringOnCreature("RndDropGold: Dead Mob had "+IntToString(iInt)+" INT.", oKiller, FALSE); } int nMembers = GetNumberPartyMembers(oKiller); if (iIntB < 0) { iIntB = 1;} iRewardGP = (iBaseGP * d4(1)) + (iIntB * d4(1)) + (iHD * 5); iPartyGP = iRewardGP * nMembers; if(DEBUG) { FloatingTextStringOnCreature("RndDropGold: Party has "+IntToString(nMembers)+" Members.", oKiller, FALSE); FloatingTextStringOnCreature("RndDropGold: iRewardGP equals "+IntToString(iRewardGP)+" GP.", oKiller, FALSE); FloatingTextStringOnCreature("RndDropGold: iPartyGP equals "+IntToString(iPartyGP)+" GP.", oKiller, FALSE); } 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) { if(DEBUG) {FloatingTextStringOnCreature("Creature doesn't carry treasure", oKiller, FALSE);} iPartyGP = 0; } if (iInt < 4 && iRacial == RACIAL_TYPE_UNDEAD || iRacial == RACIAL_TYPE_ELEMENTAL) { if(DEBUG) {FloatingTextStringOnCreature("Creature doesn't carry treasure [LOWINT]", oKiller, FALSE);} iPartyGP = 0; } if (iPartyGP > 1) { if(DEBUG) {FloatingTextStringOnCreature("Reward gold "+IntToString(iPartyGP), oKiller, FALSE);} 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; if (!GetIsObjectValid(oArmor)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping armor", oKiller, FALSE);} bDropArmor = 0; } if (!GetIsObjectValid(oWeapon)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping weapon", oKiller, FALSE);} bDropWeapon = 0; } if (!GetIsObjectValid(oShield)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping shield", oKiller, FALSE);} bDropShield = 0; } if (!GetIsObjectValid(oHelm)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping helmet", oKiller, FALSE);} bDropHelm = 0; } if (!GetIsObjectValid(oNecklace)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping necklace", oKiller, FALSE);} bDropNecklace = 0; } if (!GetIsObjectValid(oArrows)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping arrows", oKiller, FALSE);} bDropArrows = 0; } if (!GetIsObjectValid(oBelt)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping belt", oKiller, FALSE);} bDropBelt = 0; } if (!GetIsObjectValid(oBolts)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping bolts", oKiller, FALSE);} bDropBolts = 0; } if (!GetIsObjectValid(oBoots)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping boots", oKiller, FALSE);} bDropBoots = 0; } if (!GetIsObjectValid(oBullets)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping bullets", oKiller, FALSE);} bDropBullets = 0; } if (!GetIsObjectValid(oCloak)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping cloak", oKiller, FALSE);} bDropCloak = 0; } if (!GetIsObjectValid(oLeftRing)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping left ring", oKiller, FALSE);} bDropLeftRing = 0; } if (!GetIsObjectValid(oRightRing)) { if(DEBUG) {FloatingTextStringOnCreature("Not dropping right ring", oKiller, FALSE);} bDropRightRing = 0; } //:: 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) { if(DEBUG) {FloatingTextStringOnCreature("No loot, running RndDropGold", oKiller, FALSE);} //RndDropGold(oSelf, oKiller); //:: Alt liked scarface's better } } void main() { //:: Declare major variables object oKiller = GetLastKiller(); object oSelf = OBJECT_SELF; //:: Run GP / XP reward script ExecuteScript("sf_xp", oSelf); if(DEBUG) { FloatingTextStringOnCreature("RndDropGear: Dead Mob is "+GetName(oSelf), oKiller, FALSE); FloatingTextStringOnCreature("RndDropGear: oKiller is "+GetName(oKiller), oKiller, FALSE); } RndDropGear(oSelf, oKiller); }