Distance Globals

This global mod adds the following global BHAV

0x080B - "Distance - Modified for room/level" (Target OID, Temp#): Measures the distance in tiles between the Stack Object and the Target OID returning the measurement in Temp[Temp#].

The base distance is the same as the 0x000B primitive. If the objects are in different rooms, 25 is added. If the objects are on different levels, 100 is added for each level. Two objects 28 tiles apart according to primitive 0x000B but two floors apart (and hence in different rooms) will have a distance of 263 (28 base + 25 for different room + 200 for 2 levels apart). This makes it much easier to "find the nearest ..." type code, as the global automatically allows for different rooms and levels.


Installation

Copy this mod into your downloads folder, if you split my mods into a seperate sub-folder, I suggest you place it there as a number of my mods need it.


Installation - SimPe

If you use SimPe to delve into my mods, you can get SimPe to recognise the new global BHAVs as follows.

  • Start SimPe
  • From the "Extra" menu, select "Preferences..."
  • Click on the "File Table" in the left-hand ribbon
  • Click on "add" (left most item of the "add" "delete" "change" triple)
  • Click the "Load File" button
  • Browse to the sub-folder you copied the WH_DistanceGlobals.package file to and select the package
  • Click the "Open" button
  • Click the "OK" button
  • There will be a new entry at the top of the "Advanced Settings" area that refers to the WH_DistanceGlobals.package file, check the box to its left
  • Click the "Reload" button
  • Click the "OK" button

Conflicts

The mod adds global BHAVs starting at 0x080B as listed above, so will conflict with any other mod that does the same.

No known conflicts


Credits

  • The developers of SimPE.

Files