I put the code lines from personality_default_scripts.cfg here:
Code: Select all
// Sarge
CreateRecruitType("personality.default.recruit.sarge")
{
Type("army.unit.sarge", 1);
}
// Sarge script
CreateScript("personality.default.defense.sarge")
{
InitialState("Recruit");
CreateVarString("%.types", "");
CreateVarFloat("%.range", 100.0);
CreateVarInteger("%.acceptInsufficient", 0);
CreateVarInteger("%.cluster.target");
CreateVarString("%.base");
CreateVarString("%.tag", "");
State("Recruit")
{
Action("Recruit", "TypeBase")
{
Config("%.types");
Location()
{
Base("Base", "%.base");
}
Range("%.range");
AcceptInsufficient("%.acceptInsufficient");
Base("%.base");
}
Conditions()
{
Condition("ObjectiveCondition")
{
Condition("Timer")
{
Time(10); // Wait 10 seconds. If we don't have a sarge then abort.
}
Transition()
{
GoToState("HaveSarge");
}
}
}
}
// Do I have a Sarge?
State("HaveSarge")
{
Settings()
{
Setting("Tag")
{
Tag("%.tag");
Append(1);
}
}
Conditions()
{
Condition("Count")
{
Amount(0);
Operator(">");
Transition()
{
GoToState("DefendBase");
}
}
Condition("Count")
{
Amount(0);
Operator("<=");
Transition()
{
GoToState("Abort");
}
}
}
}
//State("Find")
//{
//Action("ApplyRule")
//{
//Rule("FindUndefendedCluster");
//Var("%.cluster.target");
//DangerRatio("%.danger");
//}
//Conditions()
//{
//Condition("Count")
//{
//Amount(0);
//Operator("<=");
//Transition()
//{
//GoToState("Abort");
//}
//}
//Condition("HitPoints")
//{
//Operator("<");
//Amount(500);
//Transition()
//{
//GoToState("ReturnToBase");
//}
//}
//Status("Completed")
//{
//GoToState("Move");
//}
//Status("Failed")
//{
//GoToState("DefendBase");
//}
//}
//}
State("DefendBase")
{
Action("ApplyRule")
{
Rule("FindProtectBase");
ArmourClass("structure");
Var("%.cluster.target");
Base("%.base");
}
Conditions()
{
Condition("Count")
{
Amount(0);
Operator("<=");
Transition()
{
GoToState("Abort");
}
}
Condition("HitPoints")
{
Operator("<");
Amount(199);
Transition()
{
GoToState("Run");
}
}
Status("Completed")
{
GoToState("Move");
}
Status("Failed")
{
GoToState("ReturnToBase");
}
}
}
State("Move")
{
Action("Move")
{
Attack(1);
Location()
{
Base("VarCluster", "%.cluster.target");
}
}
Conditions()
{
Condition("Count")
{
Amount(0);
Operator("<=");
Transition()
{
GoToState("Abort");
}
}
Condition("HitPoints")
{
Operator("<");
Amount(199);
Transition()
{
GoToState("Run");
}
}
Condition("ObjectiveCondition")
{
Condition("Timer")
{
Time(30);
}
Transition()
{
GoToState("DefendBase");
}
}
Status("Completed")
{
GoToState("DefendBase");
}
}
}
State("Run")
{
Action("Move")
{
Attack(0);
Location()
{
Base("Base", "%.base");
}
}
Conditions()
{
Condition("Count")
{
Amount(0);
Operator("<=");
Transition()
{
GoToState("Abort");
}
}
Status("Completed")
{
GoToState("Wait");
}
}
}
State("ReturnToBase")
{
Action("Move")
{
Attack(1);
Location()
{
Base("Base", "%.base");
}
}
Conditions()
{
Condition("Count")
{
Amount(0);
Operator("<=");
Transition()
{
GoToState("Abort");
}
}
Condition("HitPoints")
{
Operator("<");
Amount(199);
Transition()
{
GoToState("Run");
}
}
Status("Completed")
{
GoToState("Wait");
}
}
}
State("Wait")
{
Conditions()
{
Condition("Count")
{
Amount(0);
Operator("<=");
Transition()
{
GoToState("Abort");
}
}
Condition("HitPoints")
{
Operator(">=");
Amount(900);
Transition()
{
GoToState("DefendBase");
}
}
}
}
State("Abort")
{
Action("Discharge");
Conditions()
{
Status("Completed")
{
End();
}
}
}
}
// Sarge heal
CreateScript("personality.default.sargeheal")
{
InitialState("Start");
CreateVarString("%.tag", "");
State("Start")
{
Conditions()
{
Condition("ObjectiveCondition")
{
Condition("Timer")
{
Time(180);
}
Transition()
{
GoToState("Move");
}
}
}
}
State("Move")
{
Action("FollowTag")
{
Attack(1);
Tag("%.tag");
}
Conditions()
{
Status("Completed")
{
GoToState("Move");
}
Status("Failed")
{
GoToState("Move");
}
}
}
}