diff --git a/scripts/HTN/Trees/Red/ConvoyUnit.xml b/scripts/HTN/Trees/Red/ConvoyUnit.xml index a5e047b18e977ad45691db0aa78e3eabf2d6664a..6d2a93fd4761e7606775b3875fcb37b2d0944230 100644 --- a/scripts/HTN/Trees/Red/ConvoyUnit.xml +++ b/scripts/HTN/Trees/Red/ConvoyUnit.xml @@ -374,10 +374,11 @@ if borg.redNumSetups[state.getCurrentUnitName()] > 1: # check against 1 becau borg.redUnitStatus[state.getCurrentUnitName()] = 0 elif len(borg.redConvoyDest[state.getCurrentUnit().getName()])==0: - # no more destinations go home - SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_ConvoyReturn", [], rn) + # no more destinations go home if it's not an attack run printMessage("Convoy pack up complete: "+str(state.getCurrentUnitName()), True) - borg.delay=0 + if not borg.isAttackRun: + SendEntityEventDelay(info.getMyAssignedName(), "GoalTracker_ConvoyReturn", [], rn) + borg.delay=0 else: # go to next destination diff --git a/scripts/HTN/Trees/Red/RedForceCoordinator.xml b/scripts/HTN/Trees/Red/RedForceCoordinator.xml index 9748a365cc45b888b1f65906046f32e6124e4617..61a220e6ba5a74d858097a68fb6e08fef51fc235 100644 --- a/scripts/HTN/Trees/Red/RedForceCoordinator.xml +++ b/scripts/HTN/Trees/Red/RedForceCoordinator.xml @@ -23,7 +23,8 @@ borg.redUnitActivity=dict() borg.redUnitActivityTime=dict() borg.redEntityActivityOverride=dict() -borg.redDestinations=["PATH_DEST1", "PATH_DEST2","PATH_DEST3","PATH_DEST4","PATH_DEST5","PATH_DEST6","PATH_DEST7","PATH_DEST8","PATH_DEST9"] +#borg.redDestinations=["PATH_DEST1", "PATH_DEST2","PATH_DEST3","PATH_DEST4","PATH_DEST5","PATH_DEST6","PATH_DEST7","PATH_DEST8","PATH_DEST9"] + borg.randomMoveStartTime=0 borg.redTimeOnStation=dict() @@ -458,6 +459,7 @@ formName = borg.redFormsByUnit[unit.getName()] <Parent>isMoveConvoy</Parent> <Code IsFile="false">import cxxi.model.knowledge.group.holders.NewUnitHolder as NewUnitHolder from HTNBehaviors import SendUnitEventDelay +from HTNBehaviors import GetRandomInt import cxxi.model.behavior.PythonUtilities as PythonUtilities # get the unit name (first trigger param) @@ -492,6 +494,13 @@ for n in range(numDestinations): borg.redDestinations.append(destName) convoyDests.append(destName) +# if it's an attack run (set in jump start) then the final destination will be a random +# attack position +if borg.isAttackRun: + attackIndex = int(GetRandomInt(0, len(borg.redAttackDestinations)-1)) + attackPoint = borg.redAttackDestinations[attackIndex] + convoyDests.append(attackPoint) + # set the convoys destination and formation # in the borg #borg.redConvoyDest[tu.getName()] = destName @@ -505,7 +514,7 @@ randSpd = 10.0 + (40.0 * randSpd) # start the assembly SendUnitEventDelay(tu.getName(), "GoalTracker_Assemble", [randSpd], 1) -printMessage("Convoy move: "+str(tu.getName())+" NUM DESTS: "+str(numDestinations), True) +printMessage("Convoy move: "+str(tu.getName())+" NUM DESTS: "+str(numDestinations)+" LIST: "+str(convoyDests), True) </Code> <Import /> </HTNNode> diff --git a/scripts/jump_start.py b/scripts/jump_start.py index 8db614815b5377baa0f89ecb63074ad60790ebd8..8fd1a9a71b9e3977445ad197ac2eb1abf8c96455 100644 --- a/scripts/jump_start.py +++ b/scripts/jump_start.py @@ -30,6 +30,11 @@ entityName = "RFC" ################################################################################################################################################################# # Scenario Parameters ################################################################################################################################################################# +borg.isAttackRun = False +borg.redDestinations=["TRAINING01", "TRAINING02", "TRAINING03", "TRAINING04", "TRAINING05", "TRAINING06", "TRAINING07", "TRAINING08", "TRAINING09", "TRAINING10", "TRAINING11", "TRAINING12", ] +borg.redAttackDestinations=["ATTACK01", "ATTACK02", "ATTACK03", "ATTACK04", "ATTACK05", "ATTACK06", "ATTACK07", "ATTACK08", "ATTACK09", "ATTACK10", "ATTACK11", "ATTACK12", ] + + borg.params_redNumSetups = 1 borg.params_redSetupTimeMin = 10 borg.params_redSetupTimeVar = 10