Page 1 of 3

Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 20 May 2018, 17:29
by EmpireEarthManiac
Does anyone know why groups won't move to where I want them to and why it won't set objectives to completed or unlocked?

Code: Select all

////////////////////////////////////////////////////////////
// Tet Offensive.ies
//
// Author: EmpireEarthManiac
////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////
// All rules are for the WORLD entity.
////////////////////////////////////////////////////////////
RULES FOR WORLD

SCENARIO
//Follow the South Vietnamese
OBJECTIVE Obj_tetoffensive_1
name = "Follow the South Vietnamese"
desc = "Follow the South Vietnamese troops to the area where they claim to be a new Viet Cong camp."
type = kScenarioObjectiveType_Primary
starthidden = 0
END_OBJECTIVE

//Destroy the Viet Cong camp
OBJECTIVE Obj_tetoffensive_2
name = "Destroy the Viet Cong camp"
desc = "Attack and destroy the new found Viet Cong camp."
type = kScenarioObjectiveType_Primary
starthidden = 1
END_OBJECTIVE

//Locate & destroy the Viet Cong airbase
OBJECTIVE Obj_tetoffensive_3
name = "Locate and destroy the Viet Cong airbase"
desc = "Locate and destroy the Viet Cong airbase before they can deploy their fighters."
type = kScenarioObjectiveType_Secondary
starthidden = 1
END_OBJECTIVE

//Rally the other South Vietnamese troops
OBJECTIVE Obj_tetoffensive_4
name = "Rally the other South Vietnamese troops"
desc = "Rally the other South Vietnamese troops before the North Vietnamese and Viet Cong attack."
type = kScenarioObjectiveType_Primary
starthidden = 1
END_OBJECTIVE

//Regroup with the Marines
OBJECTIVE Obj_tetoffensive_5
name = "Regroup with the Marines"
desc = "Regroup with the Marines near the mountains just in front of your home base."
type = kScenarioObjectiveType_Primary
starthidden = 1
targetlocation1x= 98
targetlocation1y= 399
END_OBJECTIVE

//Launch a counterattack
OBJECTIVE Obj_tetoffensive_6
name = "Launch a counterattack"
desc = "Launch a counterattack with the Marines and South Vietnamese troops against the North Vietnamese and Viet Cong forces."
type = kScenarioObjectiveType_Primary
starthidden = 1
targetlocation1x= 121
targetlocation1y= 347
END_OBJECTIVE

//Push to Viet Cong stronghold
OBJECTIVE Obj_tetoffensive_7
name = "Push to Viet Cong stronghold"
desc = "Push the North Vietnamese and Viet Cong forces back to the Viet Cong stronghold."
type = kScenarioObjectiveType_Secondary
starthidden = 1
targetlocation1x= 499
targetlocation1y= 8
END_OBJECTIVE

//Fight to the death
OBJECTIVE Obj_tetoffensive_8
name = "Fight to the death"
desc = "Kill all the North Vietnamese and Viet Cong troops. You lose if all of your troops die."
type = kScenarioObjectiveType_Lose
starthidden = 0
END_OBJECTIVE

name = "Tet Offensive"
brief = "The Tet Offensive was an offensive launched by the North Vietnamese and Viet Cong forces against the Americans."
//victory = "You are victorious!"
//loss = "You have lost."
hints = "Try to rally the Marines and South Vietnamese troops for a counter attack against the North Vietnamese and Viet Cong."
historicalInfo = "In 1968, the North Vietnamese and Viet Cong forces launched a campaign of surprise attacks against the South Vietnamese and American forces.\n\nThey attacked military and civilian command and control centers throughout South Vietnam."
//description = "Hold off against the North Vietnamese and Viet Cong forces."
//date = "1968"
END_SCENARIO

////////////////////////////////////////////////////////////
// DEFINITIONS
////////////////////////////////////////////////////////////
DEFINITIONS

// OBJECTIVES
constant string OBJ_FOLLOW_SOUTH_VIETNAMESE
constant string OBJ_DESTROY_CAMP
constant string OBJ_DESTROY_AIRBASE
constant string OBJ_RALLY_SOUTH_VIETNAMESE
constant string OBJ_REGROUP_MARINES
constant string OBJ_LAUNCH_COUNTERATTACK
constant string OBJ_PUSH_STRONGHOLD
constant string OBJ_LOSE

