Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   board update help (https://forums.graalonline.com/forums/showthread.php?t=63510)

Prozac 01-17-2006 07:55 PM

board update help
 
I almost have this down,
its purpose: to hit bushes just like a sword does.

Problems:
>the bush does not grow back (online)
>the update of the board overwrites the tiles surrounding the board- such as if the bush is near part of a tree, it may take a chunk of tree out to put the removed-bush tile.

HTML Code:

//#CLIENTSIDE
if (weaponfired)
{
 playersprite=33;
 freezeplayer .2;
 putx=playerx+1.5+vecx(playerdir)*2;
 puty=playery+1.5+vecy(playerdir)*2;

 putx = int(putx/2)*2;
 puty = int(puty/2)*2;
 isbush=0;
 for (i=0; i<2; i++) for (j=0; j<2; j++)
  {
    b = board[putx+i+64*(puty+j)];
    bx = b % 16;
    by = int(b / 16);
  //detect bush tiles
    if ((bx==2&&by==0)||
        (bx==2&&by==1)||
        (bx==3&&by==0)||
        (bx==3&&by==1)){
    isbush = 1;
    }
  }

if (isbush==1)
 {
  board[putx+64*puty] = 5+42*16;
  board[putx+1+64*puty] = 6+42*16;
  board[putx+64*(puty+1)] = 5+43*16;
  board[putx+1+64*(puty+1)] = 6+43*16;
  //put bush removed tiles on the level
  updateboard putx,puty,2,2;
  putleaps 0,putx,puty;
 }

}

Any help with getting the board update tiles to be placed correctly would be great please.

Yen 01-17-2006 09:18 PM

Check that the whole bush is there, not just part.
Also, changing tiles will only show for you, not others. You have to do it on the serverside to make the bush look cut to other players.

It's not a good idea to ask for help on fixing scripts you didn't make, since the responses will only confuse you. That's definately taken from part of the Shovel NPC.

Prozac 01-17-2006 10:25 PM

thanks for the help.
The reponse does not confuse me, it makes sense.
And of course it is taken from the shovel npc, as that was the only example of modifying the board tiles that I could find.

Show me any substantial computer programming function that you did not learn by seeing an example of that code to work from.

Yen 01-18-2006 02:12 AM

Mostly all of them.

Use tiles[x,y] instead of board[x,y]

Lance 01-19-2006 04:31 AM

Quote:

Originally Posted by Yen
Check that the whole bush is there, not just part.
Also, changing tiles will only show for you, not others. You have to do it on the serverside to make the bush look cut to other players.

Approved 2x2 clientside changes are sent to the server automatically (for the default changes, like cut bushes and picked-up rocks). There is no need to do such things serverside.

Yen 01-19-2006 04:56 AM

Are you sure? I had to send it to the serverside for the default grass. :/

Lance 01-19-2006 04:58 AM

Quote:

Originally Posted by Yen
Are you sure? I had to send it to the serverside for the default grass. :/

Yeah. There was a short time where they weren't being sent properly from v4 a while back; Stefan has since fixed it. How long ago did you do the testing?

Yen 01-19-2006 05:00 AM

This was when I had to use v3 :(

Lance 01-19-2006 05:02 AM

Quote:

Originally Posted by Yen
This was when I had to use v3 :(

Well, it works properly from v4 these days. Give it a try. :)

Admins 01-20-2006 03:53 PM

Prozac, better do putx = int(putx) and puty = int(puty) otherwise you might update the wrong tiles


All times are GMT +2. The time now is 08:57 AM.

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