/************************************************************/ /* OnPlayerRespawn script. It takes all of all your current */ /* equipped and inventory items and transfers them into */ /* a corpse on the location which you died in. */ /************************************************************/ /* Created by: Osthman */ /* Date: Saturday, 9/14/02 */ /************************************************************/ #include "nw_i0_plot" void main() { object oRespawner = GetLastRespawnButtonPresser(); object oItem = GetFirstItemInInventory(oRespawner); // Items currently equipped on the PC. object oSlot1 = GetItemInSlot(INVENTORY_SLOT_ARMS,oRespawner); object oSlot2 = GetItemInSlot(INVENTORY_SLOT_ARROWS,oRespawner); object oSlot3 = GetItemInSlot(INVENTORY_SLOT_BELT,oRespawner); object oSlot4 = GetItemInSlot(INVENTORY_SLOT_BOLTS,oRespawner); object oSlot5 = GetItemInSlot(INVENTORY_SLOT_BOOTS,oRespawner); object oSlot6 = GetItemInSlot(INVENTORY_SLOT_BULLETS,oRespawner); //object oSlot7 = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oRespawner); object oSlot8 = GetItemInSlot(INVENTORY_SLOT_CHEST,oRespawner); object oSlot9 = GetItemInSlot(INVENTORY_SLOT_CLOAK,oRespawner); //object oSlot10 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B,oRespawner); //object oSlot11 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L,oRespawner); //object oSlot12 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R,oRespawner); object oSlot13 = GetItemInSlot(INVENTORY_SLOT_HEAD,oRespawner); object oSlot14 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oRespawner); object oSlot15 = GetItemInSlot(INVENTORY_SLOT_LEFTRING,oRespawner); object oSlot16 = GetItemInSlot(INVENTORY_SLOT_NECK,oRespawner); object oSlot17 = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oRespawner); object oSlot18 = GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oRespawner); // Gets the location that was set on the module when he/she died. location lDeathSpot = GetLocalLocation(GetModule(),""+GetName(oRespawner)+" Death"); // Checks to see if the PC has alteast 1 valid object in their inventory, if not, // don't create another body. if (GetFirstItemInInventory(oRespawner) == OBJECT_INVALID && oSlot1 == OBJECT_INVALID && oSlot2 == OBJECT_INVALID && oSlot3 == OBJECT_INVALID && oSlot4 == OBJECT_INVALID && oSlot5 == OBJECT_INVALID && oSlot6 == OBJECT_INVALID && /*oSlot7 == OBJECT_INVALID &&*/ oSlot8 == OBJECT_INVALID && oSlot9 == OBJECT_INVALID && /*oSlot10 == OBJECT_INVALID && oSlot11 == OBJECT_INVALID && oSlot12 == OBJECT_INVALID &&*/ oSlot13 == OBJECT_INVALID && oSlot14 == OBJECT_INVALID && oSlot15 == OBJECT_INVALID && oSlot16 == OBJECT_INVALID && oSlot17 == OBJECT_INVALID && oSlot18 == OBJECT_INVALID && GetGold(oRespawner) == 0) { // Jumps the PC immediately to the place(s) you want them to respawn, // instead of having a delay of 2 seconds. ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner); //RemoveEffects(oRespawner); // Location(s) of where the player respawns AssignCommand(oRespawner,JumpToLocation(GetLocation(GetObjectByTag("NW_DEATH_TEMPLE")))); } else { DelayCommand(2.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner)); DelayCommand(2.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner)); //DelayCommand(2.0,RemoveEffects(oRespawner)); // Make sure you have a created a custom placeable object with the apperance // of a body, has the boxes checked in plot item, useable, has inventory // and it has the script posted above attached on the "OnClosed" event of the placeable. // Change the resref tag here if you have a different one on it. object oCorpse = CreateObject(OBJECT_TYPE_PLACEABLE,"grave",lDeathSpot); // Takes all currently equipped weapons from the PC. AssignCommand(oCorpse,ActionTakeItem(oSlot1,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot2,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot3,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot4,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot5,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot6,oRespawner)); //AssignCommand(oCorpse,ActionTakeItem(oSlot7,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot8,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot9,oRespawner)); //AssignCommand(oCorpse,ActionTakeItem(oSlot10,oRespawner)); //AssignCommand(oCorpse,ActionTakeItem(oSlot11,oRespawner)); //AssignCommand(oCorpse,ActionTakeItem(oSlot12,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot13,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot14,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot15,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot16,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot17,oRespawner)); AssignCommand(oCorpse,ActionTakeItem(oSlot18,oRespawner)); // Takes all items on the PC's inventory. while (GetIsObjectValid(oItem)) { AssignCommand(oCorpse,ActionTakeItem(oItem,oRespawner)); oItem = GetNextItemInInventory(oRespawner); } // Takes gold also. AssignCommand(oCorpse,TakeGoldFromCreature(GetGold(oRespawner),oRespawner)); // Here make them respawn to the place(s) you want the PC to respawn, but make // sure that the "jumping" is delayed for 2 seconds since the other effects // are delayed for 2 seconds also, so if you change that you need to change this. DelayCommand(2.0,AssignCommand(oRespawner,ActionJumpToLocation(GetLocation(GetObjectByTag("NW_DEATH_TEMPLE"))))); } //CreateItemOnObject("RuneStone",oRespawner); //CreateItemOnObject("deathrune",oRespawner); int iLevel = GetHitDice(oRespawner); int iPen = 1000 * iLevel; int iXPold = GetXP(oRespawner); string sPen = IntToString(iPen); int iXPnew = iXPold-iPen; if (iLevel >= 5) { SetXP(oRespawner, iXPnew); SendMessageToPC(oRespawner,"You have lost "+sPen+" XP for respawning."); } SetLocalInt(oRespawner,"usealtarevil",0); SetLocalInt(oRespawner,"usealtargood",0); object oDonate = GetObjectByTag("DonationBox"); ExecuteScript("ss_treasure",oDonate); }