Activate objectives by name, not number.

This commit is contained in:
Steve 2015-12-18 14:28:44 +00:00
parent 2a5b048253
commit 01894d5150
5 changed files with 12 additions and 14 deletions

View File

@ -62,7 +62,7 @@
"function" : "Waypoint #3", "function" : "Waypoint #3",
"lines" : [ "lines" : [
"ACTIVATE_ENTITIES Pandoran", "ACTIVATE_ENTITIES Pandoran",
"ACTIVATE_OBJECTIVES 1", "ACTIVATE_OBJECTIVES Destroy Pandoran fighters",
"MSG_BOX Alba Control;Patrol A-82, you have hostiles incoming. Identified as 3 Mitikas fighters; Jackals, possibly Pandoran. Engage, but exercise extreme caution." "MSG_BOX Alba Control;Patrol A-82, you have hostiles incoming. Identified as 3 Mitikas fighters; Jackals, possibly Pandoran. Engage, but exercise extreme caution."
] ]
} }

View File

@ -35,7 +35,7 @@
"active" : 0 "active" : 0
}, },
{ {
"description" : "Destroy Intercepting Darts", "description" : "Destroy intercepting Darts",
"targetName" : "Dart", "targetName" : "Dart",
"targetValue" : 7, "targetValue" : 7,
"targetType" : "TT_DESTROY", "targetType" : "TT_DESTROY",
@ -138,7 +138,7 @@
"WAIT 1", "WAIT 1",
"MSG_BOX Alexandria Orbital;Iron Patriots, we're again identifying a handful of crates drifting close to your current position. Please effect pick up.", "MSG_BOX Alexandria Orbital;Iron Patriots, we're again identifying a handful of crates drifting close to your current position. Please effect pick up.",
"ACTIVATE_ENTITIES package", "ACTIVATE_ENTITIES package",
"ACTIVATE_OBJECTIVES 1", "ACTIVATE_OBJECTIVES Retrieve packages",
"MSG_BOX Carr;Got it. Heading to the first one now" "MSG_BOX Carr;Got it. Heading to the first one now"
] ]
}, },
@ -150,7 +150,7 @@
"MSG_BOX Carr;Know anything about the occupant, or affiliation?", "MSG_BOX Carr;Know anything about the occupant, or affiliation?",
"MSG_BOX Alexandria Orbital;Negative, Lieutenant. We'll know more once it's brought in.", "MSG_BOX Alexandria Orbital;Negative, Lieutenant. We'll know more once it's brought in.",
"ACTIVATE_ENTITIES Stranded Dart;Tug", "ACTIVATE_ENTITIES Stranded Dart;Tug",
"ACTIVATE_OBJECTIVES 2;3" "ACTIVATE_OBJECTIVES Bring in Stranded Dart;Do not destroy Stranded Dart"
] ]
}, },
{ {
@ -162,7 +162,7 @@
"ACTIVATE_ENTITIES Extraction Point", "ACTIVATE_ENTITIES Extraction Point",
"WAIT 20", "WAIT 20",
"ACTIVATE_ENTITIES Dart", "ACTIVATE_ENTITIES Dart",
"ACTIVATE_OBJECTIVES 4", "ACTIVATE_OBJECTIVES Destroy intercepting Darts",
"MSG_BOX Wingmate;Dan, we've got hostile vessels inbound. More Darts.", "MSG_BOX Wingmate;Dan, we've got hostile vessels inbound. More Darts.",
"MSG_BOX Carr;Prepare to engage. Protect the asset!" "MSG_BOX Carr;Prepare to engage. Protect the asset!"
] ]

View File

@ -139,7 +139,11 @@
"MSG_BOX Alexandria Orbital;Patrol, we have a major situation developing. A skirmish is taking place between a number of starfighters: Darts, Nymphs, and Fireflies.", "MSG_BOX Alexandria Orbital;Patrol, we have a major situation developing. A skirmish is taking place between a number of starfighters: Darts, Nymphs, and Fireflies.",
"MSG_BOX Carr;Pirates? Insurgents? Nation of Tzac?", "MSG_BOX Carr;Pirates? Insurgents? Nation of Tzac?",
"WAIT_MSG_BOX", "WAIT_MSG_BOX",
"ACTIVATE_OBJECTIVES 1;2;3;4;5", "ACTIVATE_OBJECTIVES Disable Pirate Commander",
"ACTIVATE_OBJECTIVES Disable Tzac Commander",
"ACTIVATE_OBJECTIVES Destroy all other opponents",
"ACTIVATE_OBJECTIVES Do not allow Pirate Commander to be killed",
"ACTIVATE_OBJECTIVES Do not allow Tzac Commander to be killed",
"ACTIVATE_ENTITY_GROUPS skirmishGroup", "ACTIVATE_ENTITY_GROUPS skirmishGroup",
"MSG_BOX Alexandria Orbital;Too early to speculate. We want you to disable and bring in one craft from each side. The rest, you can eliminate.", "MSG_BOX Alexandria Orbital;Too early to speculate. We want you to disable and bring in one craft from each side. The rest, you can eliminate.",
"MSG_BOX Carr;On it." "MSG_BOX Carr;On it."

View File

@ -179,25 +179,19 @@ void failIncompleteObjectives(void)
void activateObjectives(char *objectives) void activateObjectives(char *objectives)
{ {
char *token; char *token;
int i, num;
Objective *o; Objective *o;
token = strtok(objectives, ";"); token = strtok(objectives, ";");
while (token) while (token)
{ {
i = 0;
num = atoi(token);
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next) for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
{ {
if (i == num) if (strcmp(token, o->description) == 0)
{ {
addHudMessage(colors.cyan, "New Objective : %s", o->description); addHudMessage(colors.cyan, "New Objective : %s", o->description);
o->active = 1; o->active = 1;
} }
i++;
} }
token = strtok(NULL, ";"); token = strtok(NULL, ";");

View File

@ -133,7 +133,7 @@ static void executeNextLine(ScriptRunner *runner)
} }
else if (strcmp(command, "ACTIVATE_OBJECTIVES") == 0) else if (strcmp(command, "ACTIVATE_OBJECTIVES") == 0)
{ {
sscanf(line, "%*s %s", strParam[0]); sscanf(line, "%*s %[^\n]", strParam[0]);
activateObjectives(strParam[0]); activateObjectives(strParam[0]);
} }
else if (strcmp(command, "MSG_BOX") == 0) else if (strcmp(command, "MSG_BOX") == 0)