//PLAYERS
constant int HUMAN_PLAYER
constant int SVIETNAMESE_PLAYER
constant int VIETCONG_PLAYER
constant int NVIETNAMESE_PLAYER
constant int CHINESE_PLAYER
constant int MARINES_PLAYER

// AREAS
constant string AREA_ARMY_CAMP
constant string AREA_MARINE_CAMP
constant string AREA_VC_CAMP
constant string AREA_VILLAGE_ONE
constant string AREA_VILLAGE_TWO
constant string AREA_VILLAGE_THREE
constant string AREA_MOUNTAINS_REGROUP
constant string AREA_COUNTERATTACK
constant string AREA_VC_STRONGHOLD
constant string AREA_VC_AIRBASE
constant string AREA_JUNGLE_REGROUP

//GROUPS
constant string GROUP_USARMY
constant string GROUP_MARINES
constant string GROUP_MARINEPATROL
constant string GROUP_MARINEPATROL2
constant string GROUP_VCFORCE
constant string GROUP_NVFORCE
constant string GROUP_VCTROOPS
constant string GROUP_VCTROOPS2
constant string GROUP_VCTROOPS3
constant string GROUP_VCTROOPS4
constant string GROUP_VCTROOPS5
constant string GROUP_VCTROOPS6
constant string GROUP_VCTROOPS7
constant string GROUP_NVTROOPS
constant string GROUP_NVTROOPS2
constant string GROUP_NVTROOPS3
constant string GROUP_NVTROOPS4
constant string GROUP_NVTROOPS5
constant string GROUP_NVTROOPS6
constant string GROUP_SVTROOPS
constant string GROUP_SVTROOPS2
constant string GROUP_SVTROOPS3
constant string GROUP_SVTROOPS4
constant string GROUP_VCCAMPBUILDINGS
constant string GROUP_AIRBASEBUILDINGS
constant string GROUP_VCAIRCRAFT

// VARIABLES
float fDelay

END_DEFINITIONS

////////////////////////////////////////////////////////////
// INITIALIZATION
////////////////////////////////////////////////////////////
INITIALIZATION

//OBJECTIVES
OBJ_FOLLOW_SOUTH_VIETNAMESE = "Obj_tetoffensive_1";
OBJ_DESTROY_CAMP = "Obj_tetoffensive_2";
OBJ_DESTROY_AIRBASE = "Obj_tetoffensive_3";
OBJ_RALLY_SOUTH_VIETNAMESE = "Obj_tetoffensive_4";
OBJ_REGROUP_MARINES = "Obj_tetoffensive_5";
OBJ_LAUNCH_COUNTERATTACK = "Obj_tetoffensive_6";
OBJ_PUSH_STRONGHOLD = "Obj_tetoffensive_7";
OBJ_LOSE = "Obj_tetoffensive_8";

//PLAYERS
HUMAN_PLAYER = 1;
SVIETNAMESE_PLAYER = 2;
VIETCONG_PLAYER = 3;
NVIETNAMESE_PLAYER = 4;
CHINESE_PLAYER = 5;
MARINES_PLAYER = 6;

// Areas
AREA_ARMY_CAMP = "areaArmyCamp";
AREA_MARINE_CAMP = "areaMarineCamp";
AREA_VC_CAMP = "areaVCCamp";
AREA_VILLAGE_ONE = "areaVillageOne";
AREA_VILLAGE_TWO = "areaVillageTwo";
AREA_VILLAGE_THREE = "areaVillageThree";
AREA_MOUNTAINS_REGROUP = "areaMountainRegroup";
AREA_COUNTERATTACK = "areaCounterAttack";
AREA_VC_STRONGHOLD = "areaVCStronghold";
AREA_VC_AIRBASE = "areaVCAirbase";
AREA_JUNGLE_REGROUP = "areaJungleRegroup";

