Module commit
Module commit.
This commit is contained in:
61
_module/nss/vamp_coffin.nss
Normal file
61
_module/nss/vamp_coffin.nss
Normal file
@@ -0,0 +1,61 @@
|
||||
// Script to Pick up coffin
|
||||
|
||||
|
||||
|
||||
// main script code
|
||||
void main()
|
||||
{
|
||||
// Who is picking it up
|
||||
object oPC = GetLastUsedBy();
|
||||
|
||||
PrintString("vamp_coffin: called by "+GetName(oPC));
|
||||
|
||||
// If vampire
|
||||
if (GetSubRace(oPC) == "Vampire")
|
||||
{
|
||||
// Get tag or coffin and cd-key of vampire
|
||||
string sCoffin = GetTag(OBJECT_SELF);
|
||||
string sname = GetPCPublicCDKey(oPC);
|
||||
|
||||
PrintString("vamp_coffin: I am looking for TAG[" + sCoffin + "] NAME["+sname+"]");
|
||||
|
||||
// If tag and key match
|
||||
if (sname == sCoffin)
|
||||
{
|
||||
PrintString("vamp_coffin: TAG[" + sCoffin + "] and NAME["+sname+"] match! Picking up coffin.");
|
||||
|
||||
// Put token to inventory and destroy coffin
|
||||
SendMessageToPC(oPC,"You pick up your coffin. If you die with it in your possession, you will be permanently dead, however, don't leave your coffin alone [log off] or it could be destroyed.");
|
||||
CreateItemOnObject("vampirecoffintok", GetLastUsedBy(), 1);
|
||||
DestroyObject(OBJECT_SELF, 0.1f);
|
||||
// We need to keep track of the fact that the Vampire has their
|
||||
// coffin so we can tell whether or not to give them a new
|
||||
// on when they log in again.
|
||||
PrintString("vamp_coffin: Coffin in Inventory was ["+IntToString(GetLocalInt(oPC,"iCoffinInInventory"))+"].");
|
||||
SetLocalInt(oPC,"iCoffinInInventory",TRUE);
|
||||
PrintString("vamp_coffin: Coffin in Inventory is now ["+IntToString(GetLocalInt(oPC,"iCoffinInInventory"))+"].");
|
||||
//vamp_coffin_returnToSelf(oPC); // handled on rest now
|
||||
}
|
||||
//If sname is "" ---> Player is playing single player. Pick up coffin
|
||||
else if (sname == "")
|
||||
{
|
||||
// Put token to inventory and destroy coffin
|
||||
SendMessageToPC(oPC,"You pick up your coffin.");
|
||||
CreateItemOnObject("vampirecoffintok", GetLastUsedBy(), 1);
|
||||
DestroyObject(OBJECT_SELF, 0.1f);
|
||||
PrintString("vamp_coffin: Coffin in Inventory was ["+IntToString(GetLocalInt(oPC,"CoffinInInventory"))+"].");
|
||||
SetLocalInt(oPC,"CoffinInInventory",TRUE);
|
||||
PrintString("vamp_coffin: Coffin in Inventory is now ["+IntToString(GetLocalInt(oPC,"CoffinInInventory"))+"].");
|
||||
//vamp_coffin_returnToSelf(oPC); // handled on rest now
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintString("vamp_coffin: TAG[" + sCoffin + "] and NAME["+sname+"] do NOT match.");
|
||||
SendMessageToPC(oPC,"This is not your coffin, you cannot pick it up.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToPC(oPC,"You can not use this... you are not a Vampire.");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user