generated from Jaysyn/ModuleTemplate
Initial upload
Initial upload
This commit is contained in:
43
_mod/_module/nss/rts_count_units.nss
Normal file
43
_mod/_module/nss/rts_count_units.nss
Normal file
@@ -0,0 +1,43 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Real Time Strategy - NWN - Count Units
|
||||
//==========================================================================
|
||||
// By Deva Bryson Winblood. 02/26/2003
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void main()
|
||||
{
|
||||
object oMod=GetModule();
|
||||
object oMe=OBJECT_SELF;
|
||||
int nCount=0;
|
||||
int nDigits=1;
|
||||
string sTag=GetTag(oMe);
|
||||
string sPre;
|
||||
string sMain;
|
||||
object oC;
|
||||
string sUnit;
|
||||
int nTeamNum;
|
||||
int nL;
|
||||
int nUnits;
|
||||
int nUnit;
|
||||
if (StringToInt(GetStringRight(sTag,2))>0) nDigits=2;
|
||||
sPre=GetStringLeft(sTag,nDigits);
|
||||
if (GetIsPC(oMe)) sPre=GetLocalString(oMe,"sTeamID");
|
||||
sMain=sPre+"_UnitCount";
|
||||
nTeamNum=GetLocalInt(oMod,sPre+"_num");
|
||||
nUnits=GetLocalInt(oMod,"nTeamU"+IntToString(nTeamNum));
|
||||
nUnit=0;
|
||||
while(nUnit<nUnits&&nUnits!=0)
|
||||
{ // count
|
||||
sUnit=sPre+IntToString(nUnit);
|
||||
nUnit++;
|
||||
nL=0;
|
||||
oC=GetObjectByTag(sUnit,nL);
|
||||
while(oC!=OBJECT_INVALID)
|
||||
{
|
||||
nCount++;
|
||||
nL++;
|
||||
oC=GetObjectByTag(sUnit,nL);
|
||||
}
|
||||
} // count
|
||||
SetLocalInt(oMod,sMain,nCount);
|
||||
}
|
||||
Reference in New Issue
Block a user