generated from Jaysyn/ModuleTemplate
Initial upload
Initial upload
This commit is contained in:
65
_mod/_module/nss/rts_default2.nss
Normal file
65
_mod/_module/nss/rts_default2.nss
Normal file
@@ -0,0 +1,65 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Real Time Strategy - NWN - OnPerception modified event for units
|
||||
//========================================================================
|
||||
// By Deva Bryson Winblood. 03/10/2003
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void fnDeconsolidate(object oMe);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
object oMe=OBJECT_SELF;
|
||||
int nS=GetLocalInt(oMe,"nMState");
|
||||
int nParm=GetLocalInt(oMe,"nParm");
|
||||
object oDest;
|
||||
object oPerceived=GetLastPerceived();
|
||||
if (GetIsEnemy(oPerceived)==TRUE&&GetLocalInt(oMe,"bConsolidationLeader")==TRUE)
|
||||
fnDeconsolidate(oMe);
|
||||
if (GetLocalInt(oMe,"bChampion"))
|
||||
{ // champion
|
||||
if (GetLocalInt(oMe,"bPassive"))
|
||||
{ // passive
|
||||
if (GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oMe,1,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_ENEMY)))
|
||||
{ // enemy
|
||||
SetLocalInt(oMe,"nRun",TRUE);
|
||||
oDest=GetLocalObject(oMe,"oPathDest");
|
||||
if (GetIsObjectValid(oDest))
|
||||
{ // move
|
||||
AssignCommand(oMe,ClearAllActions(TRUE));
|
||||
AssignCommand(oMe,ActionMoveToObject(oDest,TRUE,3.0));
|
||||
} // move
|
||||
return;
|
||||
} // enemy
|
||||
} // passive
|
||||
} // champion
|
||||
if (nS!=12&&nS!=1&&nS!=13&&GetIsEnemy(oPerceived)==TRUE) // 1 = Harvest, 12 = Scout, 13 = Flee Sunlight
|
||||
{
|
||||
if (nS!=17)
|
||||
{ // not raid
|
||||
ExecuteScript("nw_c2_default2",OBJECT_SELF);
|
||||
} // not raid
|
||||
else if (nParm==1&&GetLocalInt(oMe,"nSState")>3)
|
||||
{ // attack raid and at base
|
||||
ExecuteScript("nw_c2_default2",OBJECT_SELF);
|
||||
} // attack raid and at base
|
||||
}
|
||||
}
|
||||
|
||||
void fnDeconsolidate(object oMe)
|
||||
{ // deconsolidate
|
||||
int nC=1;
|
||||
object oF=GetLocalObject(oMe,"oConsolidated"+IntToString(nC));
|
||||
while(oF!=OBJECT_INVALID)
|
||||
{ // bring consolidated forces back out
|
||||
SetCommandable(TRUE,oF);
|
||||
SetAILevel(oF,AI_LEVEL_NORMAL);
|
||||
DelayCommand(0.1,AssignCommand(oF,ClearAllActions()));
|
||||
DelayCommand(0.2,AssignCommand(oF,JumpToObject(oMe)));
|
||||
SetLocalInt(oF,"nSState",0);
|
||||
DeleteLocalObject(oMe,"oConsolidated"+IntToString(nC));
|
||||
nC++;
|
||||
oF=GetLocalObject(oMe,"oConsolidated"+IntToString(nC));
|
||||
} // bring consolidated forces back out
|
||||
DeleteLocalInt(oMe,"bConsolidationLeader");
|
||||
} // fnDeconsolidate()
|
||||
Reference in New Issue
Block a user