Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Zodiac.. Crashed by a Bush.. (https://forums.graalonline.com/forums/showthread.php?t=68230)

Yen 08-19-2006 09:50 PM

Zodiac.. Crashed by a Bush..
 
... This morning, Zodiac was crashed by a bush.
Directly from /stats:
1. 40.037491666 % npcs[128] (in level zodiacworld_am15.nw at pos (34, 20)) (bush)
The second NPC was the class 'leaps,' which is created when a bush is destroyed, at 9%.

I'm thinking it was done by a modem tap... But anyway, could anyone look at this script and tell me what may have happened or ways to prevent modem tapping?

PHP Code:

function onCreated() {
  
this.dead false;
  
setimgpart("zodiac_bush.png",0,0,32,32);
  
setshape(1,32,32);
  
drawunderplayer();
  
layer 0;
}

function 
onActionProjectile() {
  if (
this.dead) return;
  for (
this.0this.params[2].size(); this.a++) {
    if (
params[2][this.a][0] == "wepeff") {
      if (
params[2][this.a][1in {"slash","piercing"}) {
        
CutBush("slash");
        break;
      }
    }
    if (
params[2][this.a][0] == "magic") {
      if (
params[2][this.a][1] == "fire") {
        
CutBush("fire");
        break;
      }
    }
  }
}

function 
onActionDamage() {
  if (
this.dead) return;
  for (
this.0this.params[1].size(); this.a++) {
    if (
params[1][this.a][0] == "wepeff") {
      if (
params[1][this.a][1in {"slash","piercing"}) {
        
CutBush("slash");
        break;
      }
    }
    if (
params[1][this.a][0] == "magic") {
      if (
params[1][this.a][1] == "fire") {
        
CutBush("fire");
        break;
      }
    }
  }
}

function 
onTimeout() {
  
RespawnBush();
}

public function 
CutBush(cutfrom) {
  if (
this.dead) return;
  if (
cutfrom == "slash") {
    
this.leaps putnpc2(x,y,"join(\"leaps\");");
    
this.leaps.leaptype "bush";
  }
  if (
cutfrom == "fire") {
    
this.leaps putnpc2(x,y,"join(\"leaps\");");
    
this.leaps.leaptype "fire";
  }
  if (
random(0,1) < 0.3) {
    
this.dropitem putnpc2(xy"join(\"item\");");
    
this.dropitem.quantity 1;
    
this.dropitem.itemname "Leaves";
    
this.dropitem.arcname "items/leaves";
  }
  
setimgpart("zodiac_bush.png",32,0,32,32);
  
setshape(1,32,32);
  
dontblock();
  
setTimer(random(30,40));
  
this.dead true;
  if (
this.temporarydestroy();
}

public function 
RespawnBush() {
  
this.dead false;
  
setimgpart("zodiac_bush.png",0,0,32,32);
  
blockagain();
}

//#CLIENTSIDE
function onPlayerEnters() {
  
setshape(1,32,32);
  
drawunderplayer();
  
layer 0;



Chris 08-19-2006 10:12 PM

Always blaming Bush.. :\

KuJi 08-19-2006 10:14 PM

Quote:

Originally Posted by Chris
Always blaming Bush.. :\

Hahaha - and damn.. Zodiac was crashed by modem tapping a bush - brb.

Admins 08-19-2006 11:19 PM

The only thing that looks bad to me is that the script is not checking for correct params, don't know how a single npc can slow the server that much though. Eventually the machine was slow in general, there are some other servers running on the same machine.

KuJi 08-20-2006 12:52 AM

Quote:

Originally Posted by Stefan
The only thing that looks bad to me is that the script is not checking for correct params, don't know how a single npc can slow the server that much though. Eventually the machine was slow in general, there are some other servers running on the same machine.

Estimate around 30-40 (including my own, and GK debug)

Darkyoshi12345 08-20-2006 04:02 AM

Wow, ONE bush crashed the server?

KuJi 08-20-2006 04:06 AM

Quote:

Originally Posted by Darkyoshi12345
Wow, ONE bush crashed the server?

The class for the bush, and the class for the leaps. Everyone musta hit a bush at the same time and then - POOF

Darkyoshi12345 08-20-2006 07:09 AM

Quote:

Originally Posted by KuJi
The class for the bush, and the class for the leaps. Everyone musta hit a bush at the same time and then - POOF

Is that possible for everyone to hit a bush at a time though?

smirt362 08-20-2006 07:45 AM

Everything is possible...but I think it's statisically improbable.

On a side note...this thread made me chuckle a little bit. It just seems so absurd.

xXziroXx 08-20-2006 02:30 PM

Quote:

Originally Posted by Chris
Always blaming Bush.. :\

Ahahahahahahaa... hillarious.

contiga 08-20-2006 03:28 PM

What I think that has happened is:

A person modem tapped, and slashed hundreds of time at the bush, while the cable was pulled out, when it inserted again, it sent all the triggers, and it received lots of damage triggers.

The slashes made the bush destroy, and layed a new class down (leaps), which takes a bit CPU time.

How you could solve this; replace this line:
PHP Code:

this.leaps putnpc2(x,y,"join(\"leaps\");"); 

with a showani line, that shows a gani with the leaps in it. Because if it's already showing at the first trigger, it doesn't change anything if its being tried to be shown with the same ID another time, and is already showing.

I don't know if you get what I mean, else I'll be willing to help you online (by adding me to RC for a short time or so).


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

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