61 lines
1.9 KiB
Plaintext
61 lines
1.9 KiB
Plaintext
//////////////////////////////////////////////////////////////////////////////////
|
|
// Real Time Strategy - NWN - Grave Digger
|
|
//================================================================================
|
|
// By Deva Bryson Winblood. 03/11/2003
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
#include "rtsh_multiplay"
|
|
|
|
void fnDig()
|
|
{ // Grave digger
|
|
object oGrave=GetNearestObjectByTag("GRAVE",OBJECT_SELF);
|
|
int nMana=fnGetTeamMana(OBJECT_SELF);
|
|
float fDist=GetDistanceBetween(oGrave,OBJECT_SELF);
|
|
int nUsed=GetLocalInt(oGrave,"nDug");
|
|
object oPC=OBJECT_SELF;
|
|
if (nMana>1)
|
|
{ // enough mana
|
|
if (oGrave!=OBJECT_INVALID)
|
|
{ //!OI
|
|
if (fDist<2.6)
|
|
{ // close enough
|
|
if (nUsed!=TRUE)
|
|
{ // !TRUE
|
|
nMana=nMana-2;
|
|
fnSetTeamMana(oPC,nMana);
|
|
SendMessageToPC(oPC,"You used 2 mana to dig this grave.");
|
|
SetLocalInt(oGrave,"nDug",TRUE);
|
|
oGrave=CreateObject(OBJECT_TYPE_CREATURE,GetName(oGrave),GetLocation(oGrave),TRUE);
|
|
} // !TRUE
|
|
else
|
|
SendMessageToPC(oPC,"This grave has already been dug.");
|
|
} // close enough
|
|
else
|
|
SendMessageToPC(oPC,"You do not see a grave close to you to dig.");
|
|
} //!OI
|
|
else
|
|
SendMessageToPC(OBJECT_SELF,"There does not appear to be a grave you can dig in this area.");
|
|
} // enough mana
|
|
else
|
|
SendMessageToPC(OBJECT_SELF,"This item requires 2 mana to use.");
|
|
} // fnDig()
|
|
|
|
|
|
void main()
|
|
{
|
|
object oPC=GetItemActivator();
|
|
location lLoc=GetItemActivatedTargetLocation();
|
|
string sID=GetLocalString(oPC,"sTeamID");
|
|
if (sID=="UND")
|
|
{ // undead
|
|
if (GetIsNight())
|
|
{ // is night
|
|
AssignCommand(oPC,ActionMoveToLocation(lLoc,TRUE));
|
|
AssignCommand(oPC,ActionDoCommand(fnDig()));
|
|
} // is night
|
|
else
|
|
SendMessageToPC(oPC,"This Item can only be used at night.");
|
|
} // undead
|
|
else
|
|
SendMessageToPC(oPC,"This item is only usable by the UNDEAD team.");
|
|
}
|