monster A,B,C,D position attack priority depending on NSEW

Discuss Chaos Strikes Back for Windows and Linux, an unofficial port of Chaos Strikes Back to PC by Paul Stevens, as well as CSBuild, an associated dungeon editor.

Moderator: Zyx

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

monster A,B,C,D position attack priority depending on NSEW

Post by Adamo »

graphics.dat item 562:

http://dmweb.free.fr/?q=node/1398

Code: Select all

  i8  Byte586[8][4];// something to do with monsters hitting you from a          
                   //direction your not facing and how to reposition your players
It doesn`t have anything related to repositioning the players. In fact, every character (except actual party leader) changes his position if attacked from side or back, no matter if the attack was succeeded or not.

These bytes (from offset1244 to offset1275) might be filled with 0,1,2 or 3, wchich are responsible for the priority of sub-cells choosen by a monster to attack a character.
This doesn`t works for those monsters, wchich has "attack every position" flag set. In that case, the monsters attacks random subcells.

I will use that notation:

Code: Select all

 L   R    - L- left monster, R- right monster

 A | B    - A and B - 1st and 2nd char in a party
------
 D | C    - C and D - 3rd and 4th char in a party
So you can see that monster L stays right in front of a character occupying subcell A and monster R stays right in front of a character occupying subcell B.

In original code, there are four eight-byte words:

01321023
12032103
32012301
03123021

wchich you can read as:

Code: Select all

-----------------------------------
|     LEFT       |     RIGHT      |
|     monster    |     monster    |
|     attack     |     attack     |
|     priority   |     priority   |
| I   II  III IV | I   II  III IV |
-----------------------------------
| 0   1   2   3  | 1   0   2   3  | <= for party facing NORTH:
|                |                |      0=A 1=B 2=C 3=D
| 1   2   0   3  | 2   1   0   3  | <= for party facing EAST:
|                |                |      0=D 1=A 2=B 3=C
| 3   2   0   1  | 2   1   0   3  | <= for party facing SOUTH:
|                |                |      0=C 1=D 2=A 3=B
| 0   3   1   2  | 3   0   2   1  | <= for party facing WEST:
|                |                |      0=B 1=C 2=D 3=A
-----------------------------------
wchich means:
If party is facing NORTH, then LEFT monster attack priority is subcell A (priority I). If this subcell is empty (for example you have one character in party occupying subcell B, or character is dead), then a monster tries to attack character on subcell B (priority II). Then subcell C (priority III), and then subcell D (priority IV). RIGHT monster do the same, but in different order (BACD).

Second line is for a case when a party is facing EAST, but the current values for each line will be different (because each line represents different world quarter!). Third line is for party facing SOUTH and fourth for party facing WEST.

Originally, the code is set for monsters L and R to attack every possible subcell, but it can be chaged depending on the party facing set. For example, if we change the second line to 00003333, that would mean that when party facing WEST, the LEFT monster will attack only subcell D (priority order set to DDDD) and RIGHT monster will attack only subcell A (priority order AAAA). So if you have only two characters in a party, you could place them in subcells B and C so the monsters wouldn`t attack at all (the party would be safe in front of four skeletons when facing WEST).

For example, the code can be rearranged in a way that RIGHT monster doesn`t attack subcell B when party facing SOUTH. Or LEFT monster attacks subcell C only when party facing NORTH. Or all monsters attacks subcells C and D first (if they are empty, tries to attack A and B- so if you have a full party, they will attack back characters first). Or when a party is facing NORTH, monsters attacks only subcell A, when SOUTH- only B. Or when party is facing EAST, LEFT monster tries to attack C first, then AD (but doesn`t attack B at all), and when party is facing WEST, RIGHT monster attacks D first, then BC (but doesn`t attack A at all). Or whenever party is facing SOUTH, monsters only attack subcell A (so characters occupying BCD would be safe). Etc, etc. It`s up to the designer.
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
Post Reply

Return to “Chaos Strikes Back for Windows & Linux (CSBWin) / CSBuild”