// GROUPS
GROUP_USARMY = "groupUSArmy";
GROUP_MARINES = "groupMarines";
GROUP_MARINEPATROL = "groupMarinePatrolOne";
GROUP_MARINEPATROL2 = "groupMarinePatrolTwo";
GROUP_VCFORCE = "groupMainVCForce";
GROUP_NVFORCE = "groupNVMainForce";
GROUP_VCTROOPS = "groupVCTroops";
GROUP_VCTROOPS2 = "groupVCTroopsTwo";
GROUP_VCTROOPS3 = "groupVCTroopsThree";
GROUP_VCTROOPS4 = "groupVCTroopsFour";
GROUP_VCTROOPS5 = "groupVCTroopsFive";
GROUP_VCTROOPS6 = "groupVCTroopsSix";
GROUP_VCTROOPS7 = "groupVCTroopsSeven";
GROUP_NVTROOPS = "groupNVTroops";
GROUP_NVTROOPS2 = "groupNVTroopsTwo";
GROUP_NVTROOPS3 = "groupNVTroopsThree";
GROUP_NVTROOPS4 = "groupNVTroopsFour";
GROUP_NVTROOPS5 = "groupNVTroopsFive";
GROUP_NVTROOPS6 = "groupNVTroopsSix";
GROUP_SVTROOPS = "groupSVTroops";
GROUP_SVTROOPS2 = "groupSVTroopsTwo";
GROUP_SVTROOPS3 = "groupSVTroopsThree";
GROUP_SVTROOPS4 = "groupSVTroopsFour";
GROUP_VCCAMPBUILDINGS = "groupVCCampBuildings";
GROUP_AIRBASEBUILDINGS = "groupAirbaseBuildings";
GROUP_VCAIRCRAFT = "groupVCAirCraft";

SetMaxEpochUI(13); //this is only for display
SetTechEnabled(HUMAN_PLAYER, "Main14", false);
//NO GOING TO EPOCH 14
SetTechEnabled(SVIETNAMESE_PLAYER, "Main6", false);
//NO GOING TO EPOCH 6
SetTechEnabled(VIETCONG_PLAYER, "Main14", false);
//NO GOING TO EPOCH 14
SetTechEnabled(NVIETNAMESE_PLAYER, "Main14", false);
//NO GOING TO EPOCH 14
SetTechEnabled(CHINESE_PLAYER, "Main14", false);
//NO GOING TO EPOCH 14
SetTechEnabled(MARINES_PLAYER, "Main14", false);
//NO GOING TO EPOCH 14

// Disable some of the buidlings
SetTechEnabled(SVIETNAMESE_PLAYER, "WonderFarEast_01", false);
SetTechEnabled(SVIETNAMESE_PLAYER, "CityCenter", false);
SetTechEnabled(SVIETNAMESE_PLAYER, "Wall", false);
SetTechEnabled(SVIETNAMESE_PLAYER, "Barracks", false);
SetTechEnabled(SVIETNAMESE_PLAYER, "Stable", false);
SetTechEnabled(SVIETNAMESE_PLAYER, "University", false);
SetTechEnabled(SVIETNAMESE_PLAYER, "Temple", false);
SetTechEnabled(SVIETNAMESE_PLAYER, "Market", false);

SetGroupSpecialForces("groupSVTroops", true);
SetGroupSpecialForces("groupSVTroopsTwo", true);
SetGroupSpecialForces("groupSVTroopsThree", true);
SetGroupSpecialForces("groupSVTroopsFour", true);
SetGroupSpecialForces("groupNVMainForce", true);
SetGroupSpecialForces("groupNVTroops", true);
SetGroupSpecialForces("groupNVTroopsTwo", true);
SetGroupSpecialForces("groupNVTroopsThree", true);
SetGroupSpecialForces("groupNVTroopsFour", true);
SetGroupSpecialForces("groupNVTroopsFive", true);
SetGroupSpecialForces("groupNVTroopsSix", true);
SetGroupSpecialForces("groupVCTroops", true);
SetGroupSpecialForces("groupVCTroopsTwo", true);
SetGroupSpecialForces("groupVCTroopsThree", true);
SetGroupSpecialForces("groupVCTroopsFour", true);
SetGroupSpecialForces("groupVCTroopsFive", true);
SetGroupSpecialForces("groupVCTroopsSix", true);
SetGroupSpecialForces("groupVCTroopsSeven", true);
SetGroupSpecialForces("groupMainVCForce", true);
SetGroupSpecialForces("groupMarines", true);
SetGroupSpecialForces("groupMarinePatrolOne", true);
SetGroupSpecialForces("groupMarinePatrolTwo", true);

