by rld » Wed Sep 30, 2009 9:59 am
This code patch for the ACK player module (ACK02) is based on the ACK 3.251 release, using the procedure described in a previous post. Warning: given that I do not understand approximately 99% of the code in the ACK source package, it is entirely possible (and in fact quite likely) that modifying your ACK release as detailed below will result in horrific bugs and crashes. I take no responsibility for any aggravation that results from this.
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
Similarly, in O_PLAY3.PAS around line 961, add the following ***-marked code line:
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} *)
This code patch for the ACK player module (ACK02) is based on the ACK 3.251 release, using the procedure described in a previous post. Warning: given that I do not understand approximately 99% of the code in the ACK source package, it is entirely possible (and in fact quite likely) that modifying your ACK release as detailed below will result in horrific bugs and crashes. I take no responsibility for any aggravation that results from this.
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]
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]
Similarly, in O_PLAY3.PAS around line 961, add the following ***-marked code line:
[code]
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} *)
[/code]