LoD_PRC8/_module/nss/sd_wandofduplica.nss
Jaysyn904 94990edc60 Initial Upload
Initial Upload
2023-09-21 21:20:34 -04:00

74 lines
2.5 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

void WandOfDuplication()
{
object oPC = GetItemActivator();
object oArea = GetArea(oPC);
object oTarget = GetItemActivatedTarget();
int iTargetType = GetObjectType(oTarget);
string sAreaTag = GetTag(oArea);
object oInventoryItem = OBJECT_INVALID;
//check for invalid areas
if (
sAreaTag == "RealmsofPerilItemsMuseum" ||
sAreaTag == "<INSERT INVALID AREA TAG HERE>" ||
sAreaTag == "<INSERT LAST INVALID AREA TAG HERE>"
)
{
SendMessageToPC(oPC, "You cannot use the wand of duplication in here.");
SendMessageToAllDMs(GetName(oPC)+ " tried to use the wand of duplication in an invalid area (" + GetName(oArea) + ")");
CreateItemOnObject(GetResRef(GetItemActivated()), oPC);
return;
}
if (iTargetType == OBJECT_TYPE_ITEM)
{
//check for invalid item
if (GetResRef(oTarget) == "wandofduplicatio")
{
SendMessageToPC(oPC, "You cant duplicate the wand of duplication");
SendMessageToAllDMs(GetName(oPC)+ " tried to duplicate the wand of duplication");
}
else
{
CreateItemOnObject(GetResRef(oTarget), oPC, GetNumStackedItems(oTarget));
}
}
else if (iTargetType == OBJECT_TYPE_PLACEABLE)
{
if (GetHasInventory(oTarget))
{
oInventoryItem = GetFirstItemInInventory(oTarget);
while (oInventoryItem != OBJECT_INVALID)
{
if (GetResRef(oInventoryItem) == "wandofduplicatio")
{
SendMessageToPC(oPC, "You cant duplicate the wand of duplication");
SendMessageToAllDMs(GetName(oPC)+ " tried to duplicate the wand of duplication");
}
else
{
CreateItemOnObject(GetResRef(oInventoryItem), oPC, GetNumStackedItems(oInventoryItem));
}
oInventoryItem = GetNextItemInInventory(oTarget);
}
}
}
else
{
SendMessageToPC(oPC, GetName(oTarget) + ", is not a valid target for this wand");
// dont give wand back if the activator is a DM, that happens anyways
if (GetIsPC(oPC))
{
CreateItemOnObject(GetResRef(GetItemActivated()), oPC);
}
}
//if activator is a DM, give the wand back to him
if (GetIsDM(oPC))
{
CreateItemOnObject(GetResRef(GetItemActivated()), oPC);
}
}