Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   updateboard question (https://forums.graalonline.com/forums/showthread.php?t=134269651)

scriptless 10-28-2014 01:57 AM

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);



Jakov_the_Jakovasaur 10-28-2014 05:00 AM

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

scriptless 10-28-2014 11:10 AM

Quote:

Originally Posted by Jakov_the_Jakovasaur (Post 1732320)
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.

Inari 10-28-2014 11:37 AM

Well the dirt hole would be draw-under-player?

Crow 10-28-2014 12:18 PM

Quote:

Originally Posted by Inari (Post 1732322)
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.

Jakov_the_Jakovasaur 10-28-2014 10:21 PM

Quote:

Originally Posted by scriptless (Post 1732321)
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

scriptless 10-29-2014 01:02 AM

Quote:

Originally Posted by Jakov_the_Jakovasaur (Post 1732326)
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.

Jakov_the_Jakovasaur 10-29-2014 05:56 AM

Quote:

Originally Posted by scriptless (Post 1732327)
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

MysticalDragon 10-29-2014 07:57 AM

But you really shouldnt have to draw the item
Under the player, that would just be weird.

xAndrewx 10-29-2014 04:01 PM

Create a new gani and add a param for the dirt image and one for the item icon.

Jakov_the_Jakovasaur 10-29-2014 04:45 PM

Quote:

Originally Posted by MysticalDragon (Post 1732329)
But you really shouldnt have to draw the item
Under the player, that would just be weird.

i know, it was hypothetical

Inari 10-29-2014 04:56 PM

Quote:

Originally Posted by scriptless (Post 1732327)
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
?

Cubical 10-29-2014 05:10 PM

Quote:

Originally Posted by Inari (Post 1732334)
Shouldn't they be
Dirt hole => under player
Object => same layer as player
?

y when u can just use a gani...

Inari 10-29-2014 05:18 PM

Quote:

Originally Posted by Cubical (Post 1732335)
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.

scriptless 10-30-2014 01:24 AM

Quote:

Originally Posted by Inari (Post 1732336)
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.. =/


All times are GMT +2. The time now is 09:57 PM.

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