Findpath error
Findpath error
Why i get "Out of memory." error ? and what kind of memory i lack?
Re: Findpath error
What does your FindPath command look like?
The greater the "searching box" you use, the higher the memory usage
The greater the "searching box" you use, the higher the memory usage
Re: Findpath error
Code: Select all
function znajdzdroge(droga := 0,proba := 0,traj := 0)
var szukacz := findpath(self().x,self().y,self().z,opponent.x,opponent.y,opponent.z,self().realm,0,20);
if(szukacz && !szukacz.errortext && (szukacz.size() > 1))
foreach cord in szukacz
var licznik := 0;
var dystans;
while((self().x != cord.x) and (self().y != cord.y))
var opx := opponent.x;
var opy := opponent.y;
dystans := coordist(me.x, me.y, cord.x, cord.y);
RunTowardLocation(cord.x, cord.y);
sleepms(100);
if(coordist(me.x, me.y, cord.x, cord.y) >= dystans)
licznik := licznik + 1;
endif
if(licznik > 4)
if(proba >= 3)
return 5;
endif
proba := proba +1;
licznik := 0;
return 5;
//znajdzdroge(droga,proba);
endif
if((opponent.x != opx) or (opponent.y != opy))
return 5;
//closedistance(opponent);
// break;
endif
endwhile
//endif
endforeach
else
if(szukacz.errortext == "Out of memory.")
//say(""+szukacz.errortext);
traj := traj+1;
//say("try PIRERWSZY "+traj);
if(traj > 2)
if(droga == 0)
var r := 1;
while(r < 20)
runawayfrom(opponent);
sleepms(50);
if(r == 19)
opponent := 0;
setopponent(opponent);
endif
r := r+1;
endwhile
else
//say("powinno byc tutaj");
lepszeuciekanie(droga);
endif
else
//say("traj DRUGI "+traj);
znajdzdroge(droga,proba,traj);
endif
endif
endif
endfunctionRe: Findpath error
Hello,
I looked through your function, but the variable names are not very understandable to me, so I might be wrong...
But if I read correctly, the FindPath with a skirt of 20 and a distance of around 5 should work well. "Out of memory" error I got every time, when I tried to search huge areas for a path. It means the memory POL uses. If you ask POL to look for a path on an area of several 1000 tiles, then it will ask for a lot of memory and eventually produce this error.
But: Did you ensure, that 'opponent' is valid? If opponent is invalid, has an old mobile, or something else, the function will freak out, because the search area is undefined or too big.
Next step would be to check the FindPath() output directly with a print command, and check the inputs of the FindPath with a print too.
I am using FindPath in my AI and for patrolling NPCs and other things, and never had any problems with it.
You should check the mobile 'opponent' directly before the call to FindPath(), if it is still alive (if a NPC), because a NPC becomes invalid after its death, and FindPath wont like this.
Horus
I looked through your function, but the variable names are not very understandable to me, so I might be wrong...
But if I read correctly, the FindPath with a skirt of 20 and a distance of around 5 should work well. "Out of memory" error I got every time, when I tried to search huge areas for a path. It means the memory POL uses. If you ask POL to look for a path on an area of several 1000 tiles, then it will ask for a lot of memory and eventually produce this error.
But: Did you ensure, that 'opponent' is valid? If opponent is invalid, has an old mobile, or something else, the function will freak out, because the search area is undefined or too big.
Next step would be to check the FindPath() output directly with a print command, and check the inputs of the FindPath with a print too.
I am using FindPath in my AI and for patrolling NPCs and other things, and never had any problems with it.
You should check the mobile 'opponent' directly before the call to FindPath(), if it is still alive (if a NPC), because a NPC becomes invalid after its death, and FindPath wont like this.
Horus
Re: Findpath error
Here is my razor movie with error check situation and plz try to help me with slove this problem ;/
http://fistandantilus.neostrada.pl/Admi ... _00.02.rpv imho everything seems to be ok in my function and i have no idea why im getting this error.
http://fistandantilus.neostrada.pl/Admi ... _00.02.rpv imho everything seems to be ok in my function and i have no idea why im getting this error.
Re: Findpath error
Ncrsn helped me to slove this problem - the problem was 0 on flags (FP_IGNORE_MOBILES ) and npc was unable to run on my tile becouse it was probaly reserved i think "findpath" should be fix. when i set flag to 1 i havent got any error in my script.
Thx to ncrsn for ideas ;]
Thx to ncrsn for ideas ;]