// hos_saveload_h - By Deva Bryson Winblood // modified 05/30/2004: fixed loss of masterwork/rts items when death occurs // after reconnect. fixed alignment adjustment issue with neutral good/evil // characters. JG // modified 08/03/2004: save and load routines ignored arm equipment // modified 02/04/2005: save vampire coffin and restore vampire coffin DBW #include "rtsh_multiplay" #include "mw_imp_h" #include "hos_alignment" #include "prc_inc_skin" ///////////////////////////////////// // PROTOTYPES ///////////////////////////////////// // FILE: hos_saveload_h FUNCTION: fnSLGetAPID() // This function returns adjusted personal ID which includes only // items that can still be accessed OnClientExit. string fnSLGetAPID(object oPC); // FILE: hos_saveload_h FUNCTION: fnSLGetPID() // This function returns CD Key, PC Player Name, and Name. string fnSLGetPID(object oPC); // FILE: hos_saveload_h FUNCTION: fnSLSaveCDKEY() // This function will store the CDKEY on the module object // using the APID. void fnSLSaveCDKEY(object oPC); // FILE: hos_saveload_h FUNCTION: fnSLSavePlayeName() // This function will store the PC Player name on the module object // using the APID. void fnSLSavePCPlayerName(object oPC); // FILE: hos_saveload_h FUNCTION: fnSLGetPCPublicCDKey() // this returns the PC CD Key that was saved using APID string fnSLGetPCPublicCDKey(object oPC); // FILE: hos_saveload_h FUNCTION: fnSLGetPCPlayerName() // This will return the PC Player name that was saved using APID string fnSLGetPCPlayerName(object oPC); // FILE: hos_saveload_h FUNCTION:fnSLSavePlayer() // This will save the details of the player on the module object void fnSLSavePlayer(object oPC,int bClientExit=FALSE); // FILE: hos_saveload_h FUNCTION: fnSLCompare() // This compares oPC against the stored information for them and // returns 0 if they are the same, 1 if oPC is better, or 2 if // the stored version is better. int fnSLCompare(object oPC); // FILE: hos_saveload_h FUNCTION: fnSLLoadPlayer() // This will force the player into the stored format void fnSLLoadPlayer(object oPC); //////////////////////////////////// // FUNCTIONS /////////////////////////////////// void fnRemoveAllInventory(object oMe) { object oItem=GetFirstItemInInventory(oMe); object oPC=oMe; while(oItem!=OBJECT_INVALID) { // strip DelayCommand(1.5,DestroyObject(oItem)); oItem=GetNextItemInInventory(oMe); } // strip //oItem=GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC); oItem = GetPCSkin(oPC); //DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_ARMS,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_ARROWS,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_BELT,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_BOLTS,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_BOOTS,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_BULLETS,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_CLOAK,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_HEAD,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_NECK,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC); DelayCommand(1.0,DestroyObject(oItem)); oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC); DelayCommand(1.0,DestroyObject(oItem)); } // fnRemoveAllInventory() void fnAdjustReputation(object oPC,string sTeam) { // adjust reputation of this PC for sTeam object oWP=GetWaypointByTag(sTeam+"_RESOURCES"); object oCr=CreateObject(OBJECT_TYPE_CREATURE,sTeam+"0",GetLocation(oWP)); if (sTeam!=GetLocalString(oPC,"sTeamID")) AdjustReputation(oPC,oCr,-100); else { AdjustReputation(oPC,oCr,100); } DestroyObject(oCr); } // fnAdjustReputation() string fnSLGetAPID(object oPC) { // Get Adjusted Personal ID string sRet=""; string sName=GetName(oPC); int nClass=GetClassByPosition(1,oPC); int nGender=GetGender(oPC); int nRace=GetRacialType(oPC); sRet=sName+IntToString(nRace)+IntToString(nClass)+IntToString(nGender); return sRet; } // fnGetAPID() string fnSLGetPID(object oPC) { // Get Personal ID string sRet=""; string sName=GetName(oPC); string sCDKEY=GetPCPublicCDKey(oPC); string sPName=GetPCPlayerName(oPC); sRet=sPName+sName+sCDKEY; return sRet; } // fnSLGetPID() void fnSLSaveCDKEY(object oPC) { // Save the CDKEY on the module object oMod=GetModule(); string sCDKEY=GetPCPublicCDKey(oPC); string sAPID=fnSLGetAPID(oPC); SetLocalString(oMod,"sCDKEY"+sAPID,sCDKEY); } // fnSLSaveCDKEY() void fnSLSavePCPlayerName(object oPC) { // Save the PCPlayerName on the module object oMod=GetModule(); string sPCName=GetPCPlayerName(oPC); string sAPID=fnSLGetAPID(oPC); SetLocalString(oMod,"sPNAME"+sAPID,sPCName); } // fnSLSavePCPlayerName() string fnSLGetPCPublicCDKey(object oPC) { // this will return the public CD Key was // returned to APID. object oMod=GetModule(); string sAPID=fnSLGetAPID(oPC); string sRet=GetLocalString(oMod,"sCDKEY"+sAPID); return sRet; } // fnSLGePCPublicCDKey() string fnSLGetPCPlayerName(object oPC) { // this will return the PC Player Name // returned to APID object oMod=GetModule(); string sAPID=fnSLGetAPID(oPC); string sRet=GetLocalString(oMod,"sPNAME"+sAPID); return sRet; } // fnSLGetPCPlayerName() void fnSLSavePlayer(object oPC,int bClientExit=FALSE) { // save current hit points and vitals object oMod=GetModule(); string sPID=fnSLGetPID(oPC); string sAPID=fnSLGetAPID(oPC); int nCHP=GetCurrentHitPoints(oPC); int nXP=GetXP(oPC); string sID=GetLocalString(oPC,"sTeamID"); int nIsVampire=GetLocalInt(oPC,"nIsVampire"); int nKills=GetLocalInt(oPC,"nKills"); int nDeaths=GetLocalInt(oPC,"nDeaths"); int nVXP=GetLocalInt(oPC,"nVampireXP"); int nAGE=GetAlignmentGoodEvil(oPC); int nALC=GetAlignmentLawChaos(oPC); int nGold=GetGold(oPC); int nQuests=GetLocalInt(oPC,"nQuests"); int nAreas=GetLocalInt(oPC,"nAreasDiscovered"); int bDivine=GetLocalInt(oPC,"bTempleQuestPowerUp"); string sKeyword=GetLocalString(oPC,"sTempleKeyword"); vector vVec; object oLead=GetLocalObject(oMod,"oTeamLead"+sID); int nC=0; object oItem=GetFirstItemInInventory(oPC); string sS; DeleteLocalInt(oPC,"bSavePending"); if (GetIsPossessedFamiliar(oPC)) return; // do not save possessed familiar SendMessageToPC(oPC,"Saving Character."); if(bClientExit==TRUE) { // determine PID sPID=GetLocalString(oMod,"sPNAME"+sAPID)+GetName(oPC)+GetLocalString(oMod,"sCDKEY"+sAPID); } // determine PID SetLocalString(oMod,"sTeamID"+sPID,sID); SetLocalInt(oMod,"nCHP"+sPID,nCHP); SetLocalInt(oMod,"nXP"+sPID,nXP); SetLocalInt(oMod,"nVampire"+sPID,nIsVampire); SetLocalInt(oMod,"nKills"+sPID,nKills); SetLocalInt(oMod,"nDeaths"+sPID,nDeaths); SetLocalInt(oMod,"nAGE"+sPID,nAGE); SetLocalInt(oMod,"nVXP"+sPID,nVXP); SetLocalInt(oMod,"nALC"+sPID,nALC); SetLocalInt(oMod,"nGold"+sPID,nGold); SetLocalInt(oMod,"nQuests"+sPID,nQuests); SetLocalInt(oMod,"nAreas"+sPID,nAreas); SetLocalInt(oMod,"bPowerUp"+sPID,bDivine); SetLocalString(oMod,"sTempleWord"+sPID,sKeyword); while(oItem!=OBJECT_INVALID) { // save inventory nC++; SetLocalString(oMod,"sResInv"+IntToString(nC)+sPID,GetResRef(oItem)); SetLocalString(oMod,"sTagInv"+IntToString(nC)+sPID,GetTag(oItem)); SetLocalInt(oMod,"nInvQty"+IntToString(nC)+sPID,GetItemStackSize(oItem)); oItem=GetNextItemInInventory(oPC); } // save inventory nC++; DeleteLocalString(oMod,"sResInv"+IntToString(nC)+sPID); DeleteLocalString(oMod,"sTagInv"+IntToString(nC)+sPID); DeleteLocalInt(oMod,"nInvQty"+IntToString(nC)+sPID); // save equipped items oItem=GetItemInSlot(INVENTORY_SLOT_ARMS,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvAR"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyAR"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvAR"+sPID,GetTag(oItem)); } else {sS="AR"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_ARROWS,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvA"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyA"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvA"+sPID,GetTag(oItem)); } else {sS="A"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_BELT,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvBE"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyBE"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvBE"+sPID,GetTag(oItem)); } else {sS="BE"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_BOLTS,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvB"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyB"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvB"+sPID,GetTag(oItem)); } else {sS="B"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_BOOTS,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvBO"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyBO"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvBO"+sPID,GetTag(oItem)); } else {sS="BO"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_BULLETS,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvBU"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyBU"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvBU"+sPID,GetTag(oItem)); } else {sS="BU"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvCH"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyCH"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvCH"+sPID,GetTag(oItem)); } else {sS="CH"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_CLOAK,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvCL"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyCL"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvCL"+sPID,GetTag(oItem)); } else {sS="CL"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_HEAD,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvH"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyH"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvH"+sPID,GetTag(oItem)); } else {sS="H"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvLH"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyLH"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvLH"+sPID,GetTag(oItem)); } else {sS="LH"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvLR"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyLR"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvLR"+sPID,GetTag(oItem)); } else {sS="LR"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_NECK,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvN"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyN"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvN"+sPID,GetTag(oItem)); } else {sS="N"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvRH"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyRH"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvRH"+sPID,GetTag(oItem)); } else {sS="RH"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvRR"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyRR"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvRR"+sPID,GetTag(oItem)); } else {sS="RR"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } //oItem=GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC); oItem = GetPCSkin(oPC); if (oItem!=OBJECT_INVALID) { SetLocalString(oMod,"sResInvCA"+sPID,GetResRef(oItem)); SetLocalInt(oMod,"nInvQtyCA"+sPID,GetItemStackSize(oItem)); SetLocalString(oMod,"sTagInvCA"+sPID,GetTag(oItem)); } else {sS="CA"; DeleteLocalString(oMod,"sResInv"+sS+sPID); DeleteLocalInt(oMod,"sInvQty"+sS+sPID); DeleteLocalString(oMod,"sTagInv"+sS+sPID); } if (oLead==oPC) { // store team leader specifics nC=GetLocalInt(oPC,"nManaStore"); SetLocalInt(oMod,"nManaStore"+sID,nC); nC=GetLocalInt(oPC,"nStartSoul"); SetLocalInt(oMod,"nStartSoul"+sID,nC); nC=GetLocalInt(oPC,"nSoulStore"); SetLocalInt(oMod,"nSoulStore"+sID,nC); } // store team leader specifics nC=GetLocalInt(oPC,"nKicked"); SetLocalInt(oMod,sPID+"nKicked",nC); nC=GetLocalInt(oPC,"nBuilder"); SetLocalInt(oMod,sPID+"nBuilder",nC); nC=GetLocalInt(oPC,"nSAdvCompleted"); SetLocalInt(oMod,sPID+"nSAdv",nC); // vampire specifics if (GetLocalInt(oPC,"nIsVampire")) { // player is vampire store vampire info oItem=GetLocalObject(oPC,"oCoffin"); if (oItem!=OBJECT_INVALID) { // save coffin location SetLocalObject(oMod,sPID+"oCoffinArea",GetArea(oItem)); vVec=GetPosition(oItem); SetLocalFloat(oMod,sPID+"fCoffinX",vVec.x); SetLocalFloat(oMod,sPID+"fCoffinY",vVec.y); SetLocalFloat(oMod,sPID+"fCoffinZ",vVec.z); SetLocalFloat(oMod,sPID+"fCoffinO",GetFacing(oItem)); } // save coffin location else { // no coffin placed DeleteLocalObject(oMod,sPID+"oCoffinArea"); DeleteLocalFloat(oMod,sPID+"fCoffinX"); DeleteLocalFloat(oMod,sPID+"fCoffinY"); DeleteLocalFloat(oMod,sPID+"fCoffinZ"); DeleteLocalFloat(oMod,sPID+"fCoffinO"); } // no coffin placed } // player is vampire store vampire info SendMessageToPC(oPC,"Save Complete."); } // fnSLSavePlayer() int fnSLCompare(object oPC) { // this will compare the stored PC to the one here // 0 = same, 1= the one connected is better, 2 = the one connected is lesser int nRet=0; int nTotal; object oMod=GetModule(); string sPID=fnSLGetPID(oPC); int nCHP=GetCurrentHitPoints(oPC); int nCGold=GetGold(oPC); int nGold; int nXP=GetXP(oPC); nTotal=nTotal+(nXP-GetLocalInt(oMod,"nXP"+sPID)); nTotal=nTotal+(nCHP-GetLocalInt(oMod,"nCHP"+sPID)); nTotal=nTotal+(nCGold-GetLocalInt(oMod,"nGold"+sPID)); if (nTotal>0) nRet=1; else if (nTotal<0) nRet=2; return nRet; } // fnSLCompare() void fnSetFactionToFriendly(object oPC,string sID) { // Set faction that you control to friendly object oMember=GetObjectByTag(sID+"0"); if (oMember!=OBJECT_INVALID) { // !OI AdjustReputation(oPC,oMember,100); } // !OI else { SendMessageToPC(oPC,"CRITICAL AREA: A creature placed with tag "+sID+"0 could not be found and is required to set faction you control to friendly!!!"); } } // fnSetFactionToFriendly() void fnRestoreInventory(object oPC) { object oMod=GetModule(); int nN; int nC=1; string sPID=fnSLGetPID(oPC); string sS1=GetLocalString(oMod,"sResInv"+IntToString(nC)+sPID); object oItem; object oTempItem; SendMessageToPC(oPC,"===Restoring Inventory===[fnRestoreInventory]"); while(GetStringLength(sS1)>0) { // restore normal inventory items nN=GetLocalInt(oMod,"nInvQty"+IntToString(nC)+sPID); if (nN==0) nN=1; oItem=CreateItemOnObject(sS1,oPC,nN); if (oItem==OBJECT_INVALID) SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item "+IntToString(nC)+" did not produce an item."); else { SendMessageToPC(oPC,"'"+GetName(oItem)+"' Qty:"+IntToString(nN)); if(GetStringLeft(GetLocalString(oMod,"sTagInv"+IntToString(nC)+sPID),7)=="rts_mw_") { if(GetBaseItemType(oItem)==BASE_ITEM_ARMOR||GetBaseItemType(oItem)==BASE_ITEM_LARGESHIELD||GetBaseItemType(oItem)==BASE_ITEM_SMALLSHIELD||GetBaseItemType(oItem)==BASE_ITEM_TOWERSHIELD)fnMakeMasterwork(oPC,oItem,ITEM_TYPE_ARMOR); else fnMakeMasterwork(oPC,oItem,ITEM_TYPE_WEAPON); } else if(GetLocalString(oMod,"sTagInv"+IntToString(nC)+sPID)=="rts_it_imag") { CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); } } nC++; sS1=GetLocalString(oMod,"sResInv"+IntToString(nC)+sPID); } // restore normal inventory items AssignCommand(oPC,ClearAllActions()); sS1=GetLocalString(oMod,"sResInvAR"+sPID); nN=GetLocalInt(oMod,"nInvQtyAR"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"ARMS SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetStringLeft(GetLocalString(oMod,"sTagInvAR"+sPID),7)=="rts_mw_")fnMakeMasterwork(oPC,oItem,ITEM_TYPE_ARMOR,INVENTORY_SLOT_ARMS); else if(GetLocalString(oMod,"sTagInvAR"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_ARMS)); } else AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_ARMS)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item ARMS did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvA"+sPID); nN=GetLocalInt(oMod,"nInvQtyA"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"ARROW SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetStringLeft(GetLocalString(oMod,"sTagInvA"+sPID),7)=="rts_mw_")fnMakeMasterwork(oPC,oItem,ITEM_TYPE_WEAPON,INVENTORY_SLOT_ARROWS); else if(GetLocalString(oMod,"sTagInvA"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_ARROWS)); } else AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_ARROWS)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item ARROWS did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvBE"+sPID); nN=GetLocalInt(oMod,"nInvQtyBE"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"BELT SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetLocalString(oMod,"sTagInvBE"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; } AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_BELT)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item BELT did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvB"+sPID); nN=GetLocalInt(oMod,"nInvQtyB"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"BOLTS SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetStringLeft(GetLocalString(oMod,"sTagInvB"+sPID),7)=="rts_mw_")fnMakeMasterwork(oPC,oItem,ITEM_TYPE_WEAPON,INVENTORY_SLOT_BOLTS); else if(GetLocalString(oMod,"sTagInvB"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_BOLTS)); } else AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_BOLTS)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item BOLTS did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvBO"+sPID); nN=GetLocalInt(oMod,"nInvQtyBO"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"BOOTS SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetLocalString(oMod,"sTagInvBO"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; } AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_BOOTS)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item BOOTS did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvBU"+sPID); nN=GetLocalInt(oMod,"nInvQtyBU"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"BULLETS SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetStringLeft(GetLocalString(oMod,"sTagInvBU"+sPID),7)=="rts_mw_")fnMakeMasterwork(oPC,oItem,ITEM_TYPE_WEAPON,INVENTORY_SLOT_BULLETS); else if(GetLocalString(oMod,"sTagInvBU"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_BULLETS)); } else AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_BULLETS)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item BULLETS did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvCA"+sPID); nN=GetLocalInt(oMod,"nInvQtyCA"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); //AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_CARMOUR)); if (oItem!=OBJECT_INVALID) SendMessageToPC(oPC,"CREATURE ARMOR SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item CREATURE ARMOR did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvCH"+sPID); nN=GetLocalInt(oMod,"nInvQtyCH"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"CHEST SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetStringLeft(GetLocalString(oMod,"sTagInvCH"+sPID),7)=="rts_mw_")fnMakeMasterwork(oPC,oItem,ITEM_TYPE_ARMOR,INVENTORY_SLOT_CHEST); else if(GetLocalString(oMod,"sTagInvCH"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_CHEST)); } else AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_CHEST)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item CHEST did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvCL"+sPID); nN=GetLocalInt(oMod,"nInvQtyCL"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"CLOAK SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetLocalString(oMod,"sTagInvCL"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; } AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_CLOAK)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item CLOAK did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvH"+sPID); nN=GetLocalInt(oMod,"nInvQtyH"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"HEAD SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetLocalString(oMod,"sTagInvH"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; } AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_HEAD)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item HEAD did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvLH"+sPID); nN=GetLocalInt(oMod,"nInvQtyLH"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"LEFT HAND SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetStringLeft(GetLocalString(oMod,"sTagInvLH"+sPID),7)=="rts_mw_") { if(GetBaseItemType(oItem)==BASE_ITEM_LARGESHIELD||GetBaseItemType(oItem)==BASE_ITEM_SMALLSHIELD||GetBaseItemType(oItem)==BASE_ITEM_TOWERSHIELD)fnMakeMasterwork(oPC,oItem,ITEM_TYPE_ARMOR,INVENTORY_SLOT_LEFTHAND); else fnMakeMasterwork(oPC,oItem,ITEM_TYPE_WEAPON,INVENTORY_SLOT_LEFTHAND); } else if(GetLocalString(oMod,"sTagInvLH"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_LEFTHAND)); } else AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_LEFTHAND)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item LEFT HAND did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvLR"+sPID); nN=GetLocalInt(oMod,"nInvQtyLR"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"LEFT RING SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetLocalString(oMod,"sTagInvLR"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; } AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_LEFTRING)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item LEFT RING did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvN"+sPID); nN=GetLocalInt(oMod,"nInvQtyN"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"NECK SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetLocalString(oMod,"sTagInvN"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; } AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_NECK)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item NECK did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvRH"+sPID); nN=GetLocalInt(oMod,"nInvQtyRH"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"attempting to restore tag: "+GetLocalString(oMod,"sTagInvRH"+sPID)); SendMessageToPC(oPC,"RIGHT HAND SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetStringLeft(GetLocalString(oMod,"sTagInvRH"+sPID),7)=="rts_mw_") { SendMessageToPC(oPC,"making masterwortk item..."); if(GetBaseItemType(oItem)==BASE_ITEM_LARGESHIELD||GetBaseItemType(oItem)==BASE_ITEM_SMALLSHIELD||GetBaseItemType(oItem)==BASE_ITEM_TOWERSHIELD)fnMakeMasterwork(oPC,oItem,ITEM_TYPE_ARMOR,INVENTORY_SLOT_RIGHTHAND); else fnMakeMasterwork(oPC,oItem,ITEM_TYPE_WEAPON,INVENTORY_SLOT_RIGHTHAND); } else if(GetLocalString(oMod,"sTagInvRH"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_RIGHTHAND)); } else AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_RIGHTHAND)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item RIGHT HAND did not produce an item."); } } // restore equipped item sS1=GetLocalString(oMod,"sResInvRR"+sPID); nN=GetLocalInt(oMod,"nInvQtyRR"+sPID); if (nN==0) nN=1; if (GetStringLength(sS1)>0) { // restore equipped item oItem=CreateItemOnObject(sS1,oPC,nN); SetIdentified(oItem,TRUE); if (oItem!=OBJECT_INVALID) { SendMessageToPC(oPC,"RIGHT RING SLOT ITEM:"+GetName(oItem)+" Qty:"+IntToString(nN)); if(GetLocalString(oMod,"sTagInvRR"+sPID)=="rts_it_imag") { oTempItem=CopyObject(oItem,GetLocation(oPC),oPC,"rts_it_imag"); DelayCommand(1.0,DestroyObject(oItem)); oItem=oTempItem; } AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_RIGHTRING)); } else { SendMessageToPC(oPC,"ERROR:'"+sS1+"' as a res ref for item RIGHT RING did not produce an item."); } } // restore equipped item } // fnRestoreInventory() void fnSLLoadPlayer(object oPC) { // load the settings onto the player object oMod=GetModule(); string sPID=fnSLGetPID(oPC); int nCHP=GetLocalInt(oMod,"nCHP"+sPID); int nXP=GetLocalInt(oMod,"nXP"+sPID); string sID=GetLocalString(oMod,"sTeamID"+sPID); int nIsVampire=GetLocalInt(oMod,"nVampire"+sPID); int nKills=GetLocalInt(oMod,"nKills"+sPID); int nDeaths=GetLocalInt(oMod,"nDeaths"+sPID); int nVXP=GetLocalInt(oMod,"nVXP"+sPID); int nAGE=GetLocalInt(oMod,"nAGE"+sPID); int nALC=GetLocalInt(oMod,"nALC"+sPID); int nGold=GetLocalInt(oMod,"nGold"+sPID); int nAreas=GetLocalInt(oMod,"nAreas"+sPID); int nQuests=GetLocalInt(oMod,"nQuests"+sPID); int bPowerUp=GetLocalInt(oMod,"bPowerUp"+sPID); string sKeyword=GetLocalString(oMod,"sTempleKeyword"+sPID); int nHP; int nC; int nN; string sS1; string sS2; object oOb; vector vVec; location lLoc; int nN1; object oItem; object oGoldThief=GetObjectByTag("GOLD_THIEF"); string sTeamID=sID; SendMessageToPC(oPC,"[===LOADING STORED CHARACTER===]"); // fnRemoveAllInventory(oPC); SendMessageToPC(oPC,"XP:"+IntToString(nXP)); if (GetXP(oPC)!=nXP) SetXP(oPC,nXP); nHP=GetCurrentHitPoints(oPC); if (nHP>nCHP) { SendMessageToPC(oPC,"HIT POINTS DOES NOT MATCH STORED:"+IntToString(nCHP)); ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(nHP-nCHP),oPC); } SetLocalString(oPC,"sTeamID",sID); SendMessageToPC(oPC,"Stored TeamID:'"+sID+"'"); if (nIsVampire==TRUE) { SetLocalInt(oPC,"nIsVampire",TRUE); SendMessageToPC(oPC,"This player is a vampire."); DelayCommand(10.0,ExecuteScript("player_vampire",oPC)); } SetLocalInt(oPC,"nKills",nKills); SetLocalInt(oPC,"nDeaths",nDeaths); SetLocalInt(oPC,"nVampireXP",nVXP); SetLocalInt(oPC,"nAreasDiscovered",nAreas); SetLocalInt(oPC,"nQuests",nQuests); SetLocalInt(oPC,"bTempleQuestPowerUp",bPowerUp); SetLocalString(oPC,"sTempleKeyword",sKeyword); SendMessageToPC(oPC,"KILLS:"+IntToString(nKills)+" DEATHS:"+IntToString(nDeaths)+" VampireXP:"+IntToString(nVXP)); // correct gold amount if(GetGold(oPC)!=nGold) { SendMessageToPC(oPC,"Gold amount does not match."); SetAILevel(oGoldThief,AI_LEVEL_NORMAL); AssignCommand(oGoldThief,TakeGoldFromCreature(GetGold(oPC),oPC,TRUE)); DelayCommand(10.0,GiveGoldToCreature(oPC,nGold)); SendMessageToPC(oPC,"Gold should be "+IntToString(nGold)+" GP."); } // adjust alignment AdjustAlignmentPartyProtected(oPC,ALIGNMENT_NEUTRAL,100); if (nAGE==ALIGNMENT_EVIL)AdjustAlignmentPartyProtected(oPC,ALIGNMENT_EVIL,100); else if (nAGE==ALIGNMENT_GOOD) AdjustAlignmentPartyProtected(oPC,ALIGNMENT_GOOD,100); if (nALC==ALIGNMENT_LAWFUL) AdjustAlignmentPartyProtected(oPC,ALIGNMENT_LAWFUL,100); else if (nALC==ALIGNMENT_CHAOTIC) AdjustAlignmentPartyProtected(oPC,ALIGNMENT_CHAOTIC,100); // restore inventory SendMessageToPC(oPC,"===Restore Inventory==="); DelayCommand(8.0,fnRestoreInventory(oPC)); // team related stuff------ oOb=GetLocalObject(oMod,"oTeamLead"+sID); if (oOb==OBJECT_INVALID||oOb==oPC) { // make me the team leader SendMessageToPC(oPC,"Make me the leader of team '"+sID+"'"); SetLocalObject(oMod,"oTeamLead"+sID,oPC); nN1=GetLocalInt(oMod,"nManaStore"+sID); fnSetTeamMana(oPC,nN1); nN1=GetLocalInt(oMod,"nSoulStore"+sID); fnSetTeamSouls(oPC,nN1); nN1=GetLocalInt(oMod,"nStartSoul"+sID); SetLocalInt(oPC,"nStartSoul",nN1); } // make me the team leader SendMessageToPC(oPC,"Adjust reputations amongst teams."); fnAdjustReputation(oPC,"SPID"); fnAdjustReputation(oPC,"DWF"); fnAdjustReputation(oPC,"UNC"); fnAdjustReputation(oPC,"UND"); nN1=GetLocalInt(oMod,sPID+"nKicked"); if (nN1>3) BootPC(oPC); SetLocalInt(oPC,"nKicked",nN1); SendMessageToPC(oPC,"KICKED #:"+IntToString(nN1)); nN1=GetLocalInt(oMod,sPID+"nBuilder"); SetLocalInt(oPC,"nBuilder",nN1); SendMessageToPC(oPC,"BUILDER:"+IntToString(nN1)); SendMessageToPC(oPC,"Make sure have tools."); if (nN1==TRUE||oPC==GetLocalObject(oMod,"oTeamLead"+sID)) { // make sure have builders tools if (GetItemPossessedBy(oPC,"RTSUnit_Creation")==OBJECT_INVALID) oOb=CreateItemOnObject("rtsunit_creation",oPC); if (GetItemPossessedBy(oPC,"RTSCreation_Tool")==OBJECT_INVALID) oOb=CreateItemOnObject("rtscreation_tool",oPC); } // make sure have builders tools fnSetFactionToFriendly(oPC,sTeamID); AddJournalQuestEntry(sTeamID,1,oPC,FALSE,FALSE); AddJournalQuestEntry(sTeamID+"UNITS",1,oPC,FALSE,FALSE); // Restore vampire coffin if it exists oOb=GetLocalObject(oMod,sPID+"oCoffinArea"); if (oOb!=OBJECT_INVALID) { // coffin needs to be generated vVec.x=GetLocalFloat(oMod,sPID+"fCoffinX"); vVec.y=GetLocalFloat(oMod,sPID+"fCoffinY"); vVec.z=GetLocalFloat(oMod,sPID+"fCoffinZ"); lLoc=Location(oOb,vVec,GetLocalFloat(oMod,sPID+"fCoffinO")); oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"vampirecoffin",lLoc); SetLocalObject(oOb,"oVampire",oPC); SetLocalObject(oPC,"oCoffin",oOb); SetLocalInt(oPC,"nCoffinPlaced",TRUE); } // coffin needs to be generated if (bPowerUp) ExecuteScript("temple_powerup",oPC); SendMessageToPC(oPC,"[=== DONE LOADING ===]"); } // fnSLLoadPlayer() // void main(){}