Hazardous Objects

From Worms Knowledge Base

Jump to: navigation, search
(Up to Game logic)
In other languages: English (en) • français (fr) • +/-

The Hazardous Objects in Worms 2, Worms Armageddon and Worms World Party are the Mines and the Oil Drums (or Barrels).

Object Types

There can be four values : no objects, mines only, oil drums only, or both objects.

Object Count

This value only exists in W:A. You can set how many objects can appear, from 1 to 250. The default value is 8. If you want to have zero objects, simply set "no objects" as the type.

Be careful however, if you set the Object Count to 250 (for example), there won't be 250 objects for sure. There must be a certain distance between the objects, and between Worms and objects. So this setting is only a max number.

Not all values from 1 to 250 are represented. The following is a breakdown of possible values:
1-30 (1 by 1), 35-100 (5 by 5), 110-250 (10 by 10).

How is this setting saved in a WSC file?

Old schemes

In WWP and W:A v1 schemes (and W:A v2 old schemes before version 3.6.28.0), only the hazardous object types value is saved, so there will be always 8 objects on the landscape.

The values are: 0x00=No objects, 0x01=Mines, 0x02=Oil Drums, 0x05=Both.

New schemes

In new W:A schemes, there is the setting Object Count. So both Object Types and Count values are stored in the same byte.

Object Types

You have to modulo (%) the value by 4.

  • If you get 0, there are no objects.
  • If you get 1, there are only mines.
  • If you get 2, there are only oil drums.
  • If you get 3, there are both mines and oil drums.

For example

You have the value "79".

79 % 4 = 3 (because 79 / 4 = 19 and the remainder is 3)

So there will be both mines and oil drums in the scheme.

Another example

You have the value "246".

246 % 4 = 2 (because 246 / 4 = 61 and the remainder is 2)

So there will only be oil drums in the scheme.

Object Count

First, you will have to re-use the modulo's result as M.

Then, considering V as the byte's value, do :

N = V - (8 + M)

Then finally, divide N by 4 to get the array's entry (E).

E = N / 4.

Adjust the E value with your array. Meaning for example:

  • You can make an array with a NULL entry as the entry number 0, and you keep the same values for the entries.
  • You can make an array normally, meaning you will have to remove 1 to E.
  • You can make an array with values from 35 to 250 only. If E < 31, E already equals to the value (if E = 5 for example, then C = 5 - considering C is the object count). If E >= 31, then remove 31 to get your array entry and select this entry (for example, 32 - 31 = 1, and 1 is the second entry of the array, 1 => 40 so C = 40).

The array's values are, as we said above:

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250.

For example

We have again the value "79". V = 79.

M = 3 as we saw above.

So:

N = 79 - (8 + 3)
N = 79 - 11
N = 68.

Then let's calculate E:

E = 68 / 4
E = 17.

Then let's see with the 3 methods we suggested for the array:

  • Get the 17th entry of the array. Value of it is 17. C = 17.
  • 17 - 1 = 16. Get the entry number 16 of the array. It contains 17. C = 17.
  • 17 < 31, so simply C = E = 17.

So there will be 17 mines and barrels.

Another example

V = 246.

As we said above, M = 2.

So:

N = 246 - (8 + 2)
N = 246 - 10
N = 236.

Then let's calculate E:

E = 236 / 4
E = 59.

Then let's see with the 3 methods we suggested for the array:

  • Get the 59th entry of the array. Value of it is 250. C = 250.
  • 59 - 1 = 58. Get the entry number 58 of the array. It contains 250. C = 250.
  • 59 > 31, so 59 - 31 = 28. Entry number 28's value is 250. C = 250.

So there will be 250 barrels.

Invalid byte values

These byte values are converted to 1 (8 mines) by the game:

3, 4, 6, 7, 8, 9, 10, 11, 248, 249, 250, 251, 252, 253, 254, 255.

Personal tools