Temple of the Past trigger bug discussion

(Note: the actual question is in the 3rd part, sorry for the long build up)

Introduction

As you may know, an algorithm in the map Temple of the Past is bugged.
In Campaign Mission / ======= GAMEPLAY ======= / AI / Attack Waves A / Attack Wave A 20 mins there is the following code:

    ------- Setup Drop Location Array
    Variable -Set DropLocationTotal = 4
    Variable -Set DropLocations[1] = Drop Attack Location 01
    Variable -Set DropLocations[2] = Drop Attack Location 02
    Variable -Set DropLocations[3] = Drop Attack Location 03
    Variable -Set DropLocations[4] = Drop Attack Location 04
    ------- Shuffle Order
    General -Repeat (Actions) 3 times
        Actions
            Variable -Set DropLocationIter = (Random integer between 1 and (DropLocationTotal - 1))
            ------- Comment
            Variable -Set DropLocationTemp = DropLocations[DropLocationTotal]
            Variable -Set DropLocations[DropLocationTotal] = DropLocations[DropLocationIter]
            Variable -Set DropLocations[DropLocationIter] = DropLocations[DropLocationTotal]

Because " DropLocationTemp" receive a value, but that value is never used, the algorithms is clearly incorrect.
But then, there may not be “one right fix”, we would have to make sure of the intent of the devs to decide.

Proposals

Thus here are 2 possibles fixes I thought of:

1.

    ------- Setup Drop Location Array
    Variable -Set DropLocationTotal = 4
    Variable -Set DropLocations[1] = Drop Attack Location 01
    Variable -Set DropLocations[2] = Drop Attack Location 02
    Variable -Set DropLocations[3] = Drop Attack Location 03
    Variable -Set DropLocations[4] = Drop Attack Location 04
    ------- Shuffle Order
    General -Repeat (Actions) 3 times
        Actions
            Variable -Set DropLocationIter = (Random integer between 1 and (DropLocationTotal - 1))
            ------- Comment
            Variable -Set DropLocationTemp = DropLocations[DropLocationTotal]
            Variable -Set DropLocations[DropLocationTotal] = DropLocations[DropLocationIter]
            Variable -Set DropLocations[DropLocationIter] = DropLocations[DropLocationTemp]

This code swap around the locations, seems the most logical fix.
Features:

  • The north-west of the temple is now a valid drop location
  • Each drop location is used exactly once

2.

    ------- Setup Drop Location Array
    Variable -Set DropLocationTotal = 4
    Variable -Set DropLocations[1] = Drop Attack Location 01
    Variable -Set DropLocations[2] = Drop Attack Location 02
    Variable -Set DropLocations[3] = Drop Attack Location 03
    Variable -Set DropLocations[4] = Drop Attack Location 04
    ------- Shuffle Order
    General -Repeat (Actions) 3 times
        Actions
            Variable -Set DropLocations[(Random integer between 1 and (DropLocationTotal))] = DropLocations[(Random integer between 1 and (DropLocationTotal))]

This code preserve the ability for a drop location to be overwritten like the original.
Features:

  • The north-west of the temple is now a valid drop location
  • A drop location may be used once, multiple times, or not at all

Questions

  1. Which fix do you prefer?
  2. Which fix do you think correspond to what Blizzard wanted to do? (If neither, what are you thinking of?)

Can you explain better what the bug is, what the current behaviour is, what the behaviour would be with your 2 different fixes?

Entirely pointless to change… but if I had to choose then definitely “once in each location”… why? Because the average player will benefit from it.

Having the drop be random and repeatable is best practice but then again would likely cause a lot more trouble (especially for Swarmy). So for the sake of sanity, despite preference I’d say no to proposal 2 lol.

1 Like

Current code behavior:

  • North-west is an invalid drop location as it get overwritten by the first time the “repeat” is executed.
  • One of the drop location (the 3rd to be picked by the random value) will be used twice as it overwrite the last one

edit: I realize an alternative to 1. is possible, where using “DropLocationTotal” instead of “DropLocationTotal - 1”.
This would give a (low) chance for each location to be played in order (the RNG would need to draw 4 for 3 times in a row, but it’s still “a chance”)

1 Like