generated from Jaysyn/ModuleTemplate
Merged redundant hak files
Merged redundant hak files. Moved hak scripts into module. Updated gitignore. Full Compile. Added release folder & archive.
This commit is contained in:
60
_mod/_module/nss/rtsa_headerb.nss
Normal file
60
_mod/_module/nss/rtsa_headerb.nss
Normal file
@@ -0,0 +1,60 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// REAL TIME STRATEGY ADVENTURE - Kit
|
||||
// FILE: rtsa_headerb
|
||||
// NAME: Header for build menu
|
||||
// SCRIPTED BY: Deva Bryson Winblood
|
||||
// DATE: 4/1/2003
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int fnIsOkayToBuild(int nUN)
|
||||
{ // is it okay to builg unit # nUN?
|
||||
object oPC=GetPCSpeaker();
|
||||
object oMod=GetModule();
|
||||
string sID=GetLocalString(oPC,"sTeamID");
|
||||
string sUID=sID+IntToString(nUN);
|
||||
int nMR=GetLocalInt(oMod,"nRTSResNum");
|
||||
int nN;
|
||||
string sW;
|
||||
object oH;
|
||||
if(GetLocalInt(oMod,"n"+sID+"Units")<nUN) return FALSE; // unit not available
|
||||
if(GetLocalInt(oMod,"n"+sUID+"NB")==TRUE) return FALSE; // no build
|
||||
nN=1;
|
||||
while(nN<=nMR)
|
||||
{ // check resources
|
||||
sW=GetLocalString(oMod,"sRTSResID"+IntToString(nN));
|
||||
if (GetLocalInt(oPC,"nRes"+IntToString(nN)+"Store")<GetLocalInt(oMod,"n"+sUID+"RC"+IntToString(nN))) return FALSE;
|
||||
nN++;
|
||||
} // check resources
|
||||
if(GetGold(oPC)<GetLocalInt(oMod,"n"+sUID+"RC0")) return FALSE; // gold
|
||||
sW=GetLocalString(oMod,"s"+sUID+"UR");
|
||||
if (GetStringLength(sW)>1)
|
||||
{ // unit required
|
||||
oH=GetObjectByTag(sW);
|
||||
if (oH==OBJECT_INVALID) return FALSE; // unit not in play
|
||||
else if (GetLocalString(oH,"sTeamID")!=sID) return FALSE; // unit not on your team
|
||||
} // unit required
|
||||
nN=GetLocalInt(oMod,"n"+sUID+"MUT");
|
||||
if (GetLocalInt(oMod,"n"+sUID+"CUT")==nN&&nN>0) return FALSE; // maximum units of this type reached
|
||||
sW=GetLocalString(oMod,"s"+sUID+"COVAR");
|
||||
if (GetStringLength(sW)>1)
|
||||
{ // control variable
|
||||
nN=GetLocalInt(oPC,"nVar"+sW)-GetLocalInt(oPC,"nVarU"+sW);
|
||||
if (nN<GetLocalInt(oMod,"n"+sUID+"COVAR")) return FALSE; // not enough control
|
||||
} // control variable
|
||||
sW=GetLocalString(oMod,"s"+sUID+"IT");
|
||||
if (GetStringLength(sW)>1&&GetItemPossessedBy(oPC,sW)==OBJECT_INVALID) return FALSE; // not carrying required item
|
||||
sW=GetLocalString(oMod,"s"+sUID+"SPR");
|
||||
if (GetStringLength(sW)>1)
|
||||
{ // special item variable
|
||||
oH=GetItemPossessedBy(oPC,sW);
|
||||
if (oH!=OBJECT_INVALID)
|
||||
{ // !OI
|
||||
sW=GetLocalString(oMod,"s"+sUID+"SPRV");
|
||||
nN=GetLocalInt(oH,sW);
|
||||
if (nN<GetLocalInt(oMod,"n"+sUID+"SPR")) return FALSE; // item variable less than required
|
||||
} // !OI
|
||||
else
|
||||
return FALSE;
|
||||
} // special item variable
|
||||
return TRUE;
|
||||
} // fnIsOkayToBuild()
|
||||
Reference in New Issue
Block a user