58 lines
2.2 KiB
Plaintext
58 lines
2.2 KiB
Plaintext
|
// rts_it_op10
|
||
|
#include "rtsh_multiplay"
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
object oPC=GetItemActivator();
|
||
|
object oMod=GetModule();
|
||
|
object oItem=GetItemActivated();
|
||
|
int nSouls=GetLocalInt(oMod,"nSoulLeechSouls");
|
||
|
location lLoc=GetItemActivatedTargetLocation();
|
||
|
effect eBeam=EffectBeam(VFX_BEAM_EVIL,oPC,BODY_NODE_HAND);
|
||
|
object oReceptacle;
|
||
|
string sID;
|
||
|
object oLeader;
|
||
|
int nSoulsR;
|
||
|
int nDif;
|
||
|
if (GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC)==oItem||GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC)==oItem)
|
||
|
{ // equipped
|
||
|
oReceptacle=GetNearestObjectToLocation(OBJECT_TYPE_TRIGGER,lLoc);
|
||
|
if (GetIsObjectValid(oReceptacle))
|
||
|
{
|
||
|
if(GetDistanceBetweenLocations(GetLocation(oReceptacle),lLoc)<4.0)
|
||
|
{
|
||
|
if (nSouls<5)
|
||
|
{ // room for more souls
|
||
|
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,eBeam,lLoc,3.0);
|
||
|
sID=GetName(oReceptacle);
|
||
|
oLeader=GetLocalObject(oMod,"oTeamLead"+sID);
|
||
|
nSoulsR=fnGetTeamSouls(oLeader);
|
||
|
if (nSoulsR>0)
|
||
|
{ // has souls
|
||
|
nDif=5-nSouls;
|
||
|
if (nDif<=nSoulsR)
|
||
|
{
|
||
|
nSouls=5;
|
||
|
nSoulsR=nSoulsR-nDif;
|
||
|
fnSetTeamSouls(oLeader,nSoulsR);
|
||
|
SendMessageToPC(oLeader,GetName(oPC)+" is stealing souls from your soul receptacle.");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
nSouls=nSouls+nSoulsR;
|
||
|
fnSetTeamSouls(oLeader,0);
|
||
|
SendMessageToPC(oLeader,GetName(oPC)+" is stealing souls from your soul receptacle.");
|
||
|
}
|
||
|
SetLocalInt(oMod,"nSoulLeechSouls",nSouls);
|
||
|
} // has souls
|
||
|
else { SendMessageToPC(oPC,"There are no souls in this receptacle."); }
|
||
|
} // room for more souls
|
||
|
else { SendMessageToPC(oPC,"Soul Leech currently stores "+IntToString(nSouls)+" and can only take souls from a soul receptacle when it has less than 5 souls."); }
|
||
|
}
|
||
|
else { SendMessageToPC(oPC,"The location you indicated does not seem to be near a soul receptacle."); }
|
||
|
}
|
||
|
else { SendMessageToPC(oPC,"This must be targetted near a soul receptacle."); }
|
||
|
} // equipped
|
||
|
else { SendMessageToPC(oPC,"You must be wearing the ring to use it."); }
|
||
|
}
|