Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Mining stuff (https://forums.graalonline.com/forums/showthread.php?t=67087)

excaliber7388 06-30-2006 10:48 PM

Mining stuff
 
Working on a mine script, it soesn't work with the parameter check in it, and it doesn't work without it either. It does part of the script, but seems to randomly stop before freezeplayer? Weird.
PHP Code:

function onActionserverside()
{
  if(
params[0]=="mine")
  {
    if(
clientr.minerocks>0)
    {
      
//variable setup
      
this.mine int(random(0,101));
      
this.time random(3,8);
      
player.dif=2;
      
freezeplayer(this.time);
      
player.chat "Searching through pile";
      
showimg(4,"dr-minerocks.png",playerx+.5,playery+2.1);
      
changeimgvis(4,.5);
      
changeimgzoom(4,.75);
      
setani("push",NULL);
      
sleep(this.time);
      
hideimg(4);
      if(
this.mine<=15)
      {
        
//15%
        
player.chat "Found some Carbon!";
        
addweapon("Tools/Carbon");
        
clientr.carbon++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=25)
      {
        
//10%
        
player.chat "Found some Iron!";
        
addweapon("Tools/Iron");
        
clientr.iron++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=30)
      {
        
//5%
        
player.chat "Found some Silver!";
        
addweapon("Tools/Silver");
        
clientr.sliver++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=35)
      {
        
//5%
        
player.chat "Found a Saphire!";
        
addweapon("Tools/Saphire");
        
clientr.saphire++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=40)
      {
        
//5%
        
player.chat "Found a Ruby!";
        
addweapon("Tools/Ruby");
        
clientr.ruby++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=43)
      {
        
//3%
        
player.chat "Found Gold!!";
        
addweapon("Tools/Gold");
        
clientr.Gold++;
        
clientr.minerocks--;
      }
      else
      {
        
player.chat=="Nothing";
        
clientr.minerocks--;
      }
    }
    else
    {
      
player.chat="You have no more mine rocks!";
    }
  }
}
      
          
//#CLIENTSIDE
function onWeaponfired()
{
  
triggeraction(0,0,"serverside","New mining","mine");



ApothiX 07-01-2006 12:07 AM

player.dif=2;

do you mean:
player.dir=2; ?

Also, did you even attempt to debug it using echo() calls to see where exactly it is screwing up?

excaliber7388 07-01-2006 01:12 AM

Quote:

Originally Posted by ApothiX
player.dif=2;

do you mean:
player.dir=2; ?

Also, did you even attempt to debug it using echo() calls to see where exactly it is screwing up?

Nope, not 100% sure how to use it yet XD

ApothiX 07-01-2006 01:19 AM

Quote:

Originally Posted by excaliber7388
Nope, not 100% sure how to use it yet XD

eh? just throw a bunch of: echo("Checkpoint, next line: blah=blah;"); or something, and it will output to NC and you will be able to check where exactly is is failing.

excaliber7388 07-01-2006 01:49 AM

oh thanks.
It still doesn't work with the player.dir fixed, so I'll check that
edit:
Nope, runs right through to the end of the script, it must be something else


All times are GMT +2. The time now is 04:16 AM.

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