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

83 lines
2.6 KiB
Plaintext

#include "hc_inc"
#include "anph_inc"
#include "eye_dm_inc"
#include "anphrez_inc"
string ConvertNumberToFixedString(int iNumber)
{
string sNew;
if (iNumber < 10)
{
sNew = "0" + IntToString(iNumber);
}
else
{
sNew = IntToString(iNumber);
}
return sNew;
}
void main()
{
object oUser=OBJECT_SELF;
object oOther=GetLocalObject(oUser,"OTHER");
object oItem=GetLocalObject(oUser,"ITEM");
string sNewScalpTag;
object oPlayerCorpse;
object oScalp;
string sScalpAlign;
object oRespawner;
DeleteLocalObject(oUser,"ITEM");
DeleteLocalObject(oUser,"OTHER");
if(oOther==OBJECT_INVALID) return;
if(GetTag(oOther) != "DeathCorpse")
{
SendMessageToPC(oUser,"This item can be used on Player Corpses only.");
return;
}
if(GetDistanceBetween(oUser, oOther) > 3.0)
{
SendMessageToPC(oUser,"You have to move closer.");
return;
}
AssignCommand(oUser,ActionMoveToLocation(GetLocation(oOther)));
DelayCommand(1.0,AssignCommand(oUser,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW)));
// DelayCommand(1.3,AssignCommand(oOther,SetIsDestroyable(TRUE)));
if (GetLocalInt(oOther, "Scalped") == 0)
{
oRespawner = AnphFindPlayerByKey(GetLocalString (oOther, "Name"), GetLocalString (oOther, "Key"));
if (AnphGetPlayerTeam(oUser) == AnphGetPlayerTeam(oRespawner))
{
SendMessageToPC(oUser, "You can't scalp members of your own team!");
return;
}
sNewScalpTag = "SCP_FC" + AnphGetPlayerTeam(oRespawner) + "_CF" + GetName(oRespawner) + "_MN" + ConvertNumberToFixedString(GetHitDice(oRespawner));
if (GetIsObjectValid(oRespawner))
{
if (GetAlignmentGoodEvil(oRespawner) == ALIGNMENT_GOOD)
sScalpAlign = "G";
else if (GetAlignmentGoodEvil(oRespawner) == ALIGNMENT_EVIL)
sScalpAlign = "E";
else
sScalpAlign = "N";
sNewScalpTag = "SCP_" + AnphGetPlayerTeam(oRespawner) + "_" + ConvertNumberToFixedString(GetHitDice(oRespawner)) + "_" + sScalpAlign;
oScalp = CopyObject(GetObjectByTag("PlayerScalp"), GetLocation(oUser), oUser, sNewScalpTag);
SetLocalInt(oOther, "Scalped", 1);
oPlayerCorpse = GetItemPossessedBy(oOther, "PlayerCorpse");
DestroyObject(oPlayerCorpse);
DelayCommand(5.0, AnphRez (oRespawner, FALSE, oUser, TRUE));
}
else
{
SendMessageToPC(oUser, "Sorry, the player this corpse belongs to is no longer in this realm.");
}
}
else
{
SendMessageToPC(oUser, "This one was scalped already");
}
}