It is currently Thu Nov 20, 2008 10:17 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Findpath error
PostPosted: Thu Sep 11, 2008 6:26 am 
Offline

Joined: Mon Apr 02, 2007 1:13 pm
Posts: 33
Why i get "Out of memory." error ? and what kind of memory i lack?


Top
 Profile  
 
 Post subject: Re: Findpath error
PostPosted: Thu Sep 11, 2008 7:11 am 
Offline
Packet Maintainer

Joined: Thu Feb 02, 2006 8:33 am
Posts: 319
What does your FindPath command look like?
The greater the "searching box" you use, the higher the memory usage ;)


Top
 Profile  
 
 Post subject: Re: Findpath error
PostPosted: Thu Sep 11, 2008 10:10 am 
Offline

Joined: Mon Apr 02, 2007 1:13 pm
Posts: 33
Code:
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
endfunction


im standing at 1 place and mob start to findhingpath ( function above ) and when i move to another position hmm like 5 tile away it prints out of memory, why?


Top
 Profile  
 
 Post subject: Re: Findpath error
PostPosted: Thu Sep 11, 2008 1:47 pm 
Offline

Joined: Sat Feb 04, 2006 1:24 pm
Posts: 8
Location: Vienna, Austria
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


Top
 Profile  
 
 Post subject: Re: Findpath error
PostPosted: Thu Sep 11, 2008 2:04 pm 
Offline

Joined: Mon Apr 02, 2007 1:13 pm
Posts: 33
Here is my razor movie with error check situation and plz try to help me with slove this problem ;/
http://fistandantilus.neostrada.pl/Administrejtor_9-12_00.02.rpv imho everything seems to be ok in my function and i have no idea why im getting this error.


Top
 Profile  
 
 Post subject: Re: Findpath error
PostPosted: Thu Sep 11, 2008 3:17 pm 
Offline

Joined: Mon Apr 02, 2007 1:13 pm
Posts: 33
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 ;]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl