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 05-09-2007, 05:54 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Question strange tiles...

i am having some truble under standing thies tiles...

in the script "dirt path" found in levels/npcs it uses numbers and letters (0xaa)

how do thise number-letter-combonations corospond to the tile set, so i can make bush generators, or things like tree genorators

Edit: here is a bigger example:
PHP Code:
function laypath() {
  
sandtiles = {0xaa,0xab,0x12d,0x8,0xf};
  
grasstiles = {0x0,0x1,0x10,0x1ff,0x3ff,0x7ff,0x835,0x836,0x837};
  
sandspot = {
    
0x176,0x166,0x177,
    
0x1a70xaa,0x197,
    
0x188,0x178,0x169
    
}; 
__________________
**FLIP OUT**

Last edited by theHAWKER; 05-09-2007 at 06:22 AM..
Reply With Quote
  #2  
Old 05-09-2007, 06:23 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
They're the hex-code of the tile. If you open the level editor and select tiles, and click the button at the top that looks like a circle divided into 4 parts, it'll give you the hex-codes of all the tiles you selected.
Reply With Quote
  #3  
Old 05-09-2007, 06:28 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by DustyPorViva View Post
They're the hex-code of the tile. If you open the level editor and select tiles, and click the button at the top that looks like a circle divided into 4 parts, it'll give you the hex-codes of all the tiles you selected.
ah, thank you
__________________
**FLIP OUT**
Reply With Quote
  #4  
Old 05-09-2007, 06:47 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
I have never experimented with these npcs before, but I think I made a bush one as you requested. (Attached)

Enjoy.
Attached Files
File Type: txt editnpcBush.txt (761 Bytes, 180 views)
__________________
- Zidane / Zidaya
Reply With Quote
  #5  
Old 05-09-2007, 07:18 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by Deadly_Killer View Post
I have never experimented with these npcs before, but I think I made a bush one as you requested. (Attached)

Enjoy.
wow cool, can u explane the script cause it uses alot of random crap. for example:
PHP Code:
for (tx pxtx px 6tx++) { 
__________________
**FLIP OUT**
Reply With Quote
  #6  
Old 05-09-2007, 07:25 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by theHAWKER View Post
wow cool, can u explane the script cause it uses alot of random crap. for example:
PHP Code:
for (tx pxtx px 6tx++) { 
That does not exist in the script.

BUT:

This checks if a square (4 tiles) are grass ( if not, it stops )
PHP Code:
  for (tx pxtx px 2tx++) {
    for (
ty pyty py 2ty++) {
      if (!(
tiles[txtyin grasstiles)) return;
    }
  } 
This actually sets the tiles one by one.
PHP Code:
  i 0;
  for (
tx pxtx px 2tx++) {
    for (
ty pyty py 2ty++) {
      
tiles[tx,ty] = bushtiles[i];
      
i++;
    }
  } 
__________________
- Zidane / Zidaya
Reply With Quote
  #7  
Old 05-09-2007, 04:19 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
so if i wanted it to set somthing down that was 4 tiles by 4 tiles would i do:
PHP Code:
0;
  for (
tx pxtx px 4tx++) {
    for (
ty pyty py 4ty++) {
      
tiles[tx,ty] = bushtiles[i];
      
i++;
    }
  } 
or like:
PHP Code:
0;
  for (
tx pxtx px 2tx++) {
    for (
ty pyty py 2ty++) {
      for (
ty pyty py 2ty++) {
          
tiles[tx,ty] = bushtiles[i];
          
i++;
    }
  } 
__________________
**FLIP OUT**
Reply With Quote
  #8  
Old 05-09-2007, 06:03 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I think you're getting way over your head.
Reply With Quote
  #9  
Old 05-09-2007, 06:40 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 DustyPorViva View Post
I think you're getting way over your head.
I thought exactly the same. Hawker...before you are trying to do something like that, try to learn some basic scripting.
Reply With Quote
  #10  
Old 05-09-2007, 06:50 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
So I don't come off as a complete ass(I'm an incomplete ass).
You're trying to learn something simple like placing tiles from a script that does way more, thus, is a lot more complex and can mislead you. What you posted serves more than to just lay tiles down, it also is used to calculate what specific tiles to place and where, to generate a path(though it doesn't do all that in the bit you posted, it's written to do so). It's all very complex.

If you have the array of the bush already, which would be 4 tiles, you could do something like.
PHP Code:
for (i=0;i<4;i++) {
  
tiles[mousex+i%2,mousey+int(i/2)]=bushtiles[i];
}
updateboard mousex,mousey,2,2
Reply With Quote
  #11  
Old 05-09-2007, 06:59 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Make the object an image, use a class.
HTML Code:
function onCreated()
{
  this.dropObject = (this.dropObject? this.dropObject: "block.png");
  
  this.showCharacter();
  this.setCharAni("myplaceholder", this.dropObject);
}
HTML Code:
function onCreated()
{
  //Make this a database
  //Change the random(0, THISRANDOM) to the overworld size * 64
  this.warpto(this.level.name, random(0, THISRANDOM), random(0, THISRANDOM));
  while if (onwall2(this.x, this.y, 2, 2))
  {
    this.warpto(this.name, random(0, THISRANDOM), random(0, THISRANDOM));
  }
  this.dropObject(randomstring("bush", "tree", "plant"));

  scheduleevent(10, "Created", "");
  //Repeat this process every 10 seconds.
}    
function dropObject(objectName)
{
  with(putnpc2(objectx, objecty, "join objectHolder;"))
  {
    this.dropObject = thiso.objectName @ ".png";
  }
}
Reply With Quote
  #12  
Old 05-09-2007, 07:30 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
O.o?
Reply With Quote
  #13  
Old 05-09-2007, 07:32 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Instead of replacing tiles for laying objects, just make an object layer making the tiles that you want into images. Seems more logical to me.
Reply With Quote
  #14  
Old 05-09-2007, 07:50 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Not for this purpose. This is an editor NPC, like the path generator.
Reply With Quote
  #15  
Old 05-09-2007, 09:40 PM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by DustyPorViva View Post
PHP Code:
for (i=0;i<4;i++) {
  
tiles[mousex+i%2,mousey+int(i/2)]=bushtiles[i];
}
updateboard mousex,mousey,2,2
hm, yeah, I could of done that. I just stuck with Stefan's way of doing it.
__________________
- Zidane / Zidaya
Reply With Quote
  #16  
Old 05-09-2007, 11:57 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Oh, I see!
Thanks
Reply With Quote
  #17  
Old 05-10-2007, 12:26 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
theHAWKER, look before you leap. You're way over your head. First do some basic stuff, such as staff tools, and basic triggering scripts.
__________________
Reply With Quote
  #18  
Old 05-10-2007, 12:58 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Ya, this would be a simpler way to look at making a bush generator:
PHP Code:
// NPC made by Dusty
if (mousedowntimeout=0.05;
if (
timeout && leftmousebutton) {
  
grasstiles={0x0,0x1,0x10,0x1ff,0x3ff,0x7ff,0x835,0x836,0x837};
  
bushtiles={0x2,0x3,0x12,0x13};
  
ongrass=0;
  for (
i=0;i<4;i++) {
    if (
tiles[mousex-1+i%2,mousey-1+int(i/2)] in grasstilesongrass++;
  }
  if (
ongrass==4) {
    for (
i=0;i<4;i++) tiles[mousex-1+i%2,mousey-1+int(i/2)]=bushtiles[i];
  }
  
updateboard mousex-1,mousey-1,2,2;
  
timeout=0.05;

Reply With Quote
  #19  
Old 05-10-2007, 02:22 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by DustyPorViva View Post
Ya, this would be a simpler way to look at making a bush generator:
PHP Code:
// NPC made by Dusty
if (mousedowntimeout=0.05;
if (
timeout && leftmousebutton) {
  
grasstiles={0x0,0x1,0x10,0x1ff,0x3ff,0x7ff,0x835,0x836,0x837};
  
bushtiles={0x2,0x3,0x12,0x13};
  
ongrass=0;
  for (
i=0;i<4;i++) {
    if (
tiles[mousex-1+i%2,mousey-1+int(i/2)] in grasstilesongrass++;
  }
  if (
ongrass==4) {
    for (
i=0;i<4;i++) tiles[mousex-1+i%2,mousey-1+int(i/2)]=bushtiles[i];
  }
  
updateboard mousex-1,mousey-1,2,2;
  
timeout=0.05;

Doing ongrass++ is retarded. Just end the loop completely if it isn't grass.
__________________
- Zidane / Zidaya
Reply With Quote
  #20  
Old 05-10-2007, 02:40 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Doesn't work that easy, but if you'd like to edit my script to show what you mean go ahead.
Reply With Quote
  #21  
Old 05-10-2007, 02:42 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by DustyPorViva View Post
Ya, this would be a simpler way to look at making a bush generator:
PHP Code:
// NPC made by Dusty
if (mousedowntimeout=0.05;
if (
timeout && leftmousebutton) {
  
grasstiles={0x0,0x1,0x10,0x1ff,0x3ff,0x7ff,0x835,0x836,0x837};
  
bushtiles={0x2,0x3,0x12,0x13};
  
ongrass=0;
  for (
i=0;i<4;i++) {
    if (
tiles[mousex-1+i%2,mousey-1+int(i/2)] in grasstilesongrass++;
  }
  if (
ongrass==4) {
    for (
i=0;i<4;i++) tiles[mousex-1+i%2,mousey-1+int(i/2)]=bushtiles[i];
  }
  
updateboard mousex-1,mousey-1,2,2;
  
timeout=0.05;

Why not just set ongrass = 1; in the beginning, then set it to 0 if its not? And you should just put the if(leftmousebutton) on the timeout = 0.05;, I dislike if (event && lol), but I guess that's why GS2 was made.
__________________
Reply With Quote
  #22  
Old 05-10-2007, 02:47 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I could have, and I guess it would have made a little sense. But either way the result is the same--I'm checking whether or not the four tiles are grass.
PHP Code:
// NPC made by Dusty
if (mousedowntimeout=0.05;
if (
timeout && leftmousebutton) {
  
grasstiles={0x0,0x1,0x10,0x1ff,0x3ff,0x7ff,0x835,0x836,0x837};
  
bushtiles={0x2,0x3,0x12,0x13};
  
ongrass=1;
  for (
i=0;i<4;i++) {
    if (!(
tiles[mousex-1+i%2,mousey-1+int(i/2)] in grasstiles)) ongrass=0;
  }
  if (
ongrass==1) {
    for (
i=0;i<4;i++) tiles[mousex-1+i%2,mousey-1+int(i/2)]=bushtiles[i];
    
updateboard mousex-1,mousey-1,2,2;
  }
  
timeout=0.05;

Also, I suppose the event && blah is just preference.
Reply With Quote
  #23  
Old 05-10-2007, 08:05 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by cbkbud View Post
I dislike if (event && lol), but I guess that's why GS2 was made.
No... that's called styling preference. rofl
Reply With Quote
  #24  
Old 05-10-2007, 09:23 PM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by Chandler View Post
No... that's called styling preference. rofl
Haha. I find that funny because he yells at anyone who bashes his style and shows his 'style thread'. ( which I would prefer Skyld's over his )
__________________
- Zidane / Zidaya
Reply With Quote
  #25  
Old 05-11-2007, 01:04 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
<3 Skyld's style.
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 09:07 PM.


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