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 06-16-2004, 09:13 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
dynamic setshape2?

Ok so i dont really know if this is possibile or not yet, i know what im trying to do, and ive done it every way i can really think of.

What i was trying to do was use imgwidth and imgheight to get the first two numbers for setshape2 then based on that, turn it into the correct tiletype.

So here is what i did

NPC Code:

this.length = imglength(chair1.png);
this.width = imgwidth(chair1.png);



from that i get i think 5 for length and 3 for width, anyways

then I got here, and its where i have my question
NPC Code:

setshape2 this.length,this.width,{tiletypes};



now i guess what im wondering is if its possibile to set the tiletypes based on the length and width of an image, Say i had two diffrent chairs, but one is larger then the other. Mabye there is something i have overlooked, or this just isnt possibile yet. (or at all ever? )
__________________
Reply With Quote
  #2  
Old 06-16-2004, 02:45 PM
VeX_RaT_Boy VeX_RaT_Boy is offline
WannaBe Scripter
VeX_RaT_Boy's Avatar
Join Date: Aug 2002
Location: Norway
Posts: 960
VeX_RaT_Boy is on a distinguished road
Send a message via ICQ to VeX_RaT_Boy Send a message via AIM to VeX_RaT_Boy Send a message via Yahoo to VeX_RaT_Boy
Quote:
Originally Posted by Andy0687
Ok so i dont really know if this is possibile or not yet, i know what im trying to do, and ive done it every way i can really think of.

What i was trying to do was use imgwidth and imgheight to get the first two numbers for setshape2 then based on that, turn it into the correct tiletype.

So here is what i did

NPC Code:

this.length = imglength(chair1.png);
this.width = imgwidth(chair1.png);



from that i get i think 5 for length and 3 for width, anyways

then I got here, and its where i have my question
NPC Code:

setshape2 this.length,this.width,{tiletypes};



now i guess what im wondering is if its possibile to set the tiletypes based on the length and width of an image, Say i had two diffrent chairs, but one is larger then the other. Mabye there is something i have overlooked, or this just isnt possibile yet. (or at all ever? )
imgwidth and imglenght will return the size in pixels, so Î guess you should do this for the size in tiles:
NPC Code:

setshape2 int(this.length/16),int(this.widht/16),{tiletypes};

__________________
-Kjetil Valen
Reply With Quote
  #3  
Old 06-16-2004, 05:53 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
dunno if you can pass arrays to the command, but try creating an array with the tiletypes;
array = {22,22,22,0,22,0};
or so (probably need to use a for loop) and pass it like so
setshape2 int(this.length/16),int(this.width/16),array;

works on showpoly, well I think it does... my script that uses that doesn't work for everyone for some reason...
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #4  
Old 06-16-2004, 07:26 PM
Duwul Duwul is offline
Registered User
Join Date: Nov 2003
Posts: 105
Duwul is on a distinguished road
I'm pretty sure you can use arrays for setshape2. I've seen it done before.
__________________
-Ajira
Liek, omigosh.
<3 DoomsDay.
Reply With Quote
  #5  
Old 06-16-2004, 09:47 PM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
I used arrays a while ago with setshape, it worked from time to time but not all the time, never understood why. This is SOOOOOO a Kai answer that you need.
__________________
Reply With Quote
  #6  
Old 06-17-2004, 02:45 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
its not so much getting the array i need, its passing the array into it.

ive tried for loops and stuff, but i guess im just pretty bad with setting it up

like for example i decided mabye i could pass it as an index of a string, but that showed no results either.
__________________
Reply With Quote
  #7  
Old 06-17-2004, 03:29 AM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
NPC Code:
this.width = int(width);
this.height = int(height);
setarray this.array,this.width * this.height;
for (i=0;i < this.width;i++) {
for (j=0;j < this.height;j++) {
this.array[i+j*this.width] = 3;
}
}
setshape2 this.width,this.height,this.array;


Try that.
__________________
Reply With Quote
  #8  
Old 06-17-2004, 10:15 AM
VeX_RaT_Boy VeX_RaT_Boy is offline
WannaBe Scripter
VeX_RaT_Boy's Avatar
Join Date: Aug 2002
Location: Norway
Posts: 960
VeX_RaT_Boy is on a distinguished road
Send a message via ICQ to VeX_RaT_Boy Send a message via AIM to VeX_RaT_Boy Send a message via Yahoo to VeX_RaT_Boy
....that would still turn out in pixels, and setshape2 uses tiles.
__________________
-Kjetil Valen
Reply With Quote
  #9  
Old 06-17-2004, 10:04 PM
calum calum is offline
Registered User
Join Date: Nov 2003
Location: Scotland
Posts: 182
calum is on a distinguished road
Shouldn't it be...
NPC Code:

this.height = imgheight(chair1.png);
this.width = imgwidth(chair1.png);

__________________
Reply With Quote
  #10  
Old 06-20-2004, 07:55 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally Posted by calum
Shouldn't it be...
NPC Code:

this.height = imgheight(chair1.png);
this.width = imgwidth(chair1.png);

width and height are npc variables that return the pixel size of the npc (that has a size, of course), there isn't anything left to explain, save for just giving you a script (which Goboom practically did )
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
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 05:23 AM.


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