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
  #1  
Old 01-17-2006, 07:55 PM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
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.
Reply With Quote
  #2  
Old 01-17-2006, 09:18 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to 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.

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.
Reply With Quote
  #3  
Old 01-17-2006, 10:25 PM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
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.
Reply With Quote
  #4  
Old 01-18-2006, 02:12 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Mostly all of them.

Use tiles[x,y] instead of board[x,y]
Reply With Quote
  #5  
Old 01-19-2006, 04:31 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
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.
Reply With Quote
  #6  
Old 01-19-2006, 04:56 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Are you sure? I had to send it to the serverside for the default grass. :/
Reply With Quote
  #7  
Old 01-19-2006, 04:58 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
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?
Reply With Quote
  #8  
Old 01-19-2006, 05:00 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
This was when I had to use v3
Reply With Quote
  #9  
Old 01-19-2006, 05:02 AM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
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.
Reply With Quote
  #10  
Old 01-20-2006, 03:53 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Prozac, better do putx = int(putx) and puty = int(puty) otherwise you might update the wrong tiles
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 03:01 PM.


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