Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Wall checking between two points (https://forums.graalonline.com/forums/showthread.php?t=76488)

Chompy 08-29-2007 01:13 PM

PHP Code:

function checkPath(oxtxoyty) {
  
temp.nxy = {(tx 23.5/16) - (ox 23.5/16)
              (
ty 31.5/16) - (oy 31.5/16)};
  
temp.dist = (nxy[0]*nxy[0] + nxy[1]*nxy[1])^0.5;
  
temp.ow false;
  
  for(
temp.0dist++) {
    if (
onwall2((ox 23.5/16) + ((nxy[0]/dist) * i),
       (
oy 31.5/16) + ((nxy[1]/dist) * i), 0.50.5)) {
      
ow true;
      break;
    }
    
++;
  }
  return 
ow;


wee

Inverness 08-30-2007 12:20 AM

Quote:

Originally Posted by Twinny (Post 1343168)
I set up nodes all over my gmaps while using dynamic a* to navigate between nodes. I figured that using a* for a whole gmap would quickly set fire to the NPC-Server ^^.

Perhaps a system could be created to transfer complex calculations to a single client that has the NPC loaded and the calculating client would shift between the various clients that have it loaded, and fall back on the NPC-Server if none have it loaded.

Just a thought.

Rapidwolve24 12-25-2007 01:11 AM

I know I'm a little late but wouldnt something like this do the trick

PHP Code:

public function CheckPath(xydxdy)
{   
   
temp.check 0;
   
temp.checkrate 1;
   
   
temp.distance distance(xydxdy);
   
temp.angle getangle(dx xdy y);
   
   while (
temp.check temp.distance)
   {
     
temp.checkx int(+ (temp.check cos(temp.angle)));
     
temp.checky int(+ (temp.check * -sin(temp.angle)));
     
     if (
onwall(temp.checkxtemp.checky))
     {
        
temp.onwallcounter += 1;
     }
   
     
temp.check += temp.checkrate;
     
     
sleep(0.05);
   } 
  return 
temp.onwallcounter;




All times are GMT +2. The time now is 03:17 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.