// Creates coffin to target. void coffin_token(object oPC, location lLocation) { // Visual effect effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, lLocation,0.0f); //Creates unique coffin. Name is creaters cd-key string sTest = GetPCPublicCDKey(oPC); PrintString("vamp_coffintoken: CDKey to use as a coffin tag is " + sTest); if (sTest != "") { PrintString("vamp_coffintoken: Creating Coffin."); // Create coffin CreateObject(OBJECT_TYPE_PLACEABLE,"VampireCoffin",lLocation,FALSE,sTest);//GetPCPublicCDKey(oPC)); // This is later used in on exit to find and destroy this coffin. SetCampaignString("Vampire","PubCDkey",GetPCPublicCDKey(oPC),oPC); // note that they no longer have a coffin in their inventory SetLocalInt(oPC,"iCoffinInInventory",FALSE); /****** DEBUG CODE ************/ object oTestCoffin = GetObjectByTag(sTest); PrintString("vamp_coffintoken: Coffin's tag is literally " + GetTag(oTestCoffin)); PrintString("vamp_coffintoken: Created coffin using the key "+GetPCPublicCDKey(oPC)+" for "+GetName(oPC)); /****** END DEBUG CODE ************/ SendMessageToPC(oPC,"You place your coffin down. Be sure to pick it up before you log off, or it could be destroyed."); } // If cdkey is "" --> Single Player game. Create normal coffin. else { // This is later used in on exit to find and destroy this coffin. SetCampaignString("Vampire","PubCDkey",GetPCPublicCDKey(oPC),oPC); // note that they no longer have a coffin in their inventory SetLocalInt(oPC,"iCoffinInInventory",FALSE); PrintString("vamp_coffintoken: Created SINGLE PLAYER Coffin."); CreateObject(OBJECT_TYPE_PLACEABLE,"VampireCoffin",lLocation,FALSE); SendMessageToPC(oPC,"You place your coffin down. Be sure to pick it up before you log off, or it could be destroyed."); } // Set respawn location. SetCampaignLocation("Vampire", "VampCoffinLocation", lLocation, oPC); // Destroy token. DestroyObject(GetItemPossessedBy(oPC, "VampireCoffinToken")); }