Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #31  
Old 11-03-2014, 04:54 PM
Jakov_the_Jakovasaur Jakov_the_Jakovasaur is offline
Deleted by Darlene159
Jakov_the_Jakovasaur's Avatar
Join Date: Sep 2013
Location: Deleted by Darlene159
Posts: 353
Jakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud of
Quote:
Originally Posted by xXziroXx View Post
findareanpcs(x, y) returns a list of npc id's, not a list of a TServerNPC objects.
this is not true for findareanpcs(), this is however true for getareanpcs()
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #32  
Old 11-03-2014, 04:59 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Jakov_the_Jakovasaur View Post
this is not true for findareanpcs(), this is however true for getareanpcs()
derp
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #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
  #34  
Old 11-12-2014, 01:53 PM
Inari Inari is offline
Registered User
Join Date: Sep 2014
Posts: 47
Inari is on a distinguished road
Try setting the item layer to 1?
Reply With Quote
  #35  
Old 11-12-2014, 04:50 PM
Jakov_the_Jakovasaur Jakov_the_Jakovasaur is offline
Deleted by Darlene159
Jakov_the_Jakovasaur's Avatar
Join Date: Sep 2013
Location: Deleted by Darlene159
Posts: 353
Jakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud of
im not sure if this is the case with more recent npc-server versions but it certainly was the case before, an npc needs a setshape() to be found by findareanpcs();

your check should still be improved though, currently it is attempting a loop only to return once it finds any npc, which could be the case for a random non-blocking npc, there should be a check within the loop to determine if the npc is either blocking or is a dirthole

it could also be very unsmooth to be triggering like that in order to play a sound especially given a high latency, if you do these checks on clientside first you can have the sound play in real time (and even put it in a gani for others to see), then you can do the checks again on serverside as a matter of preventing duplication or for security
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #36  
Old 11-12-2014, 10:31 PM
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
Quote:
Originally Posted by Jakov_the_Jakovasaur View Post
im not sure if this is the case with more recent npc-server versions but it certainly was the case before, an npc needs a setshape() to be found by findareanpcs();

your check should still be improved though, currently it is attempting a loop only to return once it finds any npc, which could be the case for a random non-blocking npc, there should be a check within the loop to determine if the npc is either blocking or is a dirthole

it could also be very unsmooth to be triggering like that in order to play a sound especially given a high latency, if you do these checks on clientside first you can have the sound play in real time (and even put it in a gani for others to see), then you can do the checks again on serverside as a matter of preventing duplication or for security
Good point. However doesn't resolve the fact that sometimes the block shows before the dirt hole making it look like you dug up nothing until the dirt hole vanishes and releases the item that the dirt hole image was covering up. Basically under no circumstance should my dirt hole show above the block yet it does nearly 8 out of 10 times which is a huge critical problem for me and my goal. Like game breaking problem.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:46 AM.


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