// Diplomacy
LockDiplomaticState(1, 2);
LockDiplomaticState(1, 3);
LockDiplomaticState(1, 4);
LockDiplomaticState(1, 5);
LockDiplomaticState(1, 6);
LockDiplomaticState(2, 3);
LockDiplomaticState(2, 4);
LockDiplomaticState(2, 5);
LockDiplomaticState(2, 6);
LockDiplomaticState(3, 4);
LockDiplomaticState(3, 5);
LockDiplomaticState(3, 6);
LockDiplomaticState(4, 5);
LockDiplomaticState(4, 6);
LockDiplomaticState(5, 6);

fDelay = 1;

END_INITIALIZATION

//
////////////////////////////////////////////////////////////
// //RUNS AFTER CINEMATIC, BEFORE OBJECTIVES
OPEN
//
////////////////////////////////////////////////////////////
ACTION PreScenInfoPanelHook
SCRIPT WORLD
//nothing here
END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// Briefing
////////////////////////////////////////////////////////////
RULE ruleBriefing ONESHOT
if (true)
then actionBriefing
END_RULE

ACTION actionBriefing
SCRIPT WORLD
DoDelay(2);

STEP
CreateDialogBox( "tx_tetoffensive_blank", "tx_tetoffensive_briefing", true);

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// ArmyCamp
////////////////////////////////////////////////////////////
RULE ruleArmyCamp ONESHOT
if(NumUnitsInGroup("groupSVTroops") >= 1)
then actionArmyCamp
END_RULE

ACTION actionArmyCamp
SCRIPT WORLD
DoDelay(fDelay);

STEP
CreateDialogBox( "tx_tetoffensive_blank", "tx_tetoffensive_armycamp", false);

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// FollowSouthVietnamese
////////////////////////////////////////////////////////////
RULE ruleFollowSouthVietnamese ONESHOT
if(AnyoneFromGroupIsInArea("groupSVTroops", "areaArmyCamp"))
then actionFollowSouthVietnamese
END_RULE

ACTION actionFollowSouthVietnamese
SCRIPT WORLD
DoDelay(fDelay);

