Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Need help in changing a images size (https://forums.graalonline.com/forums/showthread.php?t=134265659)

khortez 01-31-2012 03:50 AM

Need help in changing a images size
 
i'm trying to make a images size smaller so that i can separate the image i want from the rest of the images.

In case of confusion, i'm trying to separate the image just like you would in gani editor, by changing the sprites width and height, is there any way to do this via script?

fowlplay4 01-31-2012 04:22 AM

All my examples draw your head sprite facing down.

Using findimg, partx, party, partw, parth:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
with (findimg(200)) {
    
player.x;
    
player.3;
    
image player.head;
    
partx 0;
    
party 32 2;
    
partw 32;
    
parth 32;

    
// If you want to adjust it's zoom factor (play with this variable)
    
zoom 1;
  }


Using showimg and changeimgpart:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
showimg(200player.headplayer.xplayer.3);
  
changeimgpart(20003223232);
  
changeimgzoom(2001); // How to Change Zoom Factor


Using setimgpart for level npcs:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
setimgpart(player.head032 23232);
  
zoom 1// You can just change zoom directly here (GS2 only)



khortez 01-31-2012 05:36 AM

Interesting, the wiki labeled partx, y, w, and h as floats, maby that's why it wasn't working when i used it. what part of an image does partw and parth change?


Edit: actually, please tell me how they all work. I'm playing with them and it seems i have no understanding of any of them.

fowlplay4 01-31-2012 05:55 AM

Quote:

Originally Posted by khortez (Post 1683250)
Interesting, the wiki labeled partx, y, w, and h as floats, maby that's why it wasn't working when i used it. what part of an image does partw and parth change?

width, height.

khortez 01-31-2012 06:12 AM

Never mind my edit, i get it. thanks fowlplay4

callimuc 01-31-2012 02:34 PM

Just in case other players might get across that question:

Quote:

Originally Posted by khortez (Post 1683250)
what part of an image does partw and parth change?

partx and party are changing the locations from where the image will be shown. partw and parth are changing the width and height from the image (how big it will appear). So:

PHP Code:

with (findimg(200)) {
  
image "head0.png";
  
partx =  0;  //starting x
  
party 64;  //starting y
  
partw 32;  //width 
  
parth 32;  //height


Will display the head0.png. It will show that image from the image´s x = 0 and the images y = 64 (from there on the front view of the head starts). The width will be 32 aswell as the height. So there will be only the front view of the head displayed

Just explained it that way since you told me once that it helps you better :)

khortez 01-31-2012 03:37 PM

Quote:

Originally Posted by callimuc (Post 1683261)
Just in case other players might get across that question:



partx and party are changing the locations from where the image will be shown. partw and parth are changing the width and height from the image (how big it will appear). So:

PHP Code:

with (findimg(200)) {
  
image "head0.png";
  
partx =  0;  //starting x
  
party 64;  //starting y
  
partw 32;  //width 
  
parth 32;  //height


Will display the head0.png. It will show that image from the image´s x = 0 and the images y = 64 (from there on the front view of the head starts). The width will be 32 aswell as the height. So there will be only the front view of the head displayed

Just explained it that way since you told me once that it helps you better :)


Thank you ^^ i appreciate it, some others might benefit from this as well later.


All times are GMT +2. The time now is 08:31 PM.

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