Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-28-2014, 01:57 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
updateboard question

Okay, so I am working on a shovel. I am trying to make it place tiles in the level where I dig. I wan't them to wait so long then disappear. The problem is that they only seem to disappear if I replace the tiles for blank grass 2047 I think it is. If I place my tiles over any other tile they do not automatically disappear. Is there any trick to making the tiles revert after a set amount of time? I was thinking I could just re-replace the tiles but then it gets mad ugly when the player leaves the level because then your not in the same level and they don't end up getting reverted back ect.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.player.1.0 vecx(player.dir) * 2;
  
this.player.1.0 vecy(player.dir) * 2;
  for ( 
this.iy 0this.iy 2this.iy ++ ) {
    for ( 
this.ix 0this.ix 2this.ix ++ ) {
      
this.checkX this.x+this.ix;
      
this.checkY this.y+this.iy;
      
tiles[this.checkXthis.checkY] = this.replaceTiles[this.ix+this.iy*2];
    }
  }
  
updateboard(this.x,this.y,2,2);

Reply With Quote
  #2  
Old 10-28-2014, 05:00 AM
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: 360
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
hello!

you should consider dropping a dirt npc on serverside instead, that way it can be made to either fade or transition out rather than disappear at once, plus there are ways to create the illusion of no lag if you make the player do a showani()/showimg() on clientside when triggering to serverside, then have that display disappear as soon as the npc they are the placer of appears on their client. dirtholes can then be checked for using findareanpcs(); which if it contains other non dirthole npcs you will probably want to trigger an event such as 'onDig' on them anyway
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #3  
Old 10-28-2014, 11:10 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
Quote:
Originally Posted by Jakov_the_Jakovasaur View Post
hello!

you should consider dropping a dirt npc on serverside instead, that way it can be made to either fade or transition out rather than disappear at once, plus there are ways to create the illusion of no lag if you make the player do a showani()/showimg() on clientside when triggering to serverside, then have that display disappear as soon as the npc they are the placer of appears on their client. dirtholes can then be checked for using findareanpcs(); which if it contains other non dirthole npcs you will probably want to trigger an event such as 'onDig' on them anyway
Does this cause conflict if I use putnpc() twice on the same area? Will the dirt hole ever cover up the item you are digging up? For example, digging up a defaulat gralat using join(); to its default class.
Reply With Quote
  #4  
Old 10-28-2014, 11:37 AM
Inari Inari is offline
Registered User
Join Date: Sep 2014
Posts: 47
Inari is on a distinguished road
Well the dirt hole would be draw-under-player?
Reply With Quote
  #5  
Old 10-28-2014, 12:18 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Inari View Post
Well the dirt hole would be draw-under-player?
This. Also, upon creation, check if there's already a dirt hole at that same position, and just make the NPC destroy itself if that's the case.
Reply With Quote
  #6  
Old 10-28-2014, 10:21 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: 360
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 scriptless View Post
Does this cause conflict if I use putnpc() twice on the same area? Will the dirt hole ever cover up the item you are digging up? For example, digging up a defaulat gralat using join(); to its default class.
you can check on both clientside and serverside using findareanpcs() to see if such a dirthole npc already exists, and just avoid placing it if one does
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #7  
Old 10-29-2014, 01:02 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
Quote:
Originally Posted by Jakov_the_Jakovasaur View Post
you can check on both clientside and serverside using findareanpcs() to see if such a dirthole npc already exists, and just avoid placing it if one does
My question is digging a hole... and an object.. puts 2 putnpc2 in the exact spot.. now on GK this proved my theory that in some cases the putnpc2's show on top of each other in different orders for no apparent reason. It's to my understanding that the only way to persistently show them correctly is in a gang, via gani script so that you can grab the item, before the hole dissapears.
Reply With Quote
  #8  
Old 10-29-2014, 05:56 AM
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: 360
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 scriptless View Post
My question is digging a hole... and an object.. puts 2 putnpc2 in the exact spot.. now on GK this proved my theory that in some cases the putnpc2's show on top of each other in different orders for no apparent reason. It's to my understanding that the only way to persistently show them correctly is in a gang, via gani script so that you can grab the item, before the hole dissapears.
putting drawunderplayer() on the dirt hole should work, if you need to use drawunderplayer() on the item as well and it uses a bounce effect similar to default rupees, modify z in a scripted animation rather than y or place it inside a normal gani
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #9  
Old 10-29-2014, 07:57 AM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is a jewel in the roughMysticalDragon is a jewel in the rough
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
But you really shouldnt have to draw the item
Under the player, that would just be weird.
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]



Reply With Quote
  #10  
Old 10-29-2014, 04:01 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Create a new gani and add a param for the dirt image and one for the item icon.
__________________
Reply With Quote
  #11  
