diff --git a/scripts/HTN/Trees/Red/ConvoyUnit.xml b/scripts/HTN/Trees/Red/ConvoyUnit.xml index fb5920f86108e540b8451b792acbae3d4754496e..37b982615b120886dd970c89522c793208286182 100644 --- a/scripts/HTN/Trees/Red/ConvoyUnit.xml +++ b/scripts/HTN/Trees/Red/ConvoyUnit.xml @@ -15,7 +15,6 @@ <Code IsFile="false"># create data borg.redNumSetups = dict() - </Code> <Import /> </HTNNode> @@ -118,6 +117,12 @@ _gt_activeNode.putVar("moveReason", params.get(0)) _gt_activeNode.putVar("moveDestination", wps[0]) randSpd = params.get(1) +# check if the point we're moving to is an attack position +attackFlag = "ATTACK" in params.get(2) +if attackFlag: + SendEntityEventDelay("RFC", "GoalTracker_StartAttackMove", [state.getCurrentUnitName()], 1.0) + + borg.redConvoysWaiting[state.getCurrentUnit().getName()].append(info.getMyAssignedName()) CreateNetworkMove( @@ -131,7 +136,7 @@ CreateNetworkMove( "MOVE", borg.delay) borg.delay+=5.0 -printMessage("Starting move: "+str(wps)+" Spd: "+str(randSpd), True) +printMessage("Starting move("+str(attackFlag)+"): "+str(wps)+" Spd: "+str(randSpd), True) ##################################################### # set activity to log diff --git a/scripts/HTN/Trees/Red/RedForceCoordinator.xml b/scripts/HTN/Trees/Red/RedForceCoordinator.xml index 61a220e6ba5a74d858097a68fb6e08fef51fc235..a5fb135c45a2350b6b80f8da31ea5bc817de5ed0 100644 --- a/scripts/HTN/Trees/Red/RedForceCoordinator.xml +++ b/scripts/HTN/Trees/Red/RedForceCoordinator.xml @@ -28,6 +28,11 @@ borg.redEntityActivityOverride=dict() borg.randomMoveStartTime=0 borg.redTimeOnStation=dict() + +# used to hear the attack msg only once +_gt_activeNode.putVar("heardAttackMsg", 0) + + </Code> <Import /> </HTNNode> @@ -358,6 +363,7 @@ if borg.params_activateConvoyThree: goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_CreateConvoy") goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_MoveConvoy") goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_ReclaimConvoy") +goalContainer.getCurrentExecutingStack().addReplanTrigger("GoalTracker_StartAttackMove") </Code> <Import /> </HTNNode> @@ -515,6 +521,24 @@ randSpd = 10.0 + (40.0 * randSpd) SendUnitEventDelay(tu.getName(), "GoalTracker_Assemble", [randSpd], 1) printMessage("Convoy move: "+str(tu.getName())+" NUM DESTS: "+str(numDestinations)+" LIST: "+str(convoyDests), True) +</Code> + <Import /> + </HTNNode> + </HTNNode> + <HTNNode AllowMsg="true" Name="isAttackMove" Type="DEFAULT"> + <Parent>printGoalTrackerEvent</Parent> + <Code IsFile="false"> +if state.getLastTrigger() == "doGoalTracker_StartAttackMove": + _htn_precon_ret=1 +</Code> + <Import /> + <HTNNode AllowMsg="true" Name="startAttackMove" Type="INTERRUPT"> + <Parent>isMoveConvoy</Parent> + <Code IsFile="false">heardBefore = _gt_activeNode.getVar("heardAttackMsg") + +if heardBefore == 0: + printMessage("START ATTACK METHODOLOGY", True) + _gt_activeNode.putVar("heardAttackMsg", 1) </Code> <Import /> </HTNNode> diff --git a/scripts/jump_start.py b/scripts/jump_start.py index 8fd1a9a71b9e3977445ad197ac2eb1abf8c96455..7cda8dedb951f039b790307f9afefec86fdf0c47 100644 --- a/scripts/jump_start.py +++ b/scripts/jump_start.py @@ -30,7 +30,7 @@ entityName = "RFC" ################################################################################################################################################################# # Scenario Parameters ################################################################################################################################################################# -borg.isAttackRun = False +borg.isAttackRun = True 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", ]