Files
Anphillia_PRC8/_module/nss/cnr_scalp_ou.nss
Jaysyn904 28cdb617b3 Initial commit
Adding all of the current content for Anphillia Unlimited.
2024-01-04 07:49:38 -05:00

92 lines
2.8 KiB
Plaintext

/////////////////////////////////////////////////////////
//
// Craftable Natural Resources (CNR) by Festyx
//
// Name: cnr_minbath_ou
//
// Desc: This is the OnUsed handler for Mineral Baths.
// Mystery minerals found in its inventory are
// converted to known gem minerals.
//
// This OnUsed handler is meant to fix a Bioware
// bug that sometimes prevents placeables from
// getting OnOpen or OnClose events. This OnUsed
// handler in coordination with the OnDisturbed
// ("cnr_device_od") handler work around the bug.
//
// Author: David Bobeck 07Apr03
//
/////////////////////////////////////////////////////////
#include "cnr_language_inc"
#include "hc_inc"
#include "anph_inc"
#include "eye_scalp_inc"
void main()
{
// Note: A placeable will receive events in the following order...
// OnOpen, OnUsed, OnDisturbed, OnClose, OnUsed.
if (GetLocalInt(OBJECT_SELF, "bCnrDisturbed") != TRUE)
{
// Skip if the contents have not been altered.
return;
}
SetLocalInt(OBJECT_SELF, "bCnrDisturbed", FALSE);
// If the Bioware bug is in effect, simulate the closing
if (GetIsOpen(OBJECT_SELF))
{
AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_PLACEABLE_CLOSE));
}
object oUser = GetLastUsedBy();
string sScalpTag;
string sScalpResRef;
string sFloat;
object oItem = GetFirstItemInInventory(OBJECT_SELF);
while (oItem != OBJECT_INVALID)
{
if (GetStringLowerCase(GetStringLeft(GetTag(oItem), 3)) == "scp")
{
if (GetScalpLevel(oItem) >= 10)
{
if (GetScalpFaction(oItem) != AnphGetPlayerTeam(oUser))
{
if (GetScalpAlignment(oItem) == ALIGNMENT_GOOD)
{
sScalpResRef = "cnrscalpgood";
sFloat = "You prepared the scalp of a good person!";
}
else if (GetScalpAlignment(oItem) == ALIGNMENT_EVIL)
{
sScalpResRef = "cnrscalpevil";
sFloat = "You prepared the scalp of an evil person!";
}
else
{
sScalpResRef = "cnrscalpneut";
sFloat = "You prepared the scalp of a neutral person!";
}
// Scalps do not stack
DestroyObject(oItem);
object oScalp = CreateItemOnObject(sScalpResRef, oUser, 1);
FloatingTextStringOnCreature(sFloat, oUser, FALSE);
}
else
{
FloatingTextStringOnCreature("You can't prepare scalps from your own faction.", oUser, FALSE);
}
}
else
{
FloatingTextStringOnCreature("The person this scalp is from is not powerful enough.", oUser, FALSE);
}
}
oItem = GetNextItemInInventory(OBJECT_SELF);
}
}