Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   baddie tutorial (https://forums.graalonline.com/forums/showthread.php?t=65258)

coreys 04-08-2006 06:43 PM

baddie tutorial
 
I remember a long time ago, someone made a tutorial on gs1 baddie scripting. I've been wanting to find that tutorial to give me some help on a script I've been wanting to make, but I can't find it. Does anyone know what I'm talking about and where I can find it?

Yen 04-08-2006 07:41 PM

With the existance of the NPC Server, it's 100% useless now.

coreys 04-09-2006 04:25 AM

I wanted it basically for its tutorial on scripts to follow a player.

Googi 04-09-2006 05:09 AM

1 Attachment(s)
...

Yen 04-09-2006 05:12 AM

Quote:

Originally Posted by Googi
...

That's great if you're trying to crash your NPC Server.

EDIT: I should probably help. This is the function I use for chasing, assuming you understand how to implement it. It's called on a .5 second timer, the gettarget() function isn't the one I use, because I'm using a more complex aggression system to pick a target. I changed it to target the nearest player, here.

PHP Code:

function Chase(dx,dy) {
  
dx = limit(dx,-6,6);
  
dy = limit(dy,-6,6);
  
len = (dx^2 + dy^2) ^ .5;
  
mx = (dx / len) * 1.5;
  
my = (dy / len) * 1.5;
  
steps = 6;
  
target = gettarget();
  for (
a = 1; a <= 6; a++) {
    
temp.tdx = target.x - (x + mx * a);
    
temp.tdy = target.y - (y + my * a);
    
temp.tlen = (temp.tdx^2 + temp.tdy^2) ^ .5;
    if (
onwall2(x + .5 + mx * a, y + 1 + my * a, 2, 2) || temp.tlen < 2) {
      
steps = a-1;
      break;
    }
  }
  
setcharani("walk",NULL);
  
dir = getdir(mx,my);
  if (
steps <= 0) return;
  if (
steps == 6) move(mx*6,my*6,.6,0);
  else 
move(mx*steps,my*steps,((steps-1)/10)+.1,0+8);
}

function 
gettarget() {
  return 
findnearestplayers(x,y)[0];
} 



All times are GMT +2. The time now is 10:22 AM.

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