/************************************************************/ /* 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 equiped of 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 were 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 equiped 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); object oRuneStone = GetItemPossessedBy(oRespawner, "RuneStone"); object oMod = GetModule(); string sHunger = "HUNGER";//Name of Module Hunger Value string sThirst = "THIRST";//Name of Module Thirst Value string sFatigue = "FATIGUE";//Name of Module Fatigue Value string sAlcTotal = "ALCTOTAL";//Used for Alcohol System int nHungerHP = GetLocalInt(oMod,sHunger); // See htf_mod_onload int nThirstHP = GetLocalInt(oMod,sThirst); // See htf_mod_onload int nFatigueHP = GetLocalInt(oMod,sFatigue); // See htf_mod_onload //Now we make the data fresh for the player SetCampaignInt("HTF",sHunger,nHungerHP,oRespawner); SetCampaignInt("HTF",sThirst,nThirstHP,oRespawner); SetCampaignInt("HTF",sFatigue,nFatigueHP,oRespawner); SetCampaignInt("HTF",sAlcTotal,0,oRespawner); SetLocalInt(oRuneStone,sHunger,nHungerHP); SetLocalInt(oRuneStone,sThirst,nThirstHP); SetLocalInt(oRuneStone,sFatigue,nFatigueHP); SetLocalInt(oRuneStone,sAlcTotal,0); }