Permalink
Browse files

BLADERUNNER: Cleanup of Mutants scripts

  • Loading branch information...
peterkohaut committed Feb 6, 2019
1 parent c99d3ea commit b3b6f6eaa36ef8651d3a7192f07223699b7055a9
@@ -1066,8 +1066,8 @@ enum Flags {
// 626 is never used
kFlagNR01McCoyIsDrugged = 627,
// 628 is never used
kFlagUnpaseGenWalkers = 629,

kFlagUnpauseGenWalkers = 629,
kFlagMutantsPaused = 630,
kFlagRatWalkingAround = 631,
kFlagNR01DektoraFall = 632,
kFlagNR11DektoraBurning = 633,
@@ -42,65 +42,63 @@ void AIScriptMutant1::Initialize() {
}

bool AIScriptMutant1::Update() {
if (Global_Variable_Query(kVariableChapter) == 5 && Actor_Query_Goal_Number(kActorMutant1) != 590) {
if (Actor_Query_Which_Set_In(kActorMutant1) != Player_Query_Current_Set()) {
Actor_Set_Goal_Number(kActorMutant1, 590);
}

return false;
}
if (Global_Variable_Query(kVariableChapter) == 4) {
switch (Actor_Query_Goal_Number(kActorMutant1)) {
case 400:
if (!Game_Flag_Query(kFlagMutantsActive)
&& Game_Flag_Query(kFlagUG06Chapter4Started)
) {
Actor_Set_Goal_Number(kActorMutant1, 401);
Actor_Set_Goal_Number(kActorMutant2, 401);
Actor_Set_Goal_Number(kActorMutant3, 401);
Actor_Set_Targetable(kActorMutant1, true);
Actor_Set_Targetable(kActorMutant2, true);
Actor_Set_Targetable(kActorMutant3, true);
Game_Flag_Set(kFlagMutantsActive);
}
break;

if (Global_Variable_Query(kVariableChapter) != 4) {
return false;
}
case 401:
if (Actor_Query_Which_Set_In(kActorMutant1) == Player_Query_Current_Set()
&& (Actor_Query_Friendliness_To_Other(kActorMutant1, kActorMcCoy) < 30
|| Actor_Query_Combat_Aggressiveness(kActorMutant1) >= 60
)
) {
Actor_Set_Goal_Number(kActorMutant1, 410);
}
break;

switch (Actor_Query_Goal_Number(kActorMutant1)) {
case 400:
if (!Game_Flag_Query(kFlagMutantsActive)
&& Game_Flag_Query(kFlagUG06Chapter4Started)
) {
Actor_Set_Goal_Number(kActorMutant1, 401);
Actor_Set_Goal_Number(kActorMutant2, 401);
Actor_Set_Goal_Number(kActorMutant3, 401);
Actor_Set_Targetable(kActorMutant1, 1);
Actor_Set_Targetable(kActorMutant2, 1);
Actor_Set_Targetable(kActorMutant3, 1);
Game_Flag_Set(kFlagMutantsActive);
}
break;
case 404:
if (!Game_Flag_Query(kFlagMutantsPaused)) {
Actor_Set_Goal_Number(kActorMutant1, 403);
}
break;

case 401:
if (Actor_Query_Which_Set_In(kActorMutant1) == Player_Query_Current_Set()
&& (Actor_Query_Friendliness_To_Other(kActorMutant1, kActorMcCoy) < 30
|| Actor_Query_Combat_Aggressiveness(kActorMutant1) >= 60
)
) {
Actor_Set_Goal_Number(kActorMutant1, 410);
}
break;
case 410:
if (Actor_Query_Which_Set_In(kActorMutant1) != Player_Query_Current_Set()) {
Non_Player_Actor_Combat_Mode_Off(kActorMutant1);
Actor_Set_Goal_Number(kActorMutant1, 403);
}
break;

case 404:
if (!Game_Flag_Query(630)) {
Actor_Set_Goal_Number(kActorMutant1, 403);
case 599:
if (Actor_Query_Which_Set_In(kActorMutant1) != Player_Query_Current_Set()) {
Actor_Set_Goal_Number(kActorMutant1, 411);
}
break;
}
break;

case 410:
if (Actor_Query_Which_Set_In(kActorMutant1) != Player_Query_Current_Set()) {
Non_Player_Actor_Combat_Mode_Off(kActorMutant1);
Actor_Set_Goal_Number(kActorMutant1, 403);
if (Game_Flag_Query(kFlagMutantsPaused)
&& Actor_Query_Goal_Number(kActorMutant1) != 599
) {
Actor_Set_Goal_Number(kActorMutant1, 404);
}
break;

case 599:
} else if (Global_Variable_Query(kVariableChapter) == 5
&& Actor_Query_Goal_Number(kActorMutant1) != 590
) {
if (Actor_Query_Which_Set_In(kActorMutant1) != Player_Query_Current_Set()) {
Actor_Set_Goal_Number(kActorMutant1, 411);
Actor_Set_Goal_Number(kActorMutant1, 590);
}
break;
}

if (Game_Flag_Query(630) == 1 && Actor_Query_Goal_Number(kActorMutant1) != 599) {
Actor_Set_Goal_Number(kActorMutant1, 404);
}

return false;
@@ -111,8 +109,9 @@ void AIScriptMutant1::TimerExpired(int timer) {
}

void AIScriptMutant1::CompletedMovementTrack() {
if (Actor_Query_Goal_Number(kActorMutant1) == 401)
if (Actor_Query_Goal_Number(kActorMutant1) == 401) {
Actor_Set_Goal_Number(kActorMutant1, 403);
}
}

void AIScriptMutant1::ReceivedClue(int clueId, int fromActorId) {
@@ -136,31 +135,36 @@ void AIScriptMutant1::OtherAgentExitedThisScene(int otherActorId) {
}

void AIScriptMutant1::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
if (Actor_Query_Which_Set_In(kActorMutant1) == Player_Query_Current_Set() && Actor_Query_Goal_Number(kActorMutant1) != 599) {
if (otherActorId != kActorMcCoy) {
if (otherActorId > 72 || (otherActorId != kActorFreeSlotA && otherActorId != kActorMutant2 && otherActorId != kActorMutant3)) {
Actor_Modify_Combat_Aggressiveness(70, -10);
if (Actor_Query_Which_Set_In(kActorMutant1) == Player_Query_Current_Set()
&& Actor_Query_Goal_Number(kActorMutant1) != 599
) {
if (otherActorId == kActorMcCoy) {
if (combatMode) {
Actor_Modify_Combat_Aggressiveness(kActorMutant1, 10);
} else {
Actor_Modify_Combat_Aggressiveness(70, 10);
Actor_Modify_Combat_Aggressiveness(kActorMutant1, -10);
}
} else if (combatMode) {
Actor_Modify_Combat_Aggressiveness(70, 10);
} else if (otherActorId == kActorFreeSlotA
|| otherActorId == kActorMutant2
|| otherActorId == kActorMutant3
) {
Actor_Modify_Combat_Aggressiveness(kActorMutant1, 10);
} else {
Actor_Modify_Combat_Aggressiveness(70, -10);
Actor_Modify_Combat_Aggressiveness(kActorMutant1, -10);
}
}
}

void AIScriptMutant1::ShotAtAndMissed() {
if (Actor_Query_Goal_Number(kActorMutant1) != 410) {
Actor_Modify_Combat_Aggressiveness(70, 10);
Actor_Modify_Combat_Aggressiveness(kActorMutant1, 10);
Actor_Modify_Friendliness_To_Other(kActorMutant1, kActorMcCoy, -10);
}
}

bool AIScriptMutant1::ShotAtAndHit() {
if (Actor_Query_Goal_Number(kActorMutant1) != 410) {
Actor_Modify_Combat_Aggressiveness(70, 15);
Actor_Modify_Combat_Aggressiveness(kActorMutant1, 15);
Actor_Modify_Friendliness_To_Other(kActorMutant1, kActorMcCoy, -15);
}

@@ -189,7 +193,7 @@ bool AIScriptMutant1::GoalChanged(int currentGoalNumber, int newGoalNumber) {
return true;

case 401:
Actor_Set_Targetable(kActorMutant1, 1);
Actor_Set_Targetable(kActorMutant1, true);
AI_Movement_Track_Flush(kActorMutant1);
AI_Movement_Track_Append(kActorMutant1, 39, 0);

@@ -317,7 +321,7 @@ bool AIScriptMutant1::GoalChanged(int currentGoalNumber, int newGoalNumber) {
return true;

case 403:
Actor_Set_Targetable(kActorMutant1, 0);
Actor_Set_Targetable(kActorMutant1, false);
Actor_Set_Goal_Number(kActorMutant1, 401);
return true;

@@ -46,22 +46,18 @@ void AIScriptMutant2::Initialize() {
bool AIScriptMutant2::Update() {
if (Global_Variable_Query(kVariableChapter) == 4) {
switch (Actor_Query_Goal_Number(kActorMutant2)) {
case 599:
if (Actor_Query_Which_Set_In(kActorMutant2) != Player_Query_Current_Set()) {
Actor_Set_Goal_Number(kActorMutant2, 403);
}
break;

case 401:
if (Actor_Query_Which_Set_In(kActorMutant2) == Player_Query_Current_Set()
&& (Actor_Query_Friendliness_To_Other(kActorMutant2, kActorMcCoy) < 20
|| Actor_Query_Combat_Aggressiveness(kActorMutant2) >= 60)) {
&& (Actor_Query_Friendliness_To_Other(kActorMutant2, kActorMcCoy) < 20
|| Actor_Query_Combat_Aggressiveness(kActorMutant2) >= 60
)
) {
Actor_Set_Goal_Number(kActorMutant2, 410);
}
break;

case 404:
if (!Game_Flag_Query(630)) {
if (!Game_Flag_Query(kFlagMutantsPaused)) {
Actor_Set_Goal_Number(kActorMutant2, 403);
}
break;
@@ -72,12 +68,22 @@ bool AIScriptMutant2::Update() {
Actor_Set_Goal_Number(kActorMutant2, 403);
}
break;

case 599:
if (Actor_Query_Which_Set_In(kActorMutant2) != Player_Query_Current_Set()) {
Actor_Set_Goal_Number(kActorMutant2, 403);
}
break;
}

if (Game_Flag_Query(630) == 1 && Actor_Query_Goal_Number(kActorMutant2) != 599) {
if (Game_Flag_Query(kFlagMutantsPaused)
&& Actor_Query_Goal_Number(kActorMutant2) != 599
) {
Actor_Set_Goal_Number(kActorMutant2, 404);
}
} else if (Global_Variable_Query(kVariableChapter) == 5 && Actor_Query_Goal_Number(kActorMutant2) != 590) {
} else if (Global_Variable_Query(kVariableChapter) == 5
&& Actor_Query_Goal_Number(kActorMutant2) != 590
) {
if (Actor_Query_Which_Set_In(kActorMutant2) != Player_Query_Current_Set()) {
Actor_Set_Goal_Number(kActorMutant2, 590);
}
@@ -116,17 +122,22 @@ void AIScriptMutant2::OtherAgentExitedThisScene(int otherActorId) {
}

void AIScriptMutant2::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
if (Actor_Query_Which_Set_In(kActorMutant2) == Player_Query_Current_Set() && Actor_Query_Goal_Number(kActorMutant2) != 599) {
if (otherActorId != kActorMcCoy) {
if (otherActorId > 72 || (otherActorId != kActorFreeSlotA && otherActorId != kActorMutant1 && otherActorId != kActorMutant3)) {
Actor_Modify_Combat_Aggressiveness(kActorMutant2, -10);
if (Actor_Query_Which_Set_In(kActorMutant2) == Player_Query_Current_Set()
&& Actor_Query_Goal_Number(kActorMutant2) != 599
) {
if (otherActorId == kActorMcCoy) {
if (combatMode) {
Actor_Modify_Combat_Aggressiveness(kActorMutant2, 10);
} else {
Actor_Modify_Combat_Aggressiveness(kActorMutant2, 5);
Actor_Modify_Combat_Aggressiveness(kActorMutant2, -10);
}
} else if (combatMode) {
Actor_Modify_Combat_Aggressiveness(kActorMutant2, -10);
} else if (otherActorId == kActorFreeSlotA
|| otherActorId == kActorMutant1
|| otherActorId == kActorMutant3
) {
Actor_Modify_Combat_Aggressiveness(kActorMutant2, 5);
} else {
Actor_Modify_Combat_Aggressiveness(kActorMutant2, 10);
Actor_Modify_Combat_Aggressiveness(kActorMutant2, -10);
}
}
}
@@ -169,7 +180,7 @@ bool AIScriptMutant2::GoalChanged(int currentGoalNumber, int newGoalNumber) {
return true;

case 401:
Actor_Set_Targetable(kActorMutant2, 1);
Actor_Set_Targetable(kActorMutant2, true);
AI_Movement_Track_Flush(kActorMutant2);
AI_Movement_Track_Append(kActorMutant2, 39, 0);

@@ -292,7 +303,7 @@ bool AIScriptMutant2::GoalChanged(int currentGoalNumber, int newGoalNumber) {
return true;

case 403:
Actor_Set_Targetable(kActorMutant2, 0);
Actor_Set_Targetable(kActorMutant2, false);
Actor_Set_Goal_Number(kActorMutant2, 401);
return true;

Oops, something went wrong.

0 comments on commit b3b6f6e

Please sign in to comment.