Old 10-29-2014, 04:45 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: 360
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 MysticalDragon View Post
But you really shouldnt have to draw the item
Under the player, that would just be weird.
i know, it was hypothetical
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #12  
Old 10-29-2014, 04:56 PM
Inari Inari is offline
Registered User
Join Date: Sep 2014
Posts: 47
Inari is on a distinguished road
Quote:
Originally Posted by scriptless View Post
My question is digging a hole... and an object.. puts 2 putnpc2 in the exact spot.. now on GK this proved my theory that in some cases the putnpc2's show on top of each other in different orders for no apparent reason. It's to my understanding that the only way to persistently show them correctly is in a gang, via gani script so that you can grab the item, before the hole dissapears.
Shouldn't they be
Dirt hole => under player
Object => same layer as player
?
Reply With Quote
  #13  
Old 10-29-2014, 05:10 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Quote:
Originally Posted by Inari View Post
Shouldn't they be
Dirt hole => under player
Object => same layer as player
?
y when u can just use a gani...
Reply With Quote
  #14  
Old 10-29-2014, 05:18 PM
Inari Inari is offline
Registered User
Join Date: Sep 2014
Posts: 47
Inari is on a distinguished road
Quote:
Originally Posted by Cubical View Post
y when u can just use a gani...
Not sure, seems cleaner, since "object" can be a lot of things: a rupee, a bomb (that about to explode), etc.
Reply With Quote
  #15  
Old 10-30-2014, 01:24 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
Quote:
Originally Posted by Inari View Post
Not sure, seems cleaner, since "object" can be a lot of things: a rupee, a bomb (that about to explode), etc.
Yeah, thats why things are kinda difficult. It would be super cool if I could just have tiles that are not 2047 revert back to normal.. but the only tiles that the whole disappears from are ones that were entirely those tiles. So tiles like 0, and 1 would not be changed back for some reason. Thats the only problem I am having with the method I am using....lag is more like an eh not an issue but the fact it won't change back for some tiles at all even after 18 hours.. yeah thats not lag at all.. =/
Reply With Quote
  #16  
Old 10-30-2014, 07:55 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
You can check out the "object" class in my Atlantis dump for something like this. I switch out tiles both on the serverside and clientside there to get a smoother experience. It's a bit more restrictive (bushes/stones/... sitting on top of the tiles) and therefore easier to control than your shovel stuff, though, but maybe it'll give you a few ideas. One thing to keep in mind: when using updateboard(), update a region larger than 2 by 2, no matter how many tiles you actually changed. Stefan added some "optimization" to the server at some point that can really **** up your tile handling when you're updating a 2 by 2 region.
Reply With Quote
  #17  
Old 10-30-2014, 09:07 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
bro... ganis.. not hard
Reply With Quote
  #18  
Old 10-30-2014, 03:24 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by xAndrewx View Post
Create a new gani and add a param for the dirt image and one for the item icon.
this.
__________________
Reply With Quote
  #19  
Old 10-30-2014, 03:34 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by xAndrewx View Post
this.
No need to alienate things.
Reply With Quote
  #20  
Old 10-30-2014, 04:13 PM
Inari Inari is offline
Registered User
Join Date: Sep 2014
Posts: 47
Inari is on a distinguished road
Quote:
Originally Posted by xAndrewx View Post
this.
So, now you want to make a bomb that explodes?
Reply With Quote
  #21  
Old 10-31-2014, 02:59 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
Quote:
Originally Posted by Crow View Post
You can check out the "object" class in my Atlantis dump for something like this. I switch out tiles both on the serverside and clientside there to get a smoother experience. It's a bit more restrictive (bushes/stones/... sitting on top of the tiles) and therefore easier to control than your shovel stuff, though, but maybe it'll give you a few ideas. One thing to keep in mind: when using updateboard(), update a region larger than 2 by 2, no matter how many tiles you actually changed. Stefan added some "optimization" to the server at some point that can really **** up your tile handling when you're updating a 2 by 2 region.
I think I did read that he made some optimizations. And he made a command on bush's specifically and being able to regrow them via script or something if I am not mistaken? However on a gmap, how do the x/y work for update board? Are they 0 to 64 or are they 0 to 64 * levels?
Reply With Quote
  #22  
Old 10-31-2014, 06:17 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by scriptless View Post
I think I did read that he made some optimizations. And he made a command on bush's specifically and being able to regrow them via script or something if I am not mistaken? However on a gmap, how do the x/y work for update board? Are they 0 to 64 or are they 0 to 64 * levels?
Not sure. I'm just using this.x and this.y in Atlantis' "object" class. Can't remember if that's the global or local coordinates.
Reply With Quote
  #23  
Old 10-31-2014, 04:30 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: 360
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
use map coordinates
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #24  
Old 11-01-2014, 08:29 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
would be interesting to see your work around
__________________
Reply With Quote
  #25  