STEP
CreateDialogBox( "tx_tetoffensive_blank", "tx_tetoffensive_followsvietnamese", false);
STEP
CarveShroudArea(1, "areaVCCamp");
STEP
ObjectiveSetTargetArea("Obj_tetoffensive_1", "areaVCCamp");
STEP
SelectGroup("groupSVTroops");
MoveSelection(147, 501);

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// VCCamp
////////////////////////////////////////////////////////////
RULE ruleVCCamp ONESHOT
if(PlayerHasLOSToAnyoneInGroup(1, "groupVCCampBuildings")
then actionVCCamp
END_RULE

ACTION actionVCCamp
SCRIPT WORLD
DoDelay(fDelay);

STEP
SetObjectiveCompleted("Obj_tetoffensive_1");
STEP
SetObjectiveUnlocked("Obj_tetoffensive_2");
STEP
CreateDialogBox( "tx_tetoffensive_blank", tx_tetoffensive_destroyvccamp", false);
STEP
CreateDialogBox( "tx_tetoffensive_blank", tx_tetoffensive_destroyvcairbase", false);
STEP
SetObjectiveUnlocked("Obj_tetoffensive_3");
SetObjectiveUnlocked("Obj_tetoffensive_4");
STEP
CarveShroudArea(1, "areaVCAirbase");
STEP
CreateDialogBox( "tx_tetoffensive_blank", tx_tetoffensive_rallysvietnamese", false);
STEP
SelectGroup("groupNVMainForce");
MoveSelection(458, 315);
STEP
SelectGroup("groupVCTroopsFour");
MoveSelection(458, 315);
STEP
SelectGroup("groupVCTroopsFive");
MoveSelection(458, 315);
STEP
SelectGroup("groupNVTroopsTwo");
MoveSelection(458, 315);
STEP
SelectGroup("groupMarinePatrolOne");
MoveSelection(289, 160);
STEP
SelectGroup("groupMarinePatrolTwo");
MoveSelection(289, 160);

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// CampDestroyed
////////////////////////////////////////////////////////////
RULE ruleCampDestroyed
if(NumUnitesInGroup("groupVCCampBuidlings") == 0)
then actionCampDestroyed
END_RULE

ACTION actionCampDestroyed
SCRIPT WORLD
DoDelay(fDelay);

STEP
SetObjectiveCompleted("Obj_tetoffensive_2");

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// AirbaseDestroyed
////////////////////////////////////////////////////////////
RULE ruleAirbaseDestroyed
if(NumUnitsInGroup("groupAirbaseBuildings") == 0)
then actionAirbaseDestroyed
END_RULE

ACTION actionAirbaseDestroyed
SCRIPT WORLD
DoDelay(fDelay);

STEP
SetObjectiveCompleted("Obj_tetoffensive_3");

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// AirAttack
////////////////////////////////////////////////////////////
RULE ruleAirAttack
if(NumUnitsInGroup("groupVCAirCraft") >= 1)
then actionAirAttack
END_RULE

ACTION actionAirAttack
SCRIPT WORLD
DoDelay(fDelay);

STEP
SelectGroup("groupVCAirCraft");
MoveSelection(21, 499);

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// RallySouthVietnamese
////////////////////////////////////////////////////////////
RULE ruleRallySouthVietnamese
if(AnyoneFromGroupIsInArea("groupUSArmy", "areaVillageOne")
|| (AnyoneFromGroupIsInArea("groupUSArmy", "areaVillageTwo")
|| (AnyoneFromGroupIsInArea("groupUSArmy", "areaVillageThree"))
then actionRallySouthVietnamese
END_RULE

ACTION actionRallySouthVietnamese
SCRIPT WORLD
DoDelay(fDelay);

STEP
SelectGroup("groupSVTroops");
MoveSelection(21, 499);
STEP
SelectGroup("groupSVTroopsTwo");
MoveSelection(21, 499);
STEP
SelectGroup("groupSVTroopsThree");
MoveSelection(21, 499);
STEP
SelectGroup("groupSVTroopsFour");
MoveSelection(21, 499);
STEP
CreateDialogBox( "tx_tetoffensive_blank", "tx_tetoffensive_regroupmarines");
STEP
SetObjectiveCompleted("Obj_tetoffensive_4");
STEP
SetObjectiveUnlocked("Obj_tetoffensive_5");
STEP
AddGroupToGroup("groupNVTroops", "groupNVMainForce");
AddGroupToGroup("groupNVTroopsTwo", "groupNVMainForce");
AddGroupToGroup("groupNVTroopsThree", "groupNVMainForce");
AddGroupToGroup("groupNVTroopsFour", "groupNVMainForce");
AddGroupToGroup("groupNVTroopsFive", "groupNVMainForce");
AddGroupToGroup("groupNVTroopsSix", "groupNVMainForce");
AddGroupToGroup("groupVCTroops", "groupMainVCForce");
AddGroupToGroup("groupVCTroopsTwo", "groupMainVCForce");
AddGroupToGroup("groupVCTroopsThree", "groupMainVCForce");
AddGroupToGroup("groupVCTroopsFour", "groupMainVCForce");
AddGroupToGroup("groupVCTroopsFive", "groupMainVCForce");
AddGroupToGroup("groupVCTroopsSix", "groupMainVCForce");
AddGroupToGroup("groupVCTroopsSeven", "groupMainVCForce");
AddGroupToGroup("groupVCAircraft", "groupMainVCForce");
AddGroupToGroup("groupMarinePatrolOne", "groupMarines");
AddGroupToGroup("groupMarinePatrolTwo", "groupMaines");
STEP
SelectGroup("groupMainVCForce");
MoveSelection(289, 160);
STEP
SelectGroup("groupNVMainForce");
MoveSelection(289, 160);

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// RegroupMarines
////////////////////////////////////////////////////////////
RULE ruleRegroupMarines
if(AnyoneFromGroupIsInArea("groupMarines", "areaMountainRegroup")
|| (AnyoneFromGroupIsInArea("groupUSArmy", "areaMountainRegroup"))
then actionRegroupMarines
END_RULE

ACTION actionRegroupMarines
SCRIPT WORLD
DoDelay(fDelay);


STEP
ObjectiveSetTargetArea("Obj_tetoffensive_5", "areaMountainRegroup");
STEP
SelectGroup("groupSVTroops");
MoveSelection(98, 399);
STEP
SelectGroup("groupSVTroopsTwo");
MoveSelection(98, 399);
STEP
SelectGroup("groupSVTroopsThree");
MoveSelection(98, 399);
STEP
SelectGroup("groupSVTroopsFour");
MoveSelection(98, 399);
STEP
SelectGroup("groupVCTotalForce")
MoveSelection(121, 347);
STEP
SelectGroup("groupNVTotalForce");
MoveSelection(121, 347);
STEP
CreateDialogBox( "tx_tetoffensive_blank", "tx_tetoffensive_counterattack");
STEP
SetObjectiveCompleted("Obj_tetoffensive_5");
STEP
SetObjectiveUnlocked("Obj_tetoffensive_6");
SetObjectiveUnlocked("Obj_tetoffensive_7");

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// LaunchCounterattack
////////////////////////////////////////////////////////////
RULE ruleLaunchCounterattack
if(AnyoneFromGroupIsInArea("groupVCTotalForce", "areaCounterAttack")
|| (AnyoneFromGroupIsInArea("groupNVTotalForce", "areaCounterAttack"))
then actionLaunchCounterAttack
END_RULE

ACTION actionLaunchCounterAttack
SCRIPT WORLD
DoDelay(fDelay);

STEP
ObjectiveSetTargetArea("Obj_tetoffensive_6", "areaCounterAttack");
STEP
SelectGroup("groupSVTroops");
MoveSelection(121, 347);
STEP
SelectGroup("groupSVTroopsTwo");
MoveSelection(121, 347);
STEP
SelectGroup("groupSVTroopsThree");
MoveSelection(121, 347);
STEP
SelectGroup("groupSVTroopsFour");
MoveSelection(121, 347);
STEP
SelectGroup("groupMarines");
MoveSelection(121, 347);
STEP
CreateDialogBox( "tx_tetoffensive_blank", "tx_tetoffensive_pushvcstronghold");

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// Update
////////////////////////////////////////////////////////////
RULE ruleUpdate
if(AnyoneFromGroupIsInArea("groupUSArmy", "areaCounterAttack"))
then actionUpdate
END_RULE

ACTION actionUpdate
SCRIPT WORLD
DoDelay(fDelay);

STEP
SetObjectiveCompleted("Obj_tetoffensive_6");
STEP
AddGroupToGroup("groupMarines", "groupUSArmy");
AddGroupToGroup("groupSVTroops", "groupUSArmy");
AddGroupToGroup("groupSVTroopsTwo", "groupUSArmy");
AddGroupToGroup("groupSVTroopsThree", "groupUSArmy");
AddGroupToGroup("groupSVTroopsFour", "groupUSArmy");
STEP
SetGroupSpecialForces("groupSVTroops", false);
SetGroupSpecialForces("groupSVTroopsTwo", false);
SetGroupSpecialForces("groupSVTroopsThree", false);
SetGroupSpecialForces("groupSVTroopsFour", false);
SetGroupSpecialForces("groupNVMainForce", false);
SetGroupSpecialForces("groupNVTroops", false);
SetGroupSpecialForces("groupNVTroopsTwo", false);
SetGroupSpecialForces("groupNVTroopsThree", false);
SetGroupSpecialForces("groupNVTroopsFour", false);
SetGroupSpecialForces("groupNVTroopsFive", false);
SetGroupSpecialForces("groupNVTroopsSix", false);
SetGroupSpecialForces("groupVCTroops", false);
SetGroupSpecialForces("groupVCTroopsTwo", false);
SetGroupSpecialForces("groupVCTroopsThree", false);
SetGroupSpecialForces("groupVCTroopsFour", false);
SetGroupSpecialForces("groupVCTroopsFive", false);
SetGroupSpecialForces("groupVCTroopsSix", false);
SetGroupSpecialForces("groupVCTroopsSeven", false);
SetGroupSpecialForces("groupMainVCForce", false);
SetGroupSpecialForces("groupMarines", false);
SetGroupSpecialForces("groupMarinePatrolOne", false);
SetGroupSpecialForces("groupMarinePatrolTwo", false);
STEP
CreateDialogBox( "tx_tetoffensive_blank", "tx_tetoffensive_win");

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// UpdateTwo
////////////////////////////////////////////////////////////
RULE ruleUpdateTwo
if(AnyoneFromGroupIsInArea("groupUSArmy", "areaVCStronghold"))
then actionUpdateTwo
END_RULE

ACTION actionUpdateTwo
SCRIPT WORLD
DoDelay(fDelay);

STEP
SetObjectiveCompleted("Obj_tetoffensive_7");

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// Win
////////////////////////////////////////////////////////////
RULE ruleWin
if(NumUnitsInGroup("groupUSArmy") >= 1)
&& (NumUnitsInGroup("groupMainVCForce") == 0)
&& (NumUnitsInGroup("groupNVMainForce") == 0)
&& (AllPrimaryObjectivesCompleted())
then actionWin
END_RULE

ACTION actionWin
SCRIPT WORLD
DoDelay(5);

STEP
WinScenario();

END_SCRIPT
END_ACTION

////////////////////////////////////////////////////////////
// EOF
////////////////////////////////////////////////////////////

Re: Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 20 May 2018, 17:53
by Dr.MonaLisa
I would use SelectGroupForPlayer and MoveSelectionToArea instead, example from my script:

Code: Select all

SelectGroupForPlayer("AllEnemyPlanes", 10);
MoveSelectionToArea("AFODissapear");
ClearSelection();
ClearSelection() is important and should be used after every Select() action is completed.

From what I remember, the "move to location" function was problematic, so I always created small areas in the map editor, and then used them with the script. The named area was "AFODissapear" in this case.

All objectives which you want to unlock should be unlocked before actions, in Initialization section.

Re: Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 22 May 2018, 03:00
by EmpireEarthManiac
Leader wrote: 20 May 2018, 17:53 I would use SelectGroupForPlayer and MoveSelectionToArea instead, example from my script:

Code: Select all

SelectGroupForPlayer("AllEnemyPlanes", 10);
MoveSelectionToArea("AFODissapear");
ClearSelection();
ClearSelection() is important and should be used after every Select() action is completed.

From what I remember, the "move to location" function was problematic, so I always created small areas in the map editor, and then used them with the script. The named area was "AFODissapear" in this case.

All objectives which you want to unlock should be unlocked before actions, in Initialization section.
They still won't move :/

Added after 2 minutes 10 seconds:
Leader wrote: 20 May 2018, 17:53 I would use SelectGroupForPlayer and MoveSelectionToArea instead, example from my script:

Code: Select all

SelectGroupForPlayer("AllEnemyPlanes", 10);
MoveSelectionToArea("AFODissapear");
ClearSelection();
ClearSelection() is important and should be used after every Select() action is completed.

From what I remember, the "move to location" function was problematic, so I always created small areas in the map editor, and then used them with the script. The named area was "AFODissapear" in this case.

All objectives which you want to unlock should be unlocked before actions, in Initialization section.
Also, how do I unlock objectives in the initialization section?

Added after 15 minutes 29 seconds:
@Leader when I remove the SetGroupSpecialForces();
they move but they do not go to the areas I tell them to move to.

Re: Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 22 May 2018, 05:07
by Dr.MonaLisa
Also, how do I unlock objectives in the initialization section?
By putting function calls in INITIALIZATION section, instead of RULEs (so they are executed instantly on game start). In your case it's simply before "END_INITIALIZATION".

You can download the sample .ies scripts, for example here:
viewtopic.php?p=23673#p23673

After that you can see the correct functions for units move and others.

Re: Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 23 May 2018, 00:35
by EmpireEarthManiac
Leader wrote: 22 May 2018, 05:07
Also, how do I unlock objectives in the initialization section?
By putting function calls in INITIALIZATION section, instead of RULEs (so they are executed instantly on game start). In your case it's simply before "END_INITIALIZATION".

You can download the sample .ies scripts, for example here:
viewtopic.php?p=23673#p23673

After that you can see the correct functions for units move and others.
Is it a problem that in the map editor under the map tab it won't let me click area list?

Added after 8 minutes 2 seconds:
@Leader I am also having trouble following the examples so could you make a quick example using my script for what you mean by function calls in the INITIALIZATION section?

Re: Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 23 May 2018, 05:53
by Dr.MonaLisa
EmpireEarthManiac wrote: 23 May 2018, 00:35

Added after 8 minutes 2 seconds:
@Leader I am also having trouble following the examples so could you make a quick example using my script for what you mean by function calls in the INITIALIZATION section?
Just change for example:

Code: Select all

LockDiplomaticState(5, 6);

fDelay = 1;

END_INITIALIZATION
to:

Code: Select all

LockDiplomaticState(5, 6);

fDelay = 1;

SetObjectiveUnlocked("Obj_tetoffensive_2");

END_INITIALIZATION
SetObjectiveUnlocked() is a function call itself.
Is it a problem that in the map editor under the map tab it won't let me click area list?
Shouldn't be a problem. Just use "Tools -> Area Placement" and "View -> Areas".

Also have you solved problem with moving units?

Re: Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 23 May 2018, 13:39
by EmpireEarthManiac
Leader wrote: 23 May 2018, 05:53
EmpireEarthManiac wrote: 23 May 2018, 00:35

Added after 8 minutes 2 seconds:
@Leader I am also having trouble following the examples so could you make a quick example using my script for what you mean by function calls in the INITIALIZATION section?
Just change for example:

Code: Select all

LockDiplomaticState(5, 6);

fDelay = 1;

END_INITIALIZATION
to:

Code: Select all

LockDiplomaticState(5, 6);

fDelay = 1;

SetObjectiveUnlocked("Obj_tetoffensive_2");

END_INITIALIZATION
SetObjectiveUnlocked() is a function call itself.
Is it a problem that in the map editor under the map tab it won't let me click area list?
Shouldn't be a problem. Just use "Tools -> Area Placement" and "View -> Areas".

Also have you solved problem with moving units?
Not yet, still working on the movement problem

Re: Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 23 May 2018, 13:44
by Dr.MonaLisa
Did you check if this ONESHOT rule is actually executed?
You can do this by adding:

Code: Select all

PrintMessage("Movement Test Should Move Now!!!");
PrintMessage("Movement Test Should Move Now!!!");
PrintMessage("Movement Test Should Move Now!!!");
PrintMessage("Movement Test Should Move Now!!!");
And observe if those messages are displayed in game.

Re: Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 23 May 2018, 13:59
by EmpireEarthManiac
Leader wrote: 23 May 2018, 13:44 Did you check if this ONESHOT rule is actually executed?
You can do this by adding:

Code: Select all

PrintMessage("Movement Test Should Move Now!!!");
PrintMessage("Movement Test Should Move Now!!!");
PrintMessage("Movement Test Should Move Now!!!");
PrintMessage("Movement Test Should Move Now!!!");
And observe if those messages are displayed in game.
Will try that, also for the function calls in the INITALIZATION section it unlocks all the objectives at the beginning, but I want it to unlock them and set them completed as the scenario goes on

Added after 7 minutes 33 seconds:
I did not see the movement test message anywhere in game

Added after 1 minute 8 seconds:
Leader wrote: 23 May 2018, 13:44 Did you check if this ONESHOT rule is actually executed?
You can do this by adding:

Code: Select all

PrintMessage("Movement Test Should Move Now!!!");
PrintMessage("Movement Test Should Move Now!!!");
PrintMessage("Movement Test Should Move Now!!!");
PrintMessage("Movement Test Should Move Now!!!");
And observe if those messages are displayed in game.
Did not see the movement test message anywhere in game, and I want it to unlock objectives and set them completed as the scenario goes on not right when it starts.

Re: Why won't groups move when I want them to and why won't it set objectives to completed and unlocked?

Posted: 23 May 2018, 14:05
by Dr.MonaLisa
It means that your ONESHOT rule is not being executed at all, so everything you put in RULE/ACTION doesn't work (including those text messages, UnlockObjectives and Movement functions).

Please paste your RULE and ACTION where Unlock/Move functions are called.