View Single Post
  #33  
Old 11-12-2014, 02:30 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Okay still scratching my head over this. Can someone please help me figure out a more logical way to actually dig a hole because my hole, keeps digging OVER the npc I dig up when it's a block and its getting frustrating.

PHP Code:
function onCreated() {  
  
// Tiles that we can dig up, I am using INT not HEX
  
this.checkTiles = {
    
01680695696204767990748,
    
4916471734210316210217671782,
    
1783140530491386138730481735,
    
17511750
  
};
}
function 
onActionServerside() {
  
// We want to dig :)
  
if ( params[0] == "dig" ) {
    if ( 
DigUp() == false ) {
      
DigRandomItem();
     }
    
  }
}

function 
DigRandomItem() {
  
temp.random int(random(0,100));
  
  if ( 
temp.random in |0,75| ) {
    return 
"worm";
  }
  
  if ( 
temp.random in |76,100| ) {
    return 
"gralat";
  }
  
  return 
false;
}

function 
DigUp() {

  
// Variables
  
this.digx player.1.0 vecx(player.dir) * 2;
  
this.digy player.1.0 vecy(player.dir) * 2;
  
  
// Check putnpc2's
  
for(temp.findareanpcs(this.digxthis.digy22)){
    
triggerclient("gui"this.name"play""crush.wav");
    return 
true// cannot dig
  
}
  
  
// Check Tiles
  
for ( this.iy 0this.iy 2this.iy ++ ) {
    for ( 
this.ix 0this.ix 2this.ix ++ ) {
      
this.checkX this.digx this.ix;
      
this.checkY this.digy this.iy;
      if ( !(
tiles[this.checkX,this.checkYin this.checkTiles) ) {
        
triggerclient("gui"this.name"play""crush.wav");
        return 
true// cannot dig
      
}
    }
  }

  
temp.hole putnpc2(this.digxthis.digy"");
  
temp.hole.join("shovel-hole");
  
temp.hole.drawunderplayer();
    
  
temp.item DigRandomItem();
    
  if ( 
temp.item == "gralat" ) {
    
temp.object putnpc2(this.digxthis.digy"");
    
temp.object.join("gralats");
    
temp.object.rupees 1;
  } else {
    
    if ( 
temp.item == "worm" ) {
      
temp.object putnpc2(this.digxthis.digy"");
      
temp.object.join("shovel-item");
      
temp.object.image "block.png";
    }
  }
  
triggerclient("gui"this.name"play""lift.wav");
}

//#CLIENTSIDE
function onWeaponFired() {
  
// Show player digging
  
freezeplayer(0.8);
  
setani("partasti_shovel""partasti_shovel.png"); 
  
triggerserver("gui"this.name"dig");
}

function 
onActionClientside() {
  if ( 
params[0] == "play" ) {
    
play(params[1]);
  }

And the hole,

PHP Code:
// Join to all the hole's dug up by a shovel

function onCreated() {
  
setimg("partasti_dirthole.png");
  
dontblock();
  
drawunderplayer();
  
sleep(5);
  
destroy();

Reply With Quote