Old 11-02-2014, 02:45 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
Quote:
Originally Posted by xAndrewx View Post
would be interesting to see your work around
who's workaround? I figure I'm gonna need to check tiles, and npc's.. this is going to be fun.
Reply With Quote
  #26  
Old 11-03-2014, 04:00 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, so this is giving me problems... more specifically its making npc's a good distance away say "Hit".. It's in the weapon npc... cx/cy are the cordinate x and y that I want to check at.. (top left of the hole dug).. Should be 2x2 tiles. But this seems to affect npc's further away.

PHP Code:
  for(temp.findareanpcs(this.cxthis.cythis.cx 1this.cy 1)){
    
temp.n.chat "Hit!";
  } 
It's giving it a huge gap between the npc I dug and the ones around it... :x

Edit:

Okay, sorry I guess thats x/y/w/h I needed to just supply 2,2 for the width,height... for some reason I was entering ending x/y cords. My bad, sorry.

However, gralats have not been showing for me on this server or my personal dev server unless I first logon UN... anyone know why this is? I would have thought a newly bought server would be working, is it missing some file?

Last edited by scriptless; 11-03-2014 at 05:06 AM..
Reply With Quote
  #27  
Old 11-03-2014, 06:08 AM
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: 360
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 scriptless View Post
Okay, so this is giving me problems... more specifically its making npc's a good distance away say "Hit".. It's in the weapon npc... cx/cy are the cordinate x and y that I want to check at.. (top left of the hole dug).. Should be 2x2 tiles. But this seems to affect npc's further away.

PHP Code:
  for(temp.findareanpcs(this.cxthis.cythis.cx 1this.cy 1)){
    
temp.n.chat "Hit!";
  } 
It's giving it a huge gap between the npc I dug and the ones around it... :x

Edit:

Okay, sorry I guess thats x/y/w/h I needed to just supply 2,2 for the width,height... for some reason I was entering ending x/y cords. My bad, sorry.
looking at the original script:

Quote:
Originally Posted by scriptless View Post

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.player.1.0 vecx(player.dir) * 2;
  
this.player.1.0 vecy(player.dir) * 2;
  for ( 
this.iy 0this.iy 2this.iy ++ ) {
    for ( 
this.ix 0this.ix 2this.ix ++ ) {
      
this.checkX this.x+this.ix;
      
this.checkY this.y+this.iy;
      
tiles[this.checkXthis.checkY] = this.replaceTiles[this.ix+this.iy*2];
    }
  }
  
updateboard(this.x,this.y,2,2);

is there still not a break; for when 4 grass tiles have been detected on clientside?

if not then it could be triggering to the server up to 4 times and ultimately checking a larger region on serverside than necessary
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #28  
Old 11-03-2014, 08:43 AM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is a jewel in the roughMysticalDragon is a jewel in the rough
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
Quote:
Originally Posted by scriptless View Post
Okay, so this is giving me problems... more specifically its making npc's a good distance away say "Hit".. It's in the weapon npc... cx/cy are the cordinate x and y that I want to check at.. (top left of the hole dug).. Should be 2x2 tiles. But this seems to affect npc's further away.

PHP Code:
  for(temp.findareanpcs(this.cxthis.cythis.cx 1this.cy 1)){
    
temp.n.chat "Hit!";
  } 
It's giving it a huge gap between the npc I dug and the ones around it... :x

Edit:

Okay, sorry I guess thats x/y/w/h I needed to just supply 2,2 for the width,height... for some reason I was entering ending x/y cords. My bad, sorry.

However, gralats have not been showing for me on this server or my personal dev server unless I first logon UN... anyone know why this is? I would have thought a newly bought server would be working, is it missing some file?
Utilize f2 to see if there is any missing files
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]



Reply With Quote
  #29  
Old 11-03-2014, 09:27 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
findareanpcs(x, y) returns a list of npc id's, not a list of a TServerNPC objects.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #30  
Old 11-03-2014, 12:04 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
looking at the original script:



is there still not a break; for when 4 grass tiles have been detected on clientside?

if not then it could be triggering to the server up to 4 times and ultimately checking a larger region on serverside than necessary
Sorry, I should have posted whole script so far.. Instead of using breaks, I used return's from different functions.

Quote:
Originally Posted by MysticalDragon View Post
Utilize f2 to see if there is any missing files
I didn't see anything in f2, I already checked. Plus I did "/find *gralat*" and it only found the gani. So I uploaded gralats.png but it still didn't work.
Reply With Quote
  #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: 360
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
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by Jakov_the_Jakovasaur View Post
this is not true for findareanpcs(), this is however true for getareanpcs()
derp
__________________
Follow my work on social media post-Graal:Updated august 2025.
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: 360
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


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 07:27 PM.


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