In the current ACK release, creatures using distance weapons do not follow the range restrictions set on their weapons. If a creature is using a weapon that has its range set to 3, it will still shoot at the player from 8 squares away.

This edit fixes this issue and forces creatures to observe the range restrictions.

THE EDIT: In O_PLAY2.PAS around line 1180, add the code line marked with "***":

Code: Select all

```
if not fight then begin
writelog(199,'creature is moving');
xmotion:=0;ymotion:=0;
if xsc>5 then xmotion:=-1;
if xsc<5 then xmotion:=1;
if ysc>4 then ymotion:=-1;
if ysc<4 then ymotion:=1;
if (longisbest) and (foundrange<3000) then
begin;xmotion:=-xmotion;ymotion:=-ymotion;end;
if (ymotion<>0) and (xmotion<>0) then
if random(2)=1 then ymotion:=0 else xmotion:=0;
if checkdest(xsc+xmotion,ysc+ymotion,mee) then
movecreature(xsc,ysc,xsc+xmotion,ysc+ymotion)
else begin;fight:=true;writelog(0,'cannot move, will try fighting');end;
{do motion}
end;
*** if (foundrange>1000) and (((u_vars.obj^[fr].d[5] MOD 16)+1)*1000 < foundrange) then fight := false;
if fight then
begin
writelog(199,'creature is fighting');
if ((foundrange>1) AND (fr<>0)) or ((foundrange<=1000) AND (fw<>0)) then
begin
```

Code: Select all

```
if creaturemoved[map[2,2,x,y].d]=movedindex
then fight:=false;
if not fight then
begin
writelog(199,'creature is moving');
xmotion:=0;ymotion:=0;
if x>xloc then xmotion:=-1;
if x<xloc then xmotion:=1;
if y>yloc then ymotion:=-1;
if y<yloc then ymotion:=1;
if (longisbest) and (foundrange<3000) then
begin;xmotion:=-xmotion;ymotion:=-ymotion;end;
if (ymotion<>0) and (xmotion<>0) then
if random(2)=1 then ymotion:=0 else xmotion:=0;
if checkdest(x+xmotion,y+ymotion,map[2,2,x,y].d) then
movecreature(x,y,x+xmotion,y+ymotion)
else begin;fight:=true;writelog(0,'cannot move, will try fighting');end;
{do motion}
end;
*** if (foundrange>1000) and (((u_vars.obj^[fr].d[5] MOD 16)+1)*1000 < foundrange) then fight := false;
if fight then
begin
writelog(199,'creature is fighting');
if ((foundrange>1) AND (fr<>0)) or ((foundrange<=1000) AND (fw<>0)) then
begin
if foundrange>1000 then whoops:=rws else whoops:=ws; if fw=0 then whoops:=rws;
(* if random(whoops)<OOPS then
case random(4) of
0:dec(attacklocx);
1:dec(attacklocy);
2:inc(attacklocx);
3:inc(attacklocy);
end; {whoops} *)
```