HoS_PRC8/_mod/_module/nss/rts_use_manamach.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

48 lines
1.8 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
// Real Time Strategy - NWN - Mana Machine Use
//=============================================================================
// By Deva Bryson Winblood. 03/10/2003
////////////////////////////////////////////////////////////////////////////////
#include "rtsh_multiplay"
void main()
{
object oPC=GetLastUsedBy();
object oMe=OBJECT_SELF;
object oOwner=GetLocalObject(oMe,"oOwner");
int nMana=fnGetTeamMana(oOwner);
object oItem;
effect eVFX=EffectVisualEffect(VFX_FNF_SMOKE_PUFF);
string sID=GetLocalString(oOwner,"sTeamID");
string sPID=GetLocalString(oPC,"sTeamID");
if (oPC==oOwner||(sID==sPID))
{ // convert a soul to 10 mana
oItem=GetItemPossessedBy(oPC,"SoulToken");
if (oItem!=OBJECT_INVALID)
{ // use token
DestroyObject(oItem);
SendMessageToPC(oPC,"You burn a soul token in this machine and 10 mana is added to your vault.");
nMana=nMana+10;
fnSetTeamMana(oOwner,nMana);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVFX,oPC,1.0);
} // use token
else
SendMessageToPC(oPC,"You do not have a soul token to burn in this machine.");
} // convert a soul to 10 mana
else
{ // not the owner
if (nMana>0)
{
SendMessageToPC(oPC,"You feel this device sucking at you. You lost 1 mana.");
nMana=fnGetTeamMana(oPC);
nMana=nMana-1;
fnSetTeamMana(oPC,nMana);
nMana=fnGetTeamMana(oOwner);
nMana=nMana+1;
fnSetTeamMana(oOwner,nMana);
SendMessageToPC(oOwner,"One mana was added to your mana vault from the mana machine.");
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVFX,oPC,1.0);
}
} // not the owner
}