Graal Forums

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

ownerofbabylon 07-21-2001 11:53 AM

setimgpart
 
1 Attachment(s)
alright, im working on this project and I need to know how to do this. I have been experimenting and its not working. I need to know how to take a gif such as the attachment included (not the one im actually using) and do it so if a player is facing left and weapon is fired it shows one part of the gif and if there right it shows another and so on. If you got any idea please help.

The gif included is a bomy and i just used this as an example.

Cybnext_Design 07-21-2001 12:10 PM

NPC Code:

if (playerdir==0) {
setgifpart 0,0,32,32;
}
if (playerdir==1) {
setgifpart 32,0,32,32;
}
if (playerdir==2) {
setgifpart 64,0,32,32;
}
if (playerdir==3) {
setgifpart 96,0,32,32;
}



that would be kidna how you would do it, i think.

ownerofbabylon 07-21-2001 12:29 PM

I think it is accept, how do i add the picture in so it knows what picture to take the part from?

Cybnext_Design 07-21-2001 12:39 PM

ill check up on that, but im pretty sure i know how to do it

Cybnext_Design 07-21-2001 12:44 PM

NPC Code:

setgif bomy_chamo3.png;
if (playerdir==0) {
setgifpart 0,0,32,32;
}
if (playerdir==1) {
setgifpart 32,0,32,32;
}
if (playerdir==2) {
setgifpart 64,0,32,32;
}
if (playerdir==3) {
setgifpart 96,0,32,32;
}



This would be the right code.

ownerofbabylon 07-21-2001 01:34 PM

wow thanks. :D I been experimenting with this alot and it works but its hard to figure out what coords to use for what part. Is there an easy way to do this rather than entering random coords?

Cybnext_Design 07-21-2001 02:33 PM

If you have a nice image editor like Adobe or PSP, those programs give you the coords at which ur mouse is at. So its very easy to find coords.

ownerofbabylon 07-22-2001 12:03 AM

Oh thanks man. I got psp7 that i got from a website (warez) and I will go try and use that =D

Merlin 07-22-2001 12:17 AM

Quote:

Originally posted by Cybnext_Design
NPC Code:

setgif bomy_chamo3.png;
if (playerdir==0) {
setgifpart 0,0,32,32;
}
if (playerdir==1) {
setgifpart 32,0,32,32;
}
if (playerdir==2) {
setgifpart 64,0,32,32;
}
if (playerdir==3) {
setgifpart 96,0,32,32;
}



This would be the right code.

where do you get the #'s in the setgifpart?

ownerofbabylon 07-22-2001 12:29 AM

umm the first ones are x and y and the second are the width and height of it. so setimgpart example.png x,y,width,height

ownerofbabylon 07-22-2001 12:29 AM

I just dont know because I got the coordinates on psp and i have them but i dont know if they go in x,y or width,height

:(

Cybnext_Design 07-22-2001 02:01 AM

Its kind of hard to explain how to use psp to get the coords and stuff. But just play around with the selection tool and im sure u will figure it out.

ownerofbabylon 07-22-2001 02:10 AM

alright heres what i got. I see the coords in the bottom left of PSP. I get the coords of the top left of the part of the picture i want. I then drag the selection tool down over the picture so i have it completely in a box and more coords appear next to the first. I put the first coords in the x and y. and the second set in the width and height. For some reason it gets more than the picture though so im not sure =\

Cybnext_Design 07-22-2001 02:25 AM

Here is how you would show the 4 directions of a bomy:

NPC Code:

setgif bomy_chamo3.gif;
if (playerdir==0) {
setgifpart 0,0,48,48;
}
if (playerdir==1) {
setgifpart 48,0,48,48;
}
if (playerdir==2) {
setgifpart 96,0,48,48;
}
if (playerdir==3) {
setgifpart 144,0,48,48;
}


ownerofbabylon 07-22-2001 11:16 AM

thats cool but i need to know how to find the numbers for the x,y,width,height part of it.

Cybnext_Design 07-22-2001 11:21 AM

1 Attachment(s)
Look at the attachment, you might get the point of where to get the coords and width and height from it.

ownerofbabylon 07-22-2001 11:25 AM

oh ok thanks. How do i get that? just drag that little selection square thing over the area that I want to appear??

Cybnext_Design 07-22-2001 01:36 PM

yes, but dont release the selection.

grim_squeaker_x 07-22-2001 05:51 PM

Quote:

Originally posted by Cybnext_Design
Here is how you would show the 4 directions of a bomy:

NPC Code:

setgif bomy_chamo3.gif;
if (playerdir==0) {
setgifpart 0,0,48,48;
}
if (playerdir==1) {
setgifpart 48,0,48,48;
}
if (playerdir==2) {
setgifpart 96,0,48,48;
}
if (playerdir==3) {
setgifpart 144,0,48,48;
}


Hi, using the following script would be better:
NPC Code:
setimg bomy_chamo3.png; //Yes it's PNG
setimgpart bomy_chamo3.png,dir*48,this.sprite*48,48,48;


And then you'd need to script the proper sprites for it to use.

ownerofbabylon 07-23-2001 04:29 AM

Lady Midnight is so smart :eek:


All times are GMT +2. The time now is 11:43 AM.

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