66 lines
2.5 KiB
Plaintext
66 lines
2.5 KiB
Plaintext
//////////////////////////////////////////////////////////////////////////////
|
|
// Real Time Strategy - NWN - Soul Receptacle - OnEnter
|
|
//============================================================================
|
|
// By Deva Bryson Winblood. 02/28/2003
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
#include "rtsh_multiplay"
|
|
|
|
void main()
|
|
{
|
|
object oPC=GetEnteringObject();
|
|
string sTeamP=GetName(OBJECT_SELF);
|
|
int nAdd=0;
|
|
effect eVFX=EffectVisualEffect(VFX_IMP_HEAD_ELECTRICITY);
|
|
object oLeader=GetLocalObject(GetModule(),"oTeamLead"+sTeamP);
|
|
object oItem=GetFirstItemInInventory(oPC);
|
|
string sID=GetLocalString(oPC,"sTeamID");
|
|
int nMana=fnGetTeamSouls(oPC);
|
|
int nSC=GetLocalInt(oPC,"nSoulsCaptured");
|
|
int nN;
|
|
object oWeapon=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
|
|
if (GetIsObjectValid(oWeapon)&&GetTag(oWeapon)=="rts_it_op20")
|
|
{ // transfer soul receptacles
|
|
nN=GetLocalInt(oWeapon,"nStoredCR");
|
|
if (nN>0)
|
|
{ // transfer
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVFX,oPC);
|
|
nSC=nSC+nN;
|
|
SetLocalInt(oPC,"nSoulsCaptured",nSC);
|
|
nMana=nMana+nN;
|
|
fnSetTeamSouls(oPC,nMana);
|
|
SetLocalInt(oWeapon,"nStoredCR",0);
|
|
SendMessageToPC(oPC,"Soul Harvest transfers "+IntToString(nN)+" souls.");
|
|
} // transfer
|
|
} // transfer soul receptacles
|
|
if (sID==sTeamP)
|
|
{ // same team
|
|
while(oItem!=OBJECT_INVALID)
|
|
{
|
|
if (GetTag(oItem)=="SoulToken")
|
|
{
|
|
DestroyObject(oItem);
|
|
nAdd++;
|
|
}
|
|
oItem=GetNextItemInInventory(oPC);
|
|
}
|
|
if (nAdd>0)
|
|
{
|
|
nSC=nSC+nAdd;
|
|
SetLocalInt(oPC,"nSoulsCaptured",nSC);
|
|
nMana=nMana+nAdd;
|
|
fnSetTeamSouls(oPC,nMana);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVFX,oPC,1.0);
|
|
SetLocalInt(GetModule(),"bHasDepositedASoul"+sID,TRUE);
|
|
}
|
|
if (GetIsPC(oPC)) SendMessageToPC(oPC,"SOUL RECEPTACLE currently stores "+IntToString(nMana)+" souls.");
|
|
nMana=nMana-GetLocalInt(oLeader,"nStartSoul");
|
|
if (GetLocalInt(GetModule(),"nGameType")==1)
|
|
SendMessageToPC(oPC,"This is "+IntToString(nMana)+" of "+IntToString(GetLocalInt(GetModule(),"nMaxSouls"))+" required beyond those you started with to win.");
|
|
if (GetLocalInt(GetModule(),"nGameType")==1&&nMana>=GetLocalInt(GetModule(),"nMaxSouls"))
|
|
{ // winner
|
|
SetLocalObject(GetModule(),"oWinner",oLeader);
|
|
ExecuteScript("rts_end_game",OBJECT_SELF);
|
|
} // winner
|
|
} // same team
|
